problems to compile and run the parallel version of cp2k with g95 compiler and mpich

Axel akoh... at gmail.com
Thu Jul 17 19:04:24 UTC 2008



On Jul 16, 9:43 pm, hawk2012 <hawk2... at gmail.com> wrote:
> Dear All:
>
> I just successfully compiled and tested the serial version of cp2k
> using the recommended compiler g95. Now, I am moving on to the next
> step to compile the parallel version of cp2k with g95 and mpich.
> Following the INSTALL instructutions, I dowloaded mpich-1.2.6.tar.gz
> and compiled it by setting FC=g95 and F90=g95 to generate the g95
> version of mpich under /home/mpich.g95. Then I downloaded
> scalapack-1.8.0.tgz. Its README file says  the BLAS, BLACS and LAPACK
> libraries should be available before compiling scalapack. Since BLAS
> and LAPACK have been installed during installation of serial version
> of cp2k, only BLACS needs to be installed. So, I downloaded
> mpiblacs.tgz and mpiblacs-patch03.tgz and successfully compiled
> blacsCinit_MPI-LINUX-0.a, blacs_MPI-LINUX-0.a,
> blacsF77init_MPI-LINUX-0.a by setting F77=g95 in file Bmake.inc.
> However, I noticed that file
> SLmake.inc.example used to compile scalapack also specified
> libatlas.a. I guess ATLAS library should also be installed before
> installing scalapack. Therefore, I downloaded atlas3.6.0.tgz and
> compiled library libatlas.a. After specifying the locations of all
> necessary libraries and mpi compilers I successfully compiled the
> library libscalapack.a.
> Finally I modified the Linux-x86-64-g95.popt as below:
> CC       = cc
> CPP      =
> FC       = /home/mpich.g95/bin/mpif90
> LD       = /home/mpich.g95/bin/mpif90
> AR       = ar -r
> DFLAGS   = -D__G95 -D__FFTSG -D__parallel -D__BLACS -D__SCALAPACK -
> D__FFTW3 -D__LIBINT
> CPPFLAGS =
> FCFLAGS  = $(DFLAGS) -ffree-form -O2 -ffast-math -march=opteron -cpp -
> g
> LDFLAGS  = $(FCFLAGS)
> LIBS     = /home/scalapack/scalapack-1.8.0/libscalapack.a \
>            /home/BLACS/LIB/blacsF77init_MPI-LINUX-0.a \
>            /home/BLACS/LIB/blacs_MPI-LINUX-0.a \
>            /home/BLACS/LIB/blacsCinit_MPI-LINUX-0.a \
>            /home/lapack-3.1.1/lapack_LINUX.a \
>            /home/GotoBLAS/libgoto.a \
>            /home/fftw/lib/libfftw3.a \
>            /home/libint/lib/libderiv.a \
>            /home/libint/lib/libint.a \
>            /usr/lib64/libstdc++.so.6
>
> OBJECTS_ARCHITECTURE = machine_g95.o
> After entering cp2k/makefiles directory I typed 'make ARCH=Linux-
> x86-64-g95 VERSION=popt' to compile the parallel version of cp2k. The
> compiling process went well except a few warnings. However an error
> was reported during the final linking stage:
> ar: creating /home/cp2k2.0/cp2k/makefiles/../lib/Linux-x86-64-g95/popt/
> libcp2k_lib.a
> /home/mpich.g95/bin/mpif90 -D__G95 -D__FFTSG -D__parallel -D__BLACS -
> D__SCALAPACK -D__FFTW3 -D__LIBINT -ffree-form -O2 -ffast-math -
> march=opteron -cpp -g -D__COMPILE_ARCH="\"Linux-x86-64-g95\"" -
> D__COMPILE_DATE="\"Wed Jul 16 16:48:23 CDT 2008\"" -
> D__COMPILE_HOST="\"dmol8\"" -D__COMPILE_LASTCVS="\"/qs_scf_types.F/
> 1.32/Mon Jul  7 22:07:02 2008//\"" -o /home/cp2k2.0/cp2k/makefiles/../
> exe/Linux-x86-64-g95/cp2k.popt cp2k.o /home/cp2k2.0/cp2k/makefiles/../
> lib/Linux-x86-64-g95/popt/libcp2k_lib.a /home/cp2k2.0/cp2k/
> makefiles/../lib/Linux-x86-64-g95/popt/libcp2k_fft_lib.a /home/cp2k2.0/
> cp2k/makefiles/../lib/Linux-x86-64-g95/popt/libcp2k_base_lib.a  /home/
> scalapack/scalapack-1.8.0/libscalapack.a /home/BLACS/LIB/
> blacsF77init_MPI-LINUX-0.a /home/BLACS/LIB/blacs_MPI-LINUX-0.a /home/
> lapack-3.1.1/lapack_LINUX.a /home/GotoBLAS/libgoto.a /home/fftw/lib/
> libfftw3.a /home/libint/lib/libderiv.a /home/libint/lib/libint.a /usr/
> lib64/libstdc++.so.6
> /home/GotoBLAS/libgoto.a(blas_server.o)(.text+0x5b5): In function
> `blas_thread_init':
> : undefined reference to `pthread_create'
> /home/GotoBLAS/libgoto.a(blas_server.o)(.text+0xa7d): In function
> `blas_thread_shutdown_':
> : undefined reference to `pthread_join'
> make[1]: *** [/home/cp2k2.0/cp2k/makefiles/../exe/Linux-x86-64-g95/
> cp2k.popt] Error 1
> make[1]: Leaving directory `/home/cp2k2.0/cp2k/obj/Linux-x86-64-g95/
> popt'
> make: *** [build] Error 2
>
> It seemed that libgoto.a has some problem this time although I used it
> to compile cp2k.sopt successfully this morning. Then I replaced the

no. the problem is not GOTO, but (again) PEBCAC.
compare with your serial arch file and read the GOTO docs.
from the missing functions it is obvious that you need to
add -lpthread to your linker command.


> libgoto.a library with the standard BLAS library /home/BLAS/
> blas_LINUX.a obtained by compiling the package blas.tgz. After this

_bad_ idea. standard blas incurs a large performance hit on most
current machines compared to tuned versions like GOTO or ATLAS
or vendor libs like MKL, ACML, ESSL and so on.

> change the linking process succeeded and the executable cp2k.popt was
> generated. However, problem appeared when I tried to test cp2k.popt
> with the same input file H2O.inp I used to test cp2k.sopt. After
> typing 'home/mpich.g95/bin/mpirun -np 2 ./cp2k.popt ./H2O.inp > log &'
> I got the following error message in the log file:
>  CP2K: An error occurred opening the file </home/cp2k2.0/cp2k/tests/
> MD> with the unit number      1 (IOSTAT =     21)
> However, the test case can be run normally if I issued the command './
> cp2k.popt ./H2O.inp > log &'. It seemed that cp2k.popt is still an
> serial version of cp2k although I compiled it with parallel settings.

i cannot comment on your mpich setup. and i wouldn't touch
mpich with a ten foot pole unless i get forced to do so.

those kind of errors are usually related to the specific
installation and without access to the individual machine
and a detailed description of what you did, there is little
that one can do from far away besides "you must have made
something wrong".

> Any idea?

many mpi libraries (e.g. OpenMPI) allow to run parallel executables
without mpirun and that would be equivalent to 'mpirun -np 1'.
whether you have compiled a parallel executable can be deduced from
running the 'nm' tool on the compiled cp2k objects and look for
undefined references to mpi library calls.

cheers,
   axel.



More information about the CP2K-user mailing list