diff --git a/hipamd/src/hip_hcc.cpp b/hipamd/src/hip_hcc.cpp index 945248c11f..e9de7f53a6 100644 --- a/hipamd/src/hip_hcc.cpp +++ b/hipamd/src/hip_hcc.cpp @@ -291,6 +291,7 @@ thread_local int tls_defaultDevice = 0; // Global initialization. std::once_flag hip_initialized; ihipDevice_t *g_devices; // Array of all non-emulated (ie GPU) accelerators in the system. +bool g_visible_device = false; // Set the flag when HIP_VISIBLE_DEVICES is set unsigned g_deviceCnt; //================================================================================================= @@ -299,7 +300,7 @@ unsigned g_deviceCnt; //Forward Declarations: //================================================================================================= INLINE bool ihipIsValidDevice(unsigned deviceIndex); - +INLINE bool ihipIsVisibleDevice(unsigned deviceIndex); //================================================================================================= // Implementation: //================================================================================================= @@ -865,6 +866,7 @@ void ihipReadEnv_I(int *var_ptr, const char *var_name1, const char *var_name2, c std::string device_id; // Clean up the defult value g_hip_visible_devices.clear(); + g_visible_device = true; // Read the visible device numbers while (std::getline(ss, device_id, ',')) { if (atoi(device_id.c_str()) >= 0) { @@ -965,9 +967,10 @@ void ihipInit() for (int i=0; i"); - } INLINE bool ihipIsValidDevice(unsigned deviceIndex)