Skip to content

Commit

Permalink
Fix local gpu issue (microsoft#1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
chicm-ms authored and SparkSnail committed Apr 19, 2019
1 parent b7ca02c commit 1d9b0a9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/nni_manager/training_service/local/localTrainingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class LocalTrainingService implements TrainingService {

private getEnvironmentVariables(
trialJobDetail: TrialJobDetail,
resource?: { gpuIndices: number[] }): { key: string; value: string }[] {
resource: { gpuIndices: number[] }): { key: string; value: string }[] {
const envVariables: { key: string; value: string }[] = [
{ key: 'NNI_PLATFORM', value: 'local' },
{ key: 'NNI_SYS_DIR', value: trialJobDetail.workingDirectory },
Expand All @@ -379,12 +379,10 @@ class LocalTrainingService implements TrainingService {
{ key: 'MULTI_PHASE', value: this.isMultiPhase.toString() }
];

if (resource !== undefined && resource.gpuIndices.length > 0) {
envVariables.push({
key: 'CUDA_VISIBLE_DEVICES',
value: this.gpuScheduler === undefined ? '' : resource.gpuIndices.join(',')
});
}
envVariables.push({
key: 'CUDA_VISIBLE_DEVICES',
value: this.gpuScheduler === undefined ? '' : resource.gpuIndices.join(',')
});

return envVariables;
}
Expand Down

0 comments on commit 1d9b0a9

Please sign in to comment.