I successfully compile and run the development branch of CP2K in hybrid
MPI+OpenMP with gfortran (4.5.[02]) and MPICH2 (1.3.1). About 100 of
the regtests give varying results and most of these seem to be within
numerical noise.
I use the following defines and compiler options
DFLAGS = -D__GFORTRAN -D__FFTSG -D__parallel -D__SCALAPACK -D__BLACS -D__USE_CP2K_TRACE -D__HAS_smm_dnn -D__HAS_NO_OMP_3 -D__LIBINT
FCFLAGS = -g -fopenmp -O3 -ffast-math -funroll-loops -ftree-vectorize -march=native -ffree-form -fcray-pointer $(DFLAGS) -I$(GFORTRAN_INC)
Also, avoid some threaded libraries such as GotoBLAS.
Cheers,
Urban
> --
> You received this message because you are subscribed to the Google
> Groups "cp2k" group.
> To post to this group, send email to cp...@googlegroups.com.
> To unsubscribe from this group, send email to cp2k
> +unsub...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cp2k?hl=en.
On Mon, 2011-05-09 at 09:34 -0700, Axel wrote:
> [...]
> hmmm... interesting.
> was this the very latest cvs code?
Yes, this was today's CVS.
> it almost looked to me as if there were some
> mpi calls within a multi-threaded region that
> were messing things up...
I believe we don't (or shouldn't) use such calls. Also, you can
explicitly make CP2K call mpi_init_thread() instead of mpi_init()
(change .TRUE. to .FALSE. on line 479 of src/message_passing.F)--the
current default is a workaround for de facto MPI threading behavior but
is technically wrong. Also, I just committed a patch to declare the use
of MPI funneled mode instead of general mode.
> also, can you comment on what these two defines are for?
> -D__USE_CP2K_TRACE -D__HAS_smm_dnn
__USE_CP2K_TRACE uses CP2K's stack trace infrastructure on failed
assertions in the DBCSR sparse matrix (sub)library. To use it you must
also add the timings_mp.o module to the LIBS variable (used to get
around this and some other circular dependencies). While using it or
not should not affect behavior, there are OpenMP statements in stack
tracing and timing.
__HAS_smm_dnn is for using the Small Matrix Multiply library (see
tools/build_libsmm). It is not threaded so skipping it should have no
effect on the program's behavior.
> this one is a bit of a surprise, since already gfortran 4.3.x claims
> to be OpenMP 3 compliant.
> -D__HAS_NO_OMP_3
I used gfortran 4.3 until recently (where psmp also worked last time I
checked) and didn't update the defines...
> as far as threaded libraries go. what about MKL?
> last thing a remember is that it would not go multi-threaded
> if it is called from within an OpenMP multi-threaded region,
> but that may be wishful thinking...
I haven't tried MKL recently so I can't say. However, to rule out any
library issues, I would try standard netlib BLAS and Lapack...
Cheers,
Urban.
>
> in any case, i'll give it a try.
>
>
> thanks,
> axel.
>
Hi Axel,On Mon, 2011-05-09 at 09:34 -0700, Axel wrote:
> [...]
> hmmm... interesting.
> was this the very latest cvs code?Yes, this was today's CVS.
> it almost looked to me as if there were some
> mpi calls within a multi-threaded region that
> were messing things up...I believe we don't (or shouldn't) use such calls. Also, you can
explicitly make CP2K call mpi_init_thread() instead of mpi_init()
(change .TRUE. to .FALSE. on line 479 of src/message_passing.F)--the
current default is a workaround for de facto MPI threading behavior but
is technically wrong. Also, I just committed a patch to declare the use
of MPI funneled mode instead of general mode.
> also, can you comment on what these two defines are for?
> -D__USE_CP2K_TRACE -D__HAS_smm_dnn__USE_CP2K_TRACE uses CP2K's stack trace infrastructure on failed
assertions in the DBCSR sparse matrix (sub)library. To use it you must
also add the timings_mp.o module to the LIBS variable (used to get
around this and some other circular dependencies). While using it or
not should not affect behavior, there are OpenMP statements in stack
tracing and timing.
__HAS_smm_dnn is for using the Small Matrix Multiply library (see
tools/build_libsmm). It is not threaded so skipping it should have no
effect on the program's behavior.
> this one is a bit of a surprise, since already gfortran 4.3.x claims
> to be OpenMP 3 compliant.
> -D__HAS_NO_OMP_3I used gfortran 4.3 until recently (where psmp also worked last time I
checked) and didn't update the defines...> as far as threaded libraries go. what about MKL?
> last thing a remember is that it would not go multi-threaded
> if it is called from within an OpenMP multi-threaded region,
> but that may be wishful thinking...I haven't tried MKL recently so I can't say. However, to rule out any
library issues, I would try standard netlib BLAS and Lapack...
I believe we don't (or shouldn't) use such calls. Also, you can
explicitly make CP2K call mpi_init_thread() instead of mpi_init()
(change .TRUE. to .FALSE. on line 479 of src/message_passing.F)--the
current default is a workaround for de facto MPI threading behavior but
is technically wrong. Also, I just committed a patch to declare the use
of MPI funneled mode instead of general mode.i tried that, but now cp2k quits right away with a confusing error:CP2K| MPI error 0 in Inadequate level of thread support is provided. : MPI_SUCCESS: no errorsCP2K| Abnormal program termination, stopped by process number 0
> also, can you comment on what these two defines are for?
> -D__USE_CP2K_TRACE -D__HAS_smm_dnn__USE_CP2K_TRACE uses CP2K's stack trace infrastructure on failed
assertions in the DBCSR sparse matrix (sub)library. To use it you must
also add the timings_mp.o module to the LIBS variable (used to get
around this and some other circular dependencies). While using it or
not should not affect behavior, there are OpenMP statements in stack
tracing and timing.i have so far tried without.
> this one is a bit of a surprise, since already gfortran 4.3.x claims
> to be OpenMP 3 compliant.
> -D__HAS_NO_OMP_3I used gfortran 4.3 until recently (where psmp also worked last time I
checked) and didn't update the defines...
for good measure, i am linking with the serial versionnow, but that didn't change the behavior.
just make sure we're on the same page. the input(s) thatare giving me the problems are the water benchmark inputs.in tests/QS/benchmark/the cp2k.?smp binaries work fine for OMP_NUM_THREADS=1,but as soon as i enable more than one thread with cp2k.psmpand multiple MPI tasks, i get NaNs or random energies.cp2k.ssmp appears to be working for both intel 11.1 and gfortran 4.4.4thanks,axel.
Cheers,
Urban.
>
> in any case, i'll give it a try.
>
>
> thanks,
> axel.
>
> --
> You received this message because you are subscribed to the Google
> Groups "cp2k" group.
> To post to this group, send email to cp...@googlegroups.com.
> To unsubscribe from this group, send email to cp2k
> [...]
> the only other significant difference that i see to your setup
> is that you are using MPICH2 and i use OpenMPI (1.4.3), but
> if that would make a difference, google will probably request
> that this group will become adult only after my next post.
Actually, I also get crashes with OpenMPI--but not with MPICH2. I
recompiled OpenMPI 1.4.3 with MPI user thread support, and I recompiled
BLACS and ScaLAPACK with it. As soon as I use more than 1 thread (only
tried popt) it crashes in a BLACS call.
I'll also give the OpenMPI 1.5 development branch a try.
Regards,
Urban
Actually, I also get crashes with OpenMPI--but not with MPICH2. I
recompiled OpenMPI 1.4.3 with MPI user thread support, and I recompiled
BLACS and ScaLAPACK with it. As soon as I use more than 1 thread (only
tried popt) it crashes in a BLACS call.
I'll also give the OpenMPI 1.5 development branch a try.
Regards,
Urban
> > +uns...@googlegroups.com.
Hi,
1. For openmp (1.4.2):
./configure --prefix=.../openmpi142 --enable-mpi-threads --enable-shared --with-threads=posix --enable-mpi-f90 CC=cc cpp=cpp CXX=c++ FC=ifort
2. for cp2k.popt:
INTEL_INC=/opt/intel/Compiler/11.1/072/mkl/include
FFTW3_INC=.../fftw322/include
CC = cc
CPP =
FC = mpif90 -FR
#FC = mpif90
LD = mpif90 -i_dynamic -openmp
AR = ar -r
#DFLAGS = -D__INTEL -D__FFTSG -D__parallel -D__BLACS -D__SCALAPACK -D__FFTW3
DFLAGS = -D__INTEL -D__FFTSG -D__parallel -D__BLACS -D__SCALAPACK -D__FFTW3 -D__LIBINT
CPPFLAGS = -C -traditional $(DFLAGS) -I$(INTEL_INC)
FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -I$(FFTW3_INC) -O2 -xW -heap-arrays 64 -funroll-loops -fpp -free
FCFLAGS2 = $(DFLAGS) -I$(INTEL_INC) -I$(FFTW3_INC) -O1 -xW -heap-arrays 64 -funroll-loops -fpp -free
LDFLAGS = $(FCFLAGS) -I$(INTEL_INC) -L/opt/intel/mkl/10.1.0.015/lib/em64t
#
LIBS = -L/opt/intel/mkl/10.1.0.015/lib/em64t -lmkl_scalapack -lmkl_em64t -lmkl_blacs_openmpi_lp64 -lguide -lpthread -lstdc++\
There is another way of doing it as well:
I have added these lines here:
compiler_args=-intel
project=Open MPI
project_short=OMPI
version=1.4.3
language=Fortran 77
compiler_env=F77
compiler_flags_env=FFLAGS
compiler=ifort
extra_includes=
preprocessor_flags=
compiler_flags=-pthread
linker_flags=
libs=-lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl
-lutil -lm -ldl -lgfortran
required_file=
includedir=${includedir}
libdir=${libdir}
to
$OMPI_HOME/share/openmpi/mpif77-wrapper-data.txt
(and similar for mpif90-wrapper-data.txt). All I need to do now is:
mpif77 -intel
and it calles the ifort compiler in my PATH and also links against the
libgfortran (which is handy if you are using libraries build with gfortran
instead of ifort). It is probably similar to what Alex suggested.
You get some warning but it is working (at least for me).
My two pennies from a sunny London
Jörg
--
*************************************************************
Jörg Saßmannshausen
University College London
Department of Chemistry
Gordon Street
London
WC1H 0AJ
email: j.sassma...@ucl.ac.uk
web: http://sassy.formativ.net
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
instead of ifort). It is probably similar to what Alex suggested.
You get some warning but it is working (at least for me).