forked from determined-ai/determined
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: dispatcher RM supports slot type ROCM (determined-ai#329)
* chore: dispatcher RM supports slot type ROCM
- Loading branch information
1 parent
cdfdaba
commit b8a088a
Showing
2 changed files
with
99 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package tasks | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/determined-ai/determined/master/pkg/device" | ||
) | ||
|
||
const workDir = "/workdir" | ||
|
||
func TestTaskSpec_computeLaunchConfig(t *testing.T) { | ||
type args struct { | ||
slotType device.Type | ||
workDir string | ||
slurmPartition string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want *map[string]string | ||
}{ | ||
{ | ||
name: "Dispatcher is notified that CUDA support required", | ||
args: args{ | ||
slotType: device.CUDA, | ||
workDir: workDir, | ||
slurmPartition: "partitionName", | ||
}, | ||
want: &map[string]string{ | ||
"workingDir": workDir, | ||
"enableNvidia": trueValue, | ||
"enableWritableTmpFs": trueValue, | ||
"partition": "partitionName", | ||
}, | ||
}, | ||
{ | ||
name: "Dispatcher is notified that ROCM support required", | ||
args: args{ | ||
slotType: device.ROCM, | ||
workDir: workDir, | ||
slurmPartition: "partitionName", | ||
}, | ||
want: &map[string]string{ | ||
"workingDir": workDir, | ||
"enableROCM": trueValue, | ||
"enableWritableTmpFs": trueValue, | ||
"partition": "partitionName", | ||
}, | ||
}, | ||
{ | ||
name: "Verify behavior when no partition specified", | ||
args: args{ | ||
slotType: device.CUDA, | ||
workDir: workDir, | ||
slurmPartition: "", | ||
}, | ||
want: &map[string]string{ | ||
"workingDir": workDir, | ||
"enableNvidia": trueValue, | ||
"enableWritableTmpFs": trueValue, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
tr := &TaskSpec{} | ||
if got := tr.computeLaunchConfig( | ||
tt.args.slotType, | ||
tt.args.workDir, | ||
tt.args.slurmPartition); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("TaskSpec.computeLaunchConfig() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |