etmc / tmLQCD

tmLQCD is a freely available software suite providing a set of tools to be used in lattice QCD simulations. This is mainly a HMC implementation (including PHMC and RHMC) for Wilson, Wilson Clover and Wilson twisted mass fermions and inverter for different versions of the Dirac operator. The code is fully parallelised and ships with optimisations for various modern architectures, such as commodity PC clusters and the Blue Gene family.
http://www.itkp.uni-bonn.de/~urbach/software.html
GNU General Public License v3.0
32 stars 47 forks source link

Multiple inclusions of block.h #481

Closed sunpho84 closed 3 years ago

sunpho84 commented 3 years ago

When linking I get the following error


/usr/bin/ld: ./lib/libhmc.a(invert_clover_eo.o):/home/francesco/QCD/SORGENTI/tmLQCD/build_quda/../block.h:106: multiple definition of `blk_gauge_eo'; ./lib/libhmc.a(operator.o):/home/francesco/QCD/SORGENTI/tmLQCD/build_quda/../block.h:106: first defined here

/usr/bin/ld: ./lib/libhmc.a(invert_clover_eo.o):/home/francesco/QCD/SORGENTI/tmLQCD/build_quda/../block.h:105: multiple definition of `nblks_dir'; ./lib/libhmc.a(operator.o):/home/francesco/QCD/SORGENTI/tmLQCD/build_quda/../block.h:105: first defined here

[...]

and so on. It looks like block.h contains a number of global variables, some of them are referred as extern, some not, as it is the case for blk_gauge_eo and the others. The block.h header is included inside clovertm_operators.h, which in turns is included in many place. This gives rise to the clash.

Is this somehow new issue? I am in the quda_work branch, but it looks to me this is generic.

kostrzewa commented 3 years ago

Never had this issue. Are you compiling with your modified build system?

kostrzewa commented 3 years ago

In other words, this compile goes through fine for me:

CC=mpicc CXX=mpicxx F77=f77 \
CFLAGS="-mtune=znver2 -march=znver2 -O3 -mavx2 -mfma -fopenmp" \
LDFLAGS="-fopenmp" \
~/code/tmLQCD.quda_work/configure \
  --enable-mpi \
  --with-mpidimension=4 \
  --enable-sse2 --enable-sse3 \
  --with-cudadir=/usr/local/cuda/lib64 \
  --with-qudadir=$(pwd)/../quda_develop/install_dir \
  --with-limedir=$(pwd)/../lime/install_dir \
  --with-lapack="-lblas -llapack"

using gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, cuda_11.0_bu.TC445_37.28540450_0 and OpenMPI 4.0.3

sunpho84 commented 3 years ago

No, I'm not using a modified build system, but I use gcc-10

$ gcc --version
gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0

I've checked that indeed, the error does not emerge using gcc-9. I don't know why gcc-9 is ignoring it and gcc-10 signals it

kostrzewa commented 3 years ago

I'm guessing the compile and include orders differ slightly. This is clearly a bug which simply hasn't manifested.