Page 1 of 1

Linking Problem

Posted: Sat Nov 26, 2016 6:17 pm
by bob
Hi all,

I've been trying to compile yambo on a variety of systems and on one I receive errors which I'm not really sure what is going on.

Config.log is attached. Yambo is supposed to link against a system-wide netcdf but later seems to do something with a self-compiled one. And the first error about multiple mains I can't wrap my head around:

Code: Select all

>>>[Linking yambo]<<<
make[1]: Entering directory `/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/driver'
cd /oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/driver; /oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/sbin/moduledep.sh yambo_driver.o  > /oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/driver/make.dep
make[1]: Leaving directory `/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/driver'
make[1]: Entering directory `/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/driver'
yambo_driver.F
driver.o: In function `main':
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/driver/driver.c:104: multiple definition of `main'
/opt/intel/2016.3.210/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin/for_main.o:(.text+0x0): first defined here
/opt/intel/2016.3.210/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin/for_main.o: In function `main':
(.text+0x2a): undefined reference to `MAIN__'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libpol_function.a(X_os.o): In function `x_os_':
X_os.f90:(.text+0x2e1a): undefined reference to `omp_set_lock_'
X_os.f90:(.text+0x3125): undefined reference to `omp_unset_lock_'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libmodules.a(mod_openmp.o): In function `openmp_mp_openmp_set_threads_':
mod_openmp.f90:(.text+0x53): undefined reference to `omp_set_num_threads_'
mod_openmp.f90:(.text+0x8e): undefined reference to `omp_set_num_threads_'
mod_openmp.f90:(.text+0xc1): undefined reference to `omp_set_num_threads_'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libmodules.a(mod_openmp.o): In function `openmp_mp_openmp_update_':
mod_openmp.f90:(.text+0x10c): undefined reference to `omp_get_thread_num_'
mod_openmp.f90:(.text+0x121): undefined reference to `omp_get_num_threads_'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libmodules.a(mod_openmp.o): In function `openmp_mp_openmp_locks_reset_':
mod_openmp.f90:(.text+0x1ca): undefined reference to `omp_destroy_lock_'
mod_openmp.f90:(.text+0x33f): undefined reference to `omp_init_lock_'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libmodules.a(mod_openmp.o): In function `openmp_mp_openmp_initialize_':
mod_openmp.f90:(.text+0x3b2): undefined reference to `omp_get_max_threads_'
mod_openmp.f90:(.text+0x3cd): undefined reference to `omp_get_thread_limit_'
mod_openmp.f90:(.text+0x3fa): undefined reference to `omp_set_dynamic_'
mod_openmp.f90:(.text+0x40c): undefined reference to `omp_set_nested_'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libnetcdf.a(libnetcdf5_la-nc5dispatch.o): In function `NC5_create':
(.text+0x6f): undefined reference to `ncmpi_create'
/oasis/projects/nsf/cob127/sneogi/timsteps/yambo-4.1.1-rev112/lib/libnetcdf.a(libnetcdf5_la-nc5dispatch.o): In function `NC5_open':
(.text+0x134): undefined reference to `ncmpi_open'
Appreciate any further insight into what I'm doing wrong.

Cheers,
Bjoern

Re: Linking Problem

Posted: Sun Nov 27, 2016 7:27 pm
by andrea.ferretti
Dear Bjoern,

according to the error you report (and the config.log), i see two problems, one related to openmp support and one to netcdf.

* openmp: you are adding --enable-open-mp to the configure flags, thereby enabling amp support. Nevertheless, when coming
to the linking stage, openmp libs are not there... this is quite strange. Unless you configured with different options before and then
didn't do a full clean (make clean_all or make distclean), I am wondering whether the problem is related to your mvapich2 installation
(if I recall correctly, omg support needs to be activated)...
A quick and dirty solution to get a working executable is to drop the enable-open-mp, while for a full fledged mpi+omp version of yambo
further investigation is probably needed

* by the end of your error report, netcdf problems are also detected. My suspicion is that you are missing the hdf5 library (configure should
detect this but for some reasons it got tricked here, since your external netcdf library is properly detected)...
Solutions: if you have hdf5 installed, try to add it via configure using --with-hdf5-libs (or related flags), otherwise, if you drop the netcdf line
from configure flags yambo will resort to the internal netcdf lib which does not require hdf5

hope it helps
take care
Andrea

Re: Linking Problem

Posted: Mon Nov 28, 2016 10:30 pm
by bob
It's rather weird. I have tried compiling without MPI - then there is an error that mpi_comm can't be found.

Compiling with MPI only still gives me errors when linking netcdf

Code: Select all

>>>[Linking yambo]<<<
make[1]: Entering directory `/pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/driver'
cd /pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/driver; /pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/sbin/moduledep.sh yambo_driver.o  > /pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/driver/make.dep
make[1]: Leaving directory `/pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/driver'
make[1]: Entering directory `/pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/driver'
yambo_driver.F
/pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/lib/libnetcdff.a(netcdf.o): In function `nf90_inq_libvers':
/pylon1/ct4s8ep/sneogi/timsteps/software/yambo-4.1.1-rev112/lib/netcdf/netcdf-y4.1.3/f90/netcdf_file.f90:12: undefined reference to `nf_inq_libvers_'
This *is* the self-compiled netcdf. This is how I configured it:

Code: Select all

./configure --with-blas-libs="-lmkl_intel_lp64  -lmkl_sequential -lmkl_core" --with-lapack-libs="-lmkl_intel_lp64  -lmkl_sequential -lmkl_core" FC=mpiifort F77=ifort CC=mpiicc MPICC=mpiicc
I'm confused. Is there maybe some detail that isn't passed to the netcdf compilation?

Re: Linking Problem

Posted: Thu Dec 01, 2016 8:39 am
by Davide Sangalli
Dear Bjoern,
for the parallel compilation what if you try setting:

Code: Select all

CC=icc FC=ifort F77=ifort PFC=mpiifort MPICC=mpiicc
(see configure --help)

Code: Select all

  CC          C compiler command
  FC          Fortran compiler command
  F77         Fortran 77 compiler command
  PFC         Parallel Fortran compiler command
  MPICC       Parallel C compiler command
For the serial compilation instead, open the source file src/modules/mod_parallel.F and replace

Code: Select all

   subroutine CREATE_the_COMM(WORLD, COMM, ID )
     integer       :: WORLD,ID,i_err
     type(MPI_comm):: COMM
     call MPI_COMM_SPLIT(WORLD,COMM%my_CHAIN,ID,COMM%COMM,i_err)
     call MPI_COMM_RANK(COMM%COMM,COMM%CPU_id,i_err)
     call MPI_COMM_SIZE(COMM%COMM,COMM%n_CPU ,i_err)
   end subroutine
with

Code: Select all

   subroutine CREATE_the_COMM(WORLD, COMM, ID )
     integer       :: WORLD,ID,i_err
     type(MPI_comm):: COMM
#if defined _MPI
     call MPI_COMM_SPLIT(WORLD,COMM%my_CHAIN,ID,COMM%COMM,i_err)
     call MPI_COMM_RANK(COMM%COMM,COMM%CPU_id,i_err)
     call MPI_COMM_SIZE(COMM%COMM,COMM%n_CPU ,i_err)
#endif
   end subroutine

Re: Linking Problem

Posted: Fri Dec 02, 2016 3:24 pm
by bob
Thanks, that did it now. One system was weirdly configured with different compilers but not all with the compatible MPI libraries. Now it seems to go through.