Skip to content

Commit

Permalink
fix: local gpu enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
aby913 committed Sep 10, 2024
1 parent 948a2b0 commit 4dcf306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 0 additions & 5 deletions cmd/ctl/options/cli_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ type CliTerminusInstallOptions struct {
WSL bool
BaseDir string
Manifest string

GpuEnable bool
GpuShare bool
}

func NewCliTerminusInstallOptions() *CliTerminusInstallOptions {
Expand All @@ -77,8 +74,6 @@ func (o *CliTerminusInstallOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&o.MiniKube, "minikube", false, "MacOS platform requires setting minikube parameters, Default: false")
cmd.Flags().StringVar(&o.MiniKubeProfile, "profile", "", "Set minikube profile name")
cmd.Flags().BoolVar(&o.WSL, "wsl", false, "Windows platform requires setting WSL parameters, Default: false")
cmd.Flags().BoolVar(&o.GpuEnable, "gpu-enable", false, "GPU Enable")
cmd.Flags().BoolVar(&o.GpuShare, "gpu-share", false, "GPU Share")
cmd.Flags().StringVar(&o.BaseDir, "base-dir", "", "Set pre-install package base dir , default value $HOME/.terminus")
cmd.Flags().StringVar(&o.Manifest, "manifest", "", "Set pre-install package manifest file , default value $HOME/.terminus/installation.manifest")
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/pipelines/install_terminus.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"encoding/base64"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

"bytetrade.io/web3os/installer/cmd/ctl/options"
ctrl "bytetrade.io/web3os/installer/controllers"
Expand All @@ -25,14 +27,17 @@ func CliInstallTerminusPipeline(opts *options.CliTerminusInstallOptions) error {
}
}

var gpuEnable = strings.EqualFold(os.Getenv("LOCAL_GPU_ENABLE"), "1")
var gpuShare = strings.EqualFold(os.Getenv("LOCAL_GPU_SHARE"), "1")

arg := common.NewArgument()
arg.SetBaseDir(opts.BaseDir)
arg.SetKubernetesVersion(opts.KubeType, "")
arg.SetTerminusVersion(opts.Version)
arg.SetMinikube(opts.MiniKube, opts.MiniKubeProfile)
arg.SetWSL(opts.WSL)
arg.SetProxy(opts.Proxy, opts.RegistryMirrors)
arg.SetGPU(opts.GpuEnable, opts.GpuShare)
arg.SetGPU(gpuEnable, gpuShare)

if err := arg.ArgValidate(); err != nil { // todo validate gpu for platform and os version
return err
Expand Down
6 changes: 5 additions & 1 deletion pkg/pipelines/prepare_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package pipelines

import (
"fmt"
"os"
"strings"

"bytetrade.io/web3os/installer/cmd/ctl/options"
"bytetrade.io/web3os/installer/pkg/common"
Expand All @@ -16,13 +18,15 @@ func PrepareSystemPipeline(opts *options.CliPrepareSystemOptions) error {
}

var terminusVersion = opts.Version // utils.GetTerminusVersion(version)
var gpuEnable = strings.EqualFold(os.Getenv("LOCAL_GPU_ENABLE"), "1")
var gpuShare = strings.EqualFold(os.Getenv("LOCAL_GPU_SHARE"), "1")

var arg = common.NewArgument()
arg.SetBaseDir(opts.BaseDir)
arg.SetTerminusVersion(terminusVersion)
arg.SetKubernetesVersion(opts.KubeType, "")
arg.SetProxy(opts.RegistryMirrors, opts.RegistryMirrors)
arg.SetGPU(true, true)
arg.SetGPU(gpuEnable, gpuShare)
arg.SetStorage(createStorage(opts))
arg.SetWSL(opts.WSL)

Expand Down

0 comments on commit 4dcf306

Please sign in to comment.