Skip to content

Commit

Permalink
Add comment explaining unusual placement of setDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerw authored and trquinn committed May 9, 2024
1 parent c4ce78e commit b1d1f04
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ class ProjectionsControl : public CBase_ProjectionsControl {
public:
ProjectionsControl() {
#ifdef CUDA
// GPUs are assigned to nodes in a round-robin fashion. This allows the user to define
// one virtual node per device and utilize multiple GPUs on a single node
// Beacuse devices are assigned per-PE, this is a convenient place to call setDevice
// Note that this code has nothing to do with initalizing projections
int numGpus;
cudaGetDeviceCount(&numGpus);
cudaSetDevice(CmiMyNode() % numGpus);
Expand Down

0 comments on commit b1d1f04

Please sign in to comment.