Set active device when the device stream manager is initialized
authorArtem Zhmurov <zhmurov@gmail.com>
Sun, 20 Sep 2020 09:18:16 +0000 (09:18 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Sun, 20 Sep 2020 09:18:16 +0000 (09:18 +0000)
Replace the direct CUDA API call in PME by the wrapper called
when the device context and streams are created.

src/gromacs/ewald/pme_gpu_internal.cpp
src/testutils/test_hardware_environment.cpp

index 88e39976c77d53769f555fdd38de93494935cdf8..9575aaf2ff36b6ded5229070a2ef0faa64ce3d58 100644 (file)
@@ -503,12 +503,6 @@ void pme_gpu_sync_spread_grid(const PmeGpu* pmeGpu)
  */
 static void pme_gpu_init_internal(PmeGpu* pmeGpu, const DeviceContext& deviceContext, const DeviceStream& deviceStream)
 {
-#if GMX_GPU_CUDA
-    // Prepare to use the device that this PME task was assigned earlier.
-    // Other entities, such as CUDA timing events, are known to implicitly use the device context.
-    CU_RET_ERR(cudaSetDevice(deviceContext.deviceInfo().id), "Switching to PME CUDA device");
-#endif
-
     /* Allocate the target-specific structures */
     pmeGpu->archSpecific.reset(new PmeGpuSpecific(deviceContext, deviceStream));
     pmeGpu->kernelParams.reset(new PmeGpuKernelParams());
index 4164527f9dcc633af26149be64b128c18fb21c54..a17aa980075829760013337cffceddee4db08775 100644 (file)
@@ -103,7 +103,6 @@ void TestHardwareEnvironment::SetUp()
     // Constructing contexts for all compatible GPUs - will be empty on non-GPU builds
     for (const DeviceInformation& compatibleDeviceInfo : getCompatibleDevices(hardwareInfo_->deviceInfoList))
     {
-        setActiveDevice(compatibleDeviceInfo);
         std::string description = getDeviceInformationString(compatibleDeviceInfo);
         testDeviceList_.emplace_back(std::make_unique<TestDevice>(description.c_str(), compatibleDeviceInfo));
     }