CUDA_DEVICE variable is ignored
The selection of a compute device via CUDA_DEVICE is ignored (at least for a given system configuration: 2 Kepler-GPUs and CUDA 5.5). halmd::device::device() always creates a context in device #0. The selection works if the invocation of HALMD is prefixed by nvlock.
Note that in halmd/utility/gpu/device.cpp context creation occurs indirectly via a call to cuda::thread::synchronize(), which resolves to cudaThreadSynchronize().
[The only other CUDA call in device() that cames before is cudaDriverGetVersion().]
#1 Updated by Nicolas Höft over 2 years ago
CUDA_DEVICE affect only the Driver-Based Profiler, see http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
In general, one should use CUDA_VISIBLE_DEVICES
#2 Updated by Felix Höfling over 2 years ago
Thanks, it didn't know about CUDA_VISIBLE_DEVICES. It must have been
introduced in some recent CUDA release. At least the following Pro Tip is
just from January this year:
Before closing the ticket we should try that it actually works with and