[CP2K:9266] Unddefined reference when compiling cp2k 4.1 withCUDA 8.0

Tiziano Müller tiziano... at chem.uzh.ch
Fri Jul 28 08:16:48 UTC 2017


Hi Huiqun

It seems you forgot to set NVFLAGS in your arch file which is why 
pw_cuda_z.o in libcp2kpwcuda.a is basically empty (specifically: 
__PW_CUDA is defined for gfortran, but undefined for nvcc).

Usually you want to pass along all the preprocessor flags to nvcc plus 
optimization and the -arch flag.
Take a look at the CRAY-XC30-gfortran-cuda.psmp for an example .

Since you are using CUDA 8 you may also have to apply

https://github.com/cp2k/cp2k/commit/e5a324e424bd79e0b2f6b87a00adf3d68eeba746

since that was fixed after the 4.1 release.

Best regards,
Tiziano

On 27.07.2017 17:06, hqzhou wrote:
> Hi, Tiziano
> 
>   Thank you for your quick response! Here are attached the compile log 
> and output of
> nm libcp2kpwcuda.a. It seems that no such references exist in 
> libcp2kpwcuda.a.
> 
> Thanks for resolving the problem!
> 
> Huiqun
> ------------------ Original ------------------
> *From: * "Tiziano Müller"<tiziano... at cThankhem.uzh.ch>;
> *Date: * Thu, Jul 27, 2017 05:10 PM
> *To: * "hqzhou"<hqz... at nju.edu.cn>;
> *Cc: * "cp2k"<cp... at googlegroups.com>;
> *Subject: * Re: [CP2K:9263] Unddefined reference when compiling cp2k 4.1 
> withCUDA 8.0
> Hi Huiqun
> 
> Can you please attach the complete build log?
> It might also be a good idea to do a `make distclean` and rebuild
> everything from scratch for that.
> 
> The mentioned symbols should be defined in
> 
>     lib/unclecuda-gnu/ssmp/libcp2kpwcuda.a
> 
> You can check for their presence using
>     `nm lib/unclecuda-gnu/ssmp/libcp2kpwcuda.a`
> 
> which should give something like this:
> 
>     [...]
>     pw_cuda_z.o:
>     [...]
>     00000000000003a0 T pw_cuda_cfffg_z_
>     0000000000000f60 T pw_cuda_cff_z_
>     0000000000001680 T pw_cuda_cf_z_
>     00000000000019e0 T pw_cuda_fc_z_
>     00000000000012f0 T pw_cuda_ffc_z_
>     0000000000001f00 T pw_cuda_fg_z_
>     0000000000001d40 T pw_cuda_f_z_
>     0000000000000960 T pw_cuda_sfffc_z_
>     0000000000002310 T pw_cuda_sf_z_
>     [...]
> 
> If they are not there (after the rebuild), please also attach the
> complete output of this command.
> 
> Best regards,
> Tiziano
> 
> On 27.07.2017 08:22, hqzhou wrote:
>  > Hi,
>  >
>  > I'm compiling cp2k 4.1 with CUDA 8.0 using gnu compiler gfortran 4.8.5
>  > on a CentOS 7.3 machine.
>  > For the compilation going on smoothly, I have made some modifications to
>  > the relevant source
>  > code:
>  > 1. change syncthreads() to __syncthreads()
>  > 2. added condition to support native atomicAdd() in CUDA 8.0
>  > 3. change FFT_ALIGNMENT to CUFFT_COMPATIBILITY_FFTW_PADDING
>  >
>  > The compilation went almost OK, except the last step of creating
>  > cp2k.ssmp. I got following error.
>  > Actually, all undefined references are defined in pw/pw_cuda.F, am I
>  > wrong somewhere in my
>  > configuration (refer to the attached)?
>  >
>  > Thanks in advance!
>  >
>  > PS: I can run dbcsr_unittest.ssmp, libcusmm_unittest.ssmp without any
>  > problem.
>  >
>  > Huiqun Zhou
>  > @Earth Sciences, Nanjing University, China
>  >
>  > ======================= snippet of screen output
>  > ==========================================
>  > gfortran -I/usr/local/include -I/usr/local/cuda/include
>  > -I/usr/local/libint/include -I/usr/local/libxc/include -D__GRID_CORE=2
>  > -D__PILAENV_BLOCKSIZE=1024 -D__ACC -D__DBCSR_ACC -D__PW_CUDA -D__LIBXC2
>  > -D__LIBINT -D__LIBINT_MAX_AM=6 -D__LIBDERIV_MAX_AM1=5 -D__MAX_CONTR=4
>  > -O2 -ffast-math -ffree-form -ffree-line-length-none -fopenmp
>  > -ftree-vectorize -funroll-loops -mtune=native -I/usr/local/include
>  > -I/usr/local/cuda/include -I/usr/local/libint/include
>  > -I/usr/local/libxc/include -D__COMPILE_ARCH="\"unclecuda-gnu\""
>  > -D__COMPILE_DATE="\"Thu Jul 27 14:08:24 CST 2017\""
>  > -D__COMPILE_HOST="\"unclecuda\"" -D__COMPILE_REVISION="\"svn:17462\""
>  > -D__DATA_DIR="\"/home/zhou_huiqun/Cookplate/cp2k-4.1/data\""
>  > -L/home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp -o
>  > /home/zhou_huiqun/Cookplate/cp2k-4.1/exe/unclecuda-gnu/cp2k.ssmp cp2k.o
>  > -lcp2kstart -lcp2kmc -lcp2kswarm -lcp2kmotion -lcp2kthermostat -lcp2kemd
>  > -lcp2ktmc -lcp2kmain -lcp2keri_mme -lcp2kminimax -lcp2khfxbase
>  > -lcp2ksubsys -lcp2kxc -lcp2kao -lcp2kinput -lcp2kpw -lcp2kpwcuda
>  > -lcp2kfft -lcp2kdbcsrwrap -ldbcsr -ldbcsrarnoldi -ldbcsrvec -ldbcsrmm
>  > -ldbcsrops -ldbcsrbblock -ldbcsrbdist -ldbcsrbase -ldbcsrdata -ldbcsrerr
>  > -lmicsmm -lclsmm -lcusmm -lcp2kacc -lcp2kaccmic -lcp2kaccopencl
>  > -lcp2kacccuda -lcp2kfm -lcp2kcommon -lcp2kmpiwrap -lcp2kgrid -lcp2kbase
>  > -L/usr/local/cuda/lib64 -lcudart -lcublas -lcufft -lrt
>  > /usr/lib64/libopenblas.a /usr/local/libxc/lib/libxcf90.a
>  > /usr/local/libxc/lib/libxc.a /usr/local/libint/lib/libderiv.a
>  > /usr/local/libint/lib/libint.a
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_f':
>  > pw_cuda.F:(.text+0x6c): undefined reference to `pw_cuda_f_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_sf':
>  > pw_cuda.F:(.text+0x1ef): undefined reference to `pw_cuda_sf_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_fg':
>  > pw_cuda.F:(.text+0x36e): undefined reference to `pw_cuda_fg_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_c1dr3d_3d_ps':
>  > pw_cuda.F:(.text+0x3673): undefined reference to `pw_cuda_fc_z_'
>  > pw_cuda.F:(.text+0x3b6e): undefined reference to `pw_cuda_ffc_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_r3dc1d_3d_ps':
>  > pw_cuda.F:(.text+0x6ca5): undefined reference to `pw_cuda_cf_z_'
>  > pw_cuda.F:(.text+0x7336): undefined reference to `pw_cuda_cff_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_c1dr3d_3d':
>  > pw_cuda.F:(.text+0x779c): undefined reference to `pw_cuda_sfffc_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_r3dc1d_3d':
>  > pw_cuda.F:(.text+0x79d0): undefined reference to `pw_cuda_cfffg_z_'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_init':
>  > pw_cuda.F:(.text+0x7a55): undefined reference to `pw_cuda_init'
>  > 
> /home/zhou_huiqun/Cookplate/cp2k-4.1/lib/unclecuda-gnu/ssmp/libcp2kpw.a(pw_cuda.o): 
> 
>  > In function `__pw_cuda_MOD_pw_cuda_finalize':
>  > pw_cuda.F:(.text+0x7a41): undefined reference to `pw_cuda_finalize'
>  > collect2: error: ld returned 1 exit status
>  >
>  > --
>  > You received this message because you are subscribed to the Google
>  > Groups "cp2k" group.
>  > To unsubscribe from this group and stop receiving emails from it, send
>  > an email to cp2k+uns... at googlegroups.com
>  > <mailto:cp2k+uns... at googlegroups.com>.
>  > To post to this group, send email to cp... at googlegroups.com
>  > <mailto:cp... at googlegroups.com>.
>  > Visit this group at https://groups.google.com/group/cp2k.
>  > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> Tiziano Müller
> University of Zurich
> Department of Chemistry
> Winterthurerstrasse 190
> CH-8057 Zürich
> 
> Tel: +41 44 63 54234
> www.chem.uzh.ch
> tiziano... at chem.uzh.ch
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to cp2k+uns... at googlegroups.com.
> To post to this group, send email to cp... at googlegroups.com.
> Visit this group at https://groups.google.com/group/cp2k.
> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to cp2k+uns... at googlegroups.com 
> <mailto:cp2k+uns... at googlegroups.com>.
> To post to this group, send email to cp... at googlegroups.com 
> <mailto:cp... at googlegroups.com>.
> Visit this group at https://groups.google.com/group/cp2k.
> For more options, visit https://groups.google.com/d/optout.

-- 
Tiziano Müller
University of Zurich
Department of Chemistry
Winterthurerstrasse 190
CH-8057 Zürich

Tel: +41 44 63 54234
www.chem.uzh.ch
tiziano... at chem.uzh.ch



More information about the CP2K-user mailing list