Compile of plumed 2.1.2 with gcc and mpi rather than mpicc

465 views
Skip to first unread message

Ben Cossins

unread,
May 7, 2015, 4:44:41 AM5/7/15
to plumed...@googlegroups.com
Dear Plumed users,

I am trying to produce a openmpi version of plumed 2.1.2 but i don not have access to a functional mpicc wrapper. I have gcc-4.7 and openmpi-1.4.4 and I provide all the mpi headers and libraries through CPPFLAGS.

The configure script detects openmpi except for the MPI_Init test and does not enable __PLUMED_MPI.

Is there a way for me to produce a mpi enabled plumed?

Many thanks

Ben Cossins

Giovanni Bussi

unread,
May 7, 2015, 4:50:59 AM5/7/15
to plumed...@googlegroups.com
Hi,

you should specify a proper mpi compiler with CXX=yourmpicxx.

If the configure script cannot compile a program containing "MPI_Init" that for sure indicates that it is trying to use a compiler not supporting MPI. Perhaps you have to supply the proper value also to LDFLAGS. Can you try to compiler yourself a short test MPI program?

Giovanni

--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
To post to this group, send email to plumed...@googlegroups.com.
Visit this group at http://groups.google.com/group/plumed-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/91c51ff8-1fe9-40ba-b051-aa578662c6a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Cossins

unread,
May 7, 2015, 5:03:35 AM5/7/15
to plumed...@googlegroups.com
Hi,

Thanks for such a rapid reply.

I have used this combination of gcc-4.7 and openmpi to compile quite a bit of MD software using MPI, so I think it can work.

I have also tried placing the "-D__PLUMED_MPI" flag in CPPFLAGS but this did not help.

Is it the case that I need to use mpicxx and cannot just provide gcc/g++ and the required libraries and headers?

Sorry to be so difficult,

Thanks

Ben

Ben Cossins

unread,
May 7, 2015, 5:06:18 AM5/7/15
to plumed...@googlegroups.com
Hi,

Maybe it helps if I post the configure call I am using:-

./configure --prefix=/home/model/MD-SOFTWARE/plumed-2.1.2-install CXX=g++ CC=gcc CPPFLAGS="-I/usr/lib64/mpi/gcc/openmpi/include" LDFLAGS="-L/usr/lib64/mpi/gcc/openmpi/lib64 -D__PLUMED_MPI"

Thanks again

ben

Giovanni Bussi

unread,
May 7, 2015, 5:16:33 AM5/7/15
to plumed...@googlegroups.com
I think it should be fine to use a compiler named "g++" plus libraries and correct include path. My suggestion is to make a double check with a short MPI program (I guess you can find an example with google) and understand which flags are missing.

Giovanni

Ben Cossins

unread,
May 7, 2015, 6:21:12 AM5/7/15
to plumed...@googlegroups.com
Hi,

So I needed to give the "-lmpi" flag. I guess maybe this is provided automatically when i have compiled other mpi codes like this which may have confused me.

Thanks for you help

Ben

Ben Cossins

unread,
May 7, 2015, 9:12:29 AM5/7/15
to plumed...@googlegroups.com
Dear all,

Sorry but i have another problem compiling with mpi.

I am now configuring with the following:-

./configure --prefix=/home/model/MD-SOFTWARE/plumed-2.1.2-install CXX=g++ CC=gcc CPPFLAGS="-I/usr/lib64/mpi/gcc/openmpi/include" LDFLAGS="-lmpi_cxx -lmpi -L/usr/lib64/mpi/gcc/openmpi/lib64 -Wl,-rpath,/usr/lib64/mpi/gcc/openmpi/lib64"

When I compile it dies at the following point when starting on plumed-runtime:-

g++  ../main/main.o ../wrapper/Plumed.o -o plumed-runtime -ldl
../main/main.o: In function `main':
main.cpp:(.text+0x43): undefined reference to `MPI_Init'
main.cpp:(.text+0xac): undefined reference to `ompi_mpi_comm_world'
main.cpp:(.text+0xb1): undefined reference to `MPI_Comm_dup'
main.cpp:(.text+0xf3): undefined reference to `MPI_Finalize'
../main/main.o: In function `MPI::Intercomm::Clone() const':
main.cpp:(.text._ZNK3MPI9Intercomm5CloneEv[_ZNK3MPI9Intercomm5CloneEv]+0xe): undefined reference to `MPI_Comm_dup'
../main/main.o: In function `MPI::Win::Set_name(char const*)':
main.cpp:(.text._ZN3MPI3Win8Set_nameEPKc[_ZN3MPI3Win8Set_nameEPKc]+0x9): undefined reference to `MPI_Win_set_name'
../main/main.o: In function `MPI::Win::Set_attr(int, void const*)':
main.cpp:(.text._ZN3MPI3Win8Set_attrEiPKv[_ZN3MPI3Win8Set_attrEiPKv]+0x9): undefined reference to `MPI_Win_set_attr'
../main/main.o: In function `MPI::Win::Get_name(char*, int&) const':
main.cpp:(.text._ZNK3MPI3Win8Get_nameEPcRi[_ZNK3MPI3Win8Get_nameEPcRi]+0x9): undefined reference to `MPI_Win_get_name'
../main/main.o: In function `MPI::Win::Delete_attr(int)':
main.cpp:(.text._ZN3MPI3Win11Delete_attrEi[_ZN3MPI3Win11Delete_attrEi]+0x9): undefined reference to `MPI_Win_delete_attr'
../main/main.o: In function `MPI::Win::Call_errhandler(int) const':
main.cpp:(.text._ZNK3MPI3Win15Call_errhandlerEi[_ZNK3MPI3Win15Call_errhandlerEi]+0x9): undefined reference to `MPI_Win_call_errhandler'

I cannot work out what i need to change.

I do seem to have a functional plumed-patch binary which gives.

Any advise would be gratefully received.

Thanks

Ben

Giovanni Bussi

unread,
May 7, 2015, 9:31:46 AM5/7/15
to plumed...@googlegroups.com
Hi, don't worry everything should work correctly.

We compile three executables:
plumed
plumed-runtime
plumed-shared

plumed is the one that you actually use to do driver, sum_hills, etc.
The other two are basically there to check if an md patched with --runtime or --shared would work correctly. The reason why it complained is that the linker is not using the correct flags.

I think this should be fixed setting
./configure STATIC_LIBS="-L/path/to/mpi/lib -lmpi" etc...

Anyway, it should be harmless.

Giovanni

Ben Cossins

unread,
May 7, 2015, 9:49:31 AM5/7/15
to plumed...@googlegroups.com
Thanks, it is now compiling fine.
Reply all
Reply to author
Forward
0 new messages