Closed LiamBindle closed 6 years ago
I believe that I figured it out.
The file <GCHP>/ESMF/build_config/*.*.default/build_rules.mk
adds the -lmpi_cxx
flag to both $ESMF_F90LINKLIBS
and $ESMF_CXXLINKLIBS
. The documentation (source: Building and Installing ESMF) for $ESMF_F90LINKLIBS
and $ESMF_CXXLINKLIBS
says
ESMF_F90LINKLIBS Possible value: list of libraries, each prepended with -l Prepend libraries to the list of libraries the ESMF build system determines.
To my eyes, it appears that <GCHP>/ESMF/build_config/<platform>.<compiler>.default/build_rules.mk
is trying to define the MPI runtime as libmpi_cxx.so
.
If I understand correctly, my MPI runtime library is libmpi.so
as I got with the following:
$ mpif90 --showme:libs
mpi
This also makes sense since libmpi.so
was lised in my /usr/local/lib
directory (see my opening comment).
For my system the ESMF build_rules.mk file was <GCHP>/ESMF/build_config/Linux.gfortran.default/build_rules.mk
. In this file, I simply changed -lmpi_cxx
to -lmpi
. After doing this GCHP compiled successfully.
Below is a diff of this file
@@ -68,12 +68,12 @@ ifeq ($(ESMF_COMM),openmpi)
# OpenMPI --------------------------------------------------
ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2
ESMF_F90DEFAULT = mpif90
-ESMF_F90LINKLIBS += -lmpi_cxx
+ESMF_F90LINKLIBS += -lmpi
ESMF_CXXDEFAULT = mpicxx
# Need to change -lmpi_f77 to -lmpi_cxx to get ESMF to compile w/ OpenMPI
# (ewl, 6/18/2018)
#ESMF_CXXLINKLIBS += -lmpi_f77
-ESMF_CXXLINKLIBS += -lmpi_cxx
+ESMF_CXXLINKLIBS += -lmpi
ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS)
ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS)
else
Thanks for reporting and glad that you have figured out the issue!
A side point: from your Singularity file, looks like your are installing gfortran 4.x. I found that old versions of gfortran cause run time errors (related to string processing in MAPL). gfortran 7.x works fine.
Looks like -lmpi_cxx
is already removed in a recent commit (fdd8afe59c9c37dff70351887da87be8ad8ad629) by @lizziel
You are using an update-to-date version of GCHP code?
Thanks for the tip! I did have a runtime error from MAPL when I launched GCHP (I don't remember what it said), but I left debugging that for tomorrow—I'll start with trying version 7.x!
Regarding my GCHP version, I am using the most up-to-date commit (205f019). It appears that fdd8afe updated $ESMF_CXXLINKLIBS
and $ESMF_F90LINKLIBS
for Linux.intel.default/build_rules.mk
, but Linux.gfortran.default/build_rules.mk
is the file that is used for my container.
Lines 71 and 76 were the ones that I changed to just -lmpi
. I have only tried to compile GCHP with Open MPI 2.1.2, however, so I can't speak to the consistency of the library name (libmpi.so
) across different OMPI versions and other MPI implementations.
Cheers,
Liam
Hi Liam, Unfortunately those build_rules.mk files have a lot of hard-coded flags that may or may not work on different systems. Playing around with these may be necessary for different versions of OS, compiler, and MPI. I commit what is necessary to get things working for our testing but unfortunately there is no one-size-fits-all solution.
Hi Lizzie,
Okay I see, that makes sense. I have got GCHP compiling now so I will close this issue.
Thanks,
Liam
Hit the same issue when trying gcc 7.3.0 + openmpi 3.1.3.
To be consistent with fdd8afe, I suggest removing -lmpi_cxx
in ESMF/build_config/Linux.gfortran.default/build_rules.mk
Hi,
I'm trying to compile GCHP in a singularity container that I made (similar to @JiaweiZhuang's singularity container but with Open MPI 2.1.2 instead of MPICH) and I am running into trouble during my
"make compile_clean"
. Specifically, during compilation in<GEOS-Chem source code>/GCHP/ESMF/src/apps/ESMF_Info
, I receive the following error:My Open MPI install
I have installed Open MPI 2.1.2 to
/usr/local
(which is my$MPI_ROOT
) and my/usr/local/lib
has the following libraries:My Question
Do you know what
libmpi_cxx.so
is or where I should be able to find it? Is it simply an MPI runtime library that I could create a symlink to?The reason I am posting this question to GCHP, rather than Open MPI, is because I noticed that changing
$ESMF_COMM
to the generic"mpi"
changes the library in question to "libmpic++.so". This makes me think that there is some difference between what GCHP's Makefile is expecting, and what my system actually looks like.I have attached my Singularity file for reference.
Thanks in advance,
Liam