Number of devices can be overriden in config file

This commit is contained in:
Yohai Meiron 2020-04-05 11:17:21 -04:00
parent 7fae35a2d9
commit 56abe820c3
4 changed files with 24 additions and 15 deletions

View file

@ -942,15 +942,15 @@ int main(int argc, char *argv[])
/* init the local GRAPE's */
#ifdef MPI_OVERRIDE
numGPU = 1; // TODO get this from config file
clusterid = myRank % numGPU;
#else
MPI_Comm shmcomm;
MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &shmcomm);
MPI_Comm_size(shmcomm, &numGPU);
MPI_Comm_rank(shmcomm, &clusterid);
#endif
if (config->devices_per_node==0) {
MPI_Comm shmcomm;
MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &shmcomm);
MPI_Comm_size(shmcomm, &numGPU);
MPI_Comm_rank(shmcomm, &clusterid);
} else {
numGPU = config->devices_per_node;
clusterid = myRank % numGPU;
}
printf("Rank of the processor %03d : Number of GPUs %01d : Cluster ID %01d \n", myRank, numGPU, clusterid);
fflush(stdout);