mvapich2 include problem


I’m attempting to compile an “mvapich2” example but, the “mpi.h” include is unresolved. How would I fix this error?

How do you compile the code? using mpicc or using nvcc and then linking to MPI?
Would you please try this command:
Here, MV2PATH is your mvapich installation directory. This will include the header file.

The better way is to include the above command in your ~/.bashrc file. (suppose you use Linux system)
Don’t forget to include the path to MV2PATH and source the .bashrc file.


Thanks for the info however, I still get the same unresolved error for “mpi.h”: see attachments
Parent.cpp (1.11 KB)

I am afraid that I cannot find the attachment.
Would you please attach the details of the error? And more details about your configuration will be better.


There seems to be an error/malfunction in the posting method; so, I’ll re post the attachments here.
Parent.cpp (1.11 KB)
makeInstall.txt (70.5 KB)

Please omit.

I saw some minor mistake in the attached picture.
export C_INCLUDE_PATH=/usr/local/bin/install/mvapich2-2.0a/include/Include:SC_INCLUDE_PATH

would you mind changing it to this and try again?
export C_INCLUDE_PATH=/usr/local/bin/install/mvapich2-2.0a/include/Include:$C_INCLUDE_PATH

Also, would you mind changing the PATH variable as well?
export PATH=$PATH:/usr/local/cuda-5.0/bin
export PATH=/usr/local/cuda-5.0/bin:$PATH

Also, I am not quite sure whether the /usr/local/bin/install/mvapich2-2.0a/include/Include is the correct path to your include files.

When you compiled the mvapich2-2.0a, did you specific the install path like this?
./configure --prefix=/path/to/mv2-install/

Then, the correct include path is: /path/to/mv2-install/include.

(* /path/to/mv2-install/ is a illustration of your mv2 install path, you can specify it wherever you like)


I don’t see the difference between “export C_INCLUDE_PATH=/usr/local/bin/install/mvapich2-2.0a/include/Include:SC_INCLUDE_PATH” and “export C_INCLUDE_PATH=/usr/local/bin/install/mvapich2-2.0a/include/Include:$C_INCLUDE_PATH”; please elaborate

One is ‘SC’ and the other is ‘$C’


I finally got to this point “export C_INCLUDE_PATH=/usr/local/bin/install/mvapich2-2.0a/include:$C_INCLUDE_PATH” issued from the command line in the downloads folder but, I still get “mpi.h unresolved” error at build time. Oh, I even changed the include paths and I still get the unresolved include “mpi.h” build time error.

Sorry for the delayed response. Would you please try these three steps?

  1. Would you please add this line to your .bashrc rather than command line?
    export C_INCLUDE_PATH=/usr/local/bin/install/mvapich2-2.0a/include:$C_INCLUDE_PATH

Also, before you run it, you can use ‘echo $C_INCLUDE_PATH’ (no hyphen) in command line to check whether the mvapich2 include directory has been included.

  1. Would you please try (temporal solution) adding the absolute path to “mpi.h”?
    #include “/usr/local/bin/install/mvapich2-2.0a/include/mpi.h”
    Also, when you compile the program, use the absolute path for mpicc
    /usr/local/bin/install/mvapich2-2.0a/bin/mpicc source_code.c -o obj

  2. Would you please attach the screen snapshot for ‘ls /usr/local/bin/install/mvapich2-2.0a/include’ and ‘ls /usr/local/bin/install/mvapich2-2.0a/bin/’?

Thanks a lot.


When I did a right click on properties for the project, I added mvapich2 to the includes: see attachment.

I saw the screen snapshot and it shows: /usr/include/mpich2 is included.
Would you mind adding the ‘/usr/local/bin/install/mvapich2-2.0a/include’ as well?
Also, would you please showing the ‘ls /usr/include/mpich2’ results?

ok, see attachment.

Hi, where is your path for installed mvapich2? This seems like a mpich2 path rather than a mvapich2 path.

ok, here it is: see attachment

yes, it was added to the includes

Would you please add screen snapshot of ‘ls /usr/include/mpich2’?
I think the Screen_Shot_7.jpeg shows the correct include file for mpi.h.
Did you add that to your include file?

Even though I was able to resolve the “mpi.h” issue, I still get syntax errors in the code: see attachments

Sorry for replying late. Would you mind sharing all your source code? I want to give it a try on Nsight.


Happy New Year,

I just noticed your reply so, here is the code.