print GPU device ID for MPI ranks within a node

This commit is contained in:
JamesEMcclure 2019-04-26 14:56:53 -04:00
parent d15f5aff86
commit fe5a110027
3 changed files with 1 additions and 2 deletions

View File

@ -9,6 +9,7 @@ extern "C" int ScaLBL_SetDevice(int rank){
//int device = local_rank % n_devices;
int device = rank % n_devices;
cudaSetDevice(device);
if (rank < n_devices) printf("MPI rank=%i will use GPU ID %i / %i \n",rank,device,n_devices);
return device;
}

View File

@ -41,7 +41,6 @@ int main(int argc, char **argv)
}
// Initialize compute device
int device=ScaLBL_SetDevice(rank);
if (rank<4) printf("Using GPU ID %i for rank %i \n",device,rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);

View File

@ -44,7 +44,6 @@ int main(int argc, char **argv)
}
// Initialize compute device
int device=ScaLBL_SetDevice(rank);
if (rank<4) printf("Using GPU ID %i for rank %i \n",device,rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);