print GPU device ID for MPI ranks within a node
This commit is contained in:
parent
d15f5aff86
commit
fe5a110027
@ -9,6 +9,7 @@ extern "C" int ScaLBL_SetDevice(int rank){
|
|||||||
//int device = local_rank % n_devices;
|
//int device = local_rank % n_devices;
|
||||||
int device = rank % n_devices;
|
int device = rank % n_devices;
|
||||||
cudaSetDevice(device);
|
cudaSetDevice(device);
|
||||||
|
if (rank < n_devices) printf("MPI rank=%i will use GPU ID %i / %i \n",rank,device,n_devices);
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
// Initialize compute device
|
// Initialize compute device
|
||||||
int device=ScaLBL_SetDevice(rank);
|
int device=ScaLBL_SetDevice(rank);
|
||||||
if (rank<4) printf("Using GPU ID %i for rank %i \n",device,rank);
|
|
||||||
ScaLBL_DeviceBarrier();
|
ScaLBL_DeviceBarrier();
|
||||||
MPI_Barrier(comm);
|
MPI_Barrier(comm);
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
// Initialize compute device
|
// Initialize compute device
|
||||||
int device=ScaLBL_SetDevice(rank);
|
int device=ScaLBL_SetDevice(rank);
|
||||||
if (rank<4) printf("Using GPU ID %i for rank %i \n",device,rank);
|
|
||||||
ScaLBL_DeviceBarrier();
|
ScaLBL_DeviceBarrier();
|
||||||
MPI_Barrier(comm);
|
MPI_Barrier(comm);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user