Setting up G++ or ICC for mpi.h on Ubuntu
Asked Answered
R

3

5

I have never done any major programing outside of VS08.

I am trying to compile a program called LAMMPS with either of the two relevant make files. One calls g++ and the other calls icc (Intel's compiler).

icc produces this error:

icc -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M write_restart.cpp > write_restart.d write_restart.cpp(15): catastrophic error: cannot open source file "mpi.h" #include "mpi.h"

and g++ throws this error

g++ -g -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M verlet.cpp > verlet.d pointers.h:25: fatal error: mpi.h: No such file or directory compilation terminated.

The mpi.h file is located in /usr/lib/openmpi/include

It is my understanding that I need to set that $PATH variable which reads

bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/intel/bin:/usr/lib/openmpi/include:

and $LD_LIBRARY_PATH which currently reads

/usr/lib/openmpi/lib:

SO, how does one include the mpi.h file? So that either icc or g++ find it?

Reube answered 23/4, 2011 at 4:16 Comment(0)
R
2

Okay, so I got it to work with g++ when setting up cc as "mpic++.mpich2" instead of "mpic++"

Reube answered 10/11, 2012 at 19:52 Comment(0)
F
5

mpi.h is a header for MPI library. That would be included if you use mpic++ MPI compiler wrapper instead of g++ in your makefile. mpic++ will call the appropriate compiler. From what you describe you have openmpi package installed on your ubuntu machine.

For more info, you need to consult the manual, e.g.

http://lammps.sandia.gov/doc/Section_start.html#2_2 (for LAMMPS)

and perhaps you need to see openmpi manual as to how to set up additional compiler. Not sure if this can be done after openmpi itself has been built. By default I think in Ubuntu openmpi compiler wrappers would only call g++. CMIIW.

Fuge answered 23/4, 2011 at 4:28 Comment(2)
Make file spits out an executable that immediately crashes with >Fatal error in MPI_Comm_rank: Invalid communicator, error stack: MPI_Comm_rank(106): MPI_Comm_rank(comm=0x8e5bc0, rank=0x2854d00) failed MPI_Comm_rank(64).: Invalid communicatorReube
Okay, so I got it to work with g++ when setting up cc as "mpic++.mpich2" instead of "mpic++"Reube
R
2

Okay, so I got it to work with g++ when setting up cc as "mpic++.mpich2" instead of "mpic++"

Reube answered 10/11, 2012 at 19:52 Comment(0)
N
0

you can try compile using openmpi make file in /src/MAKE make openmpi

in my case, this option was successful

Naughton answered 24/7, 2012 at 14:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.