Choosing a cuda device with multiple processor threads

Can you tell me how the cuda runtime chooses a GPU device if 2 or more host threads use cuda runtime?

Does runtime execute separate GPU devices for each thread?

Do I need to explicitly install a GPU device?

thank

+3
source share
3 answers

Yes, the GPU device must be explicitly set or used by default (usually device 0)

Keep in mind that as soon as the runtime starts using one device, all functions called in the same thread will be attached to this device.

Something that is useful to me when starting a stream,

cudaThreadExit(); // clears all the runtime state for the current thread
cudaSetDevice(deviceId); // explicit set the current device for the other calls
cudaMalloc
cudaMemcpy
etc.. 

, .

+7

, .

nvidia-smi -q, Compute Mode GPU. CUDA, .

, . . : , , .

, nvidia-smi -c :

  • DEFAULT
  • EXCLUSIVE_THREAD
  • EXCLUSIVE_PROCESS
+5

, GPU .

, EXCLUSIVE_THREAD ( jopasserat). , .

EXCLUSIVE_PROCESS.

. 3.4 cuda. ​​

+1

Source: https://habr.com/ru/post/1741587/


All Articles