1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-06 20:25:56 +01:00

Verbose and error trapping cleaner

This commit is contained in:
Peter Boyle 2018-09-09 14:28:02 +01:00
parent 6d0f1aabb1
commit b4967f0231
2 changed files with 6 additions and 4 deletions

View File

@ -44,7 +44,7 @@ void CartesianCommunicator::Init(int *argc, char ***argv)
MPI_Initialized(&flag); // needed to coexist with other libs apparently
if ( !flag ) {
MPI_Init_thread(argc,argv,MPI_THREAD_MULTIPLE,&provided);
assert (provided == MPI_THREAD_MULTIPLE);
//assert (provided == MPI_THREAD_MULTIPLE);
}
Grid_quiesce_nodes();

View File

@ -49,6 +49,7 @@ void GlobalSharedMemory::Init(Grid_MPI_Comm comm)
#endif
MPI_Comm_rank(WorldShmComm ,&WorldShmRank);
MPI_Comm_size(WorldShmComm ,&WorldShmSize);
std::cout << " World communicator of size " <<WorldSize << std::endl;
std::cout << " Shared communicator of size " <<WorldShmSize << std::endl;
// WorldShmComm, WorldShmSize, WorldShmRank
@ -193,13 +194,14 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
//std::cerr << " allocating "<<bytes <<" bytes "<< std::endl;
if ( cudaMallocManaged(&ShmCommBuf, bytes) != cudaSuccess) {
perror("cudaMallocManaged failed ");
auto err = cudaMallocManaged(&ShmCommBuf, bytes);
if ( err != cudaSuccess) {
std::cerr << " SharedMemoryMPI.cc cudaMallocManaged failed for " << bytes<<" bytes " <<cudaGetErrorString(err)<< std::endl;
exit(EXIT_FAILURE);
}
if (ShmCommBuf == (void *)NULL ) {
perror("cudaMallocManaged failed ");
std::cerr << " SharedMemoryMPI.cc cudaMallocManaged failed NULL pointer for " << bytes<<" bytes " << std::endl;
exit(EXIT_FAILURE);
}
std::cerr << " Cuda allocated managed memory at "<<std::hex<<ShmCommBuf <<" - " << ((uint64_t)ShmCommBuf + bytes)<<std::dec<< std::endl;