We should check if the used MPI is cuda aware
Before trying to send GPU buffers via cuda-aware MPI by passing it CUDA device pointers we should check if the MPI is even CUDA aware. This can for example be done as follows:
#include "mpi-ext.h" /* Needed for CUDA-aware check */
if (1 == MPIX_Query_cuda_support()) {
printf("This MPI library has CUDA-aware support.\n");
} else {
printf("This MPI library does not have CUDA-aware support.\n");
}
This would avoid users trying to send CUDA GPU buffers between process without a cuda-aware MPI.