PhreeqcUsers Discussion Forum

PHREEQC installation => Installing => Topic started by: hjung on June 05, 2018, 06:57:29 PM

Title: PhreeqcRM MPI compilation
Post by: hjung on June 05, 2018, 06:57:29 PM
Hi all,

I'm trying to use phreeqcrm with a mpi compiler on a cluster with the following conditions but having the problem that is terminated by the error

error: undefined reference to 'PhreeqcRM::PhreeqcRM(int, int, PHRQ_io*)'
collect2: error: ld returned 1 exit status

which is invoked by calling the constructor PhreeqcRM.

Can anyone give me some suggestions to solve this problem?
I posted a similar issue about compiling phreeqcm on a mac (http://phreeqcusers.org/index.php/topic,1011.0.html) and it was solved by installing llvm.

I'm using the following conditions in a cluster.

Description:   CentOS Linux release 7.1.1503 (Core)
OpenMPI/3.0.0-GCC-7.2.0-2.29
LLVM/6.0.0-GCCcore-7.2.0

PhreeqcRM is compiled with the followings.

configure (--prefix=$HOME/local)
*************************************
Summary:
C++ Compiler                 = mpicxx
CPPFLAGS                     =
CXXFLAGS                     = -g -O2
Fortran Compiler             =
Fortran Libs                 =
LDFLAGS                      =
Enable OpenMP                = no
Enable MPI                   = yes
*************************************

make check
PASS: test
============================================================================
Testsuite summary for PhreeqcRM 3.4.0-12927
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

but the problem occurs when the installed library is called from a transport code.

Any help will be greatly appreciated.

Best,
hjung
Title: Re: PhreeqcRM MPI compilation
Post by: dlparkhurst on June 05, 2018, 07:28:59 PM
Looks like you may need to add the library (-l) and the library path (-L) to the Makefile? you are using to compile your transport code. I don't think the library has been found.

The library passed its check of the library compilation.
Title: Re: PhreeqcRM MPI compilation
Post by: hjung on June 05, 2018, 08:22:28 PM
Dear Dr. Parkhurst,

Thanks so much for your help so many times.

I have added the library path but it is still not linking the library for some reason.
The problem in linking also happened on my local machine (mac) but installing llvm somehow solved the issue. But using llvm no longer solve the problem for mpi.

this is the command that is invoking the erro

mpicxx -o biomorph3D biomorph3D.o /home/hj28939/palabos-v2.0r0/lib/libplb_mpi.a -L/home/hj28939/local/lib -lphreeqcrm

I'm attaching the makefile I'm using. I'm trying to couple lattice boltzmann transport code (palabos) to phreeqcrm.

##########################################################################
palabosRoot  = /home/hj28939/palabos-v2.0r0
projectFiles = biomorph3D.cpp

optimize     = true
debug        = false
profile      = false
MPIparallel  = true
SMPparallel  = false
usePOSIX     = true

# Path to external source files
srcPaths =
# Path to external libraries
libraryPaths = /home/hj28939/local/lib/
# Path to inlude directories
includePaths = /home/hj28939/local/include/
# Dynamic and static libraries
libraries    = phreeqcrm

serialCXX    = g++
parallelCXX  = mpicxx
compileFlags = -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations
linkFlags    =
# Compiler flags to use when optimization mode is on
optimFlags   = -O3
# Compiler flags to use when debug mode is on
debugFlags   = -g
# Compiler flags to use when profile mode is on
profileFlags = -pg

##########################################################################

SCons     = $(palabosRoot)/scons/scons.py -j 6 -f $(palabosRoot)/SConstruct

SConsArgs = palabosRoot=$(palabosRoot) \
            projectFiles="$(projectFiles)" \
            optimize=$(optimize) \
            debug=$(debug) \
            profile=$(profile) \
            MPIparallel=$(MPIparallel) \
            SMPparallel=$(SMPparallel) \
            usePOSIX=$(usePOSIX) \
            serialCXX=$(serialCXX) \
            parallelCXX=$(parallelCXX) \
            compileFlags="$(compileFlags)" \
            linkFlags="$(linkFlags)" \
            optimFlags="$(optimFlags)" \
            debugFlags="$(debugFlags)" \
            profileFlags="$(profileFlags)" \
            srcPaths="$(srcPaths)" \
            libraryPaths="$(libraryPaths)" \
            includePaths="$(includePaths)" \
            libraries="$(libraries)"

compile:
   python $(SCons) $(SConsArgs)

clean:
   python $(SCons) -c $(SConsArgs)
   /bin/rm -vf `find $(palabosRoot) -name '*~'`
Title: Re: PhreeqcRM MPI compilation
Post by: dlparkhurst on June 06, 2018, 12:30:57 AM
Have you read the README file distributed with PhreeqcRM? Look at sections D.7 and F.

Perhaps you are missing the include files (-I and -i) in you Makefile.
Title: Re: PhreeqcRM MPI compilation
Post by: dksliusiyan on August 28, 2018, 05:06:27 PM
Hi all,

I'm trying to use phreeqcrm with a mpi compiler on a cluster with the following conditions but having the problem that is terminated by the error

error: undefined reference to 'PhreeqcRM::PhreeqcRM(int, int, PHRQ_io*)'
collect2: error: ld returned 1 exit status

which is invoked by calling the constructor PhreeqcRM.

Can anyone give me some suggestions to solve this problem?
I posted a similar issue about compiling phreeqcm on a mac (http://phreeqcusers.org/index.php/topic,1011.0.html) and it was solved by installing llvm.

I'm using the following conditions in a cluster.

Description:   CentOS Linux release 7.1.1503 (Core)
OpenMPI/3.0.0-GCC-7.2.0-2.29
LLVM/6.0.0-GCCcore-7.2.0

PhreeqcRM is compiled with the followings.

configure (--prefix=$HOME/local)
*************************************
Summary:
C++ Compiler                 = mpicxx
CPPFLAGS                     =
CXXFLAGS                     = -g -O2
Fortran Compiler             =
Fortran Libs                 =
LDFLAGS                      =
Enable OpenMP                = no
Enable MPI                   = yes
*************************************

make check
PASS: test
============================================================================
Testsuite summary for PhreeqcRM 3.4.0-12927
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

but the problem occurs when the installed library is called from a transport code.

Any help will be greatly appreciated.

Best,
hjung

Hi hjung,

Have you solved the compilation issue? I have the issue exact same with you, everything was OK when I compiled them in OpenMP version, but when I switch to MPI, it was not working. Do you or anybody has any ideas about this? Thanks!

Siyan

BTW: I'm using Ubuntu 16.04 LTS with g++/mpic++ 6.4.0
Title: Re: PhreeqcRM MPI compilation
Post by: dlparkhurst on August 28, 2018, 06:22:20 PM
The directions for compiling, installing, and linking the PhreeqcRM library are given in doc/README.TXT of the distribution (attached here for convenience).

Remember you must set an option to test the Fortran interface (although it does not affect the library). If, as Hjung, the tests passed, the the library has been compiled properly. You still may need to install the library in a place of your choosing, which also installs the include files necessary for compiling your transport code.

Finally, you need to follow the directions to compile your transport code and link it to the PhreeqcRM library. Again, directions are in the attached file. If you are getting a message for an undefined reference (that looks like a PhreeqcRM method), then you have not successfully linked the library.