Unverified Commit f15a9b61 authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

Fix check gpu index logic in local mode (#3163)

parent 9710f170
......@@ -58,12 +58,12 @@ class GPUScheduler {
return [];
}
public getSystemGpuCount(): number {
public getSystemGpuCount(): number | undefined{
if (this.gpuSummary !== undefined) {
return this.gpuSummary.gpuCount;
}
return 0;
return undefined;
}
public async stop(): Promise<void> {
......
......@@ -435,8 +435,8 @@ class LocalTrainingService implements TrainingService {
}
private checkSpecifiedGpuIndices(): void {
const gpuCount: number = this.gpuScheduler.getSystemGpuCount();
if (this.designatedGpuIndices !== undefined) {
const gpuCount: number | undefined = this.gpuScheduler.getSystemGpuCount();
if (this.designatedGpuIndices !== undefined && gpuCount !== undefined) {
for (const index of this.designatedGpuIndices) {
if (index >= gpuCount) {
throw new Error(`Specified GPU index not found: ${index}`);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment