Skip to content

Commit

Permalink
feat: envd up with --gpus (#1730)
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <kemingyang@tensorchord.ai>
  • Loading branch information
kemingy authored Aug 14, 2023
1 parent 89fb990 commit 7dfd379
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions pkg/app/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ var CommandUp = &cli.Command{
},
&cli.BoolFlag{
Name: "no-gpu",
Usage: "Launch the CPU container",
Usage: "Launch the CPU container even if it's a GPU image",
Value: false,
},
&cli.IntFlag{
Name: "gpus",
Usage: "Number of GPUs used in this environment",
Value: 0,
},
&cli.BoolFlag{
Name: "force",
Usage: "Force rebuild and run the container although the previous container is running",
Expand Down Expand Up @@ -199,15 +204,15 @@ func up(clicontext *cli.Context) error {

logrus.Debug("start running the environment")
// Do not attach GPU if the flag is set.
gpuEnable := clicontext.Bool("no-gpu")
var gpu bool
if gpuEnable {
gpu = false
disableGPU := clicontext.Bool("no-gpu")
var defaultGPU bool
if disableGPU {
defaultGPU = false
} else {
gpu = builder.GPUEnabled()
defaultGPU = builder.GPUEnabled()
}
numGPU := 0
if gpu {
numGPU := clicontext.Int("gpus")
if defaultGPU && numGPU == 0 {
numGPU = 1
}

Expand Down

0 comments on commit 7dfd379

Please sign in to comment.