2

I got an CUDA program (myprogram.cu) , and i want to Use MPI communication protocol.When i add header "mpi.h" and try to compile

  nvcc -c myprogram.cu -lmpi -l/usr/include/mpi -o output

I got : error: mpi.h : No such file or directory My program uses both HOST and DEVICE functions.

How can i compile mpi-cuda aware program? My program runs well , so i thought i dont need to upload my code. It just doesnt recognise the header,so i cant even write code for MPI. I compile my program in an environment that is capable of GPU Direct - MPI cuda-aware (university computer system) . Thanks in advance.

singa1994
  • 747
  • 1
  • 7
  • 18
  • you will find it easiest to compile mpi code with mpicc and cuda code with nvcc, then link them with mpicc. this implies separating the cuda and mpi parts of your code, which isnt hard to do in practice. – talonmies Sep 19 '16 at 06:07
  • @talonmies Yes i agree.I tried this version for codes,but my purpose is to send pointer from device memory ,so i won't lose in time with cudamemcpy from device to host.If i'm missing something i'll be pleased to hear. – singa1994 Sep 19 '16 at 08:19
  • You can use environment variables to say MPI which backend compiler to use. If you are using OpenMPI, try `OMPI_CC=nvcc mpicc myprogram.cu -o output`. It should work fine. – Jorge Bellon Sep 20 '16 at 20:22

0 Answers0