[lammps-users] Met a problem when compiling lammps with atc

Dear all:
I met a problem when I tried to compile the latest version with package atc, here is the last part of make message:
o pppm_tip4p.o prd.o random_mars.o random_park.o read_data.o read_restart.o region_block.o region_cone.o region.o region_cylinder.o region_intersect.o region_plane.o region_prism.o region_sphere.o region_union.o remap.o remap_wrap.o replicate.o respa.o run.o set.o shell.o special.o temper.o thermo.o timer.o universe.o update.o variable.o velocity.o verlet.o write_restart.o xdr_compat.o -latc -lreax -lmeam -lfftw -lgfortran -lgfortran -o …/lmp_g++
…/…/lib/atc//libatc.a(Matrix.o): In function MultAB(Matrix<double> const&, Matrix<double> const&, DenseMatrix<double>&, bool, bool, double, double)': /home/myname/lammps/lib/atc/Matrix.cpp:31: undefined reference to dgemm_’
…/…/lib/atc//libatc.a(Matrix.o): In function inv(Matrix<double> const&)': /home/myname/lammps/lib/atc/Matrix.cpp:53: undefined reference to dgetrf_’
/home/myname/lammps/lib/atc/Matrix.cpp:61: undefined reference to dlange_' /home/myname/lammps/lib/atc/Matrix.cpp:64: undefined reference to dgecon_’
/home/myname/lammps/lib/atc/Matrix.cpp:70: undefined reference to dgetri_' /home/myname/lammps/lib/atc/Matrix.cpp:79: undefined reference to dgetri_’
…/…/lib/atc//libatc.a(Matrix.o): In function det(Matrix<double> const&)': /home/myname/lammps/lib/atc/Matrix.cpp:111: undefined reference to dgetrf_’
collect2: ld returned 1 exit status
mpic++: No such file or directory
make[1]: *** […/lmp_g++] Error 1
make[1]: Leaving directory `/home/myname/lammps/src/Obj_g++’
make: *** [g++] Error 2

and here is my makefile (modified from Makefile.g++)

g++ = RedHat Linux box, g++, MPICH2, FFTW

2
3 SHELL = /bin/sh
4
5 # ---------------------------------------------------------------------
6 # compiler/linker settings
7 # specify flags and libraries needed for your compiler
8
9 CC = mpic++
10 CCFLAGS = -g -O -I/home/myname/bin/fftw/include/ -I…/…/lib/atc/ -I…/…/lib/meam/ -I…/…/lib/reax/ -I/home/myname/blas/ -I/home/myname/lapack/
11 DEPFLAGS = -M
12 LINK = mpic++
13 LINKFLAGS = -g -O -L/home/myname/bin/fftw/lib/ -L…/…/lib/atc/ -L…/…/lib/meam/ -L…/…/lib/reax/ -L/home/myname/blas/ -L/home/myname/lapack/
14 LIB =
15 ARCHIVE = ar
16 ARFLAGS = -rc
17 SIZE = size
18
19 # ---------------------------------------------------------------------
20 # LAMMPS-specific settings
21 # specify settings for LAMMPS features you will use
22
23 # LAMMPS ifdef options, see doc/Section_start.html
24
25 LMP_INC = -DLAMMPS_GZIP
26
27 # MPI library, can be src/STUBS dummy lib
28 # INC = path for mpi.h, MPI compiler settings
29 # PATH = path for MPI library
30 # LIB = name of MPI library
31
32 MPI_INC = -DMPICH_IGNORE_CXX_SEEK
33 MPI_PATH =
34 MPI_LIB =
35
36 # FFT library, can be -DFFT_NONE if not using PPPM from KSPACE package
37 # INC = -DFFT_FFTW, -DFFT_INTEL, -DFFT_NONE, etc, FFT compiler settings
38 # PATH = path for FFT library
39 # LIB = name of FFT library
40
41 FFT_INC = -DFFT_FFTW
42 FFT_PATH =
43 FFT_LIB = -lfftw
44
45 # additional system libraries needed by LAMMPS package libraries

these settings are IGNORED if the corresponding LAMMPS package

47 # (e.g. gpu, meam) is NOT included in the LAMMPS build
48 # SYSLIB = names of libraries
49 # SYSPATH = paths of libraries
50
51 gpu_SYSLIB = -lcudart
52 meam_SYSLIB = -lgfortran
53 reax_SYSLIB = -lgfortran
54 user-atc_SYSLIB =
55
56 gpu_SYSPATH = -L/usr/local/cuda/lib64
57meam_SYSPATH = -L/home/myname/lammps/lib/meam/
58reax_SYSPATH = -L/home/myname/lammps/lib/reax/
59 user-atc_SYSPATH = -L/home/myname/lammps/lib/atc/
60
61 # ---------------------------------------------------------------------
62 # build rules and dependencies
63 # no need to edit this section
64
65 include Makefile.package
66
67 EXTRA_INC = (LMP_INC) (PKG_INC) (MPI_INC) (FFT_INC)
68 EXTRA_PATH = (PKG_PATH) (MPI_PATH) (FFT_PATH) (PKG_SYSPATH)
69 EXTRA_LIB = (PKG_LIB) (MPI_LIB) (FFT_LIB) (PKG_SYSLIB)
70
71 # Link target
72
73 (EXE): (OBJ)
74 (LINK) (LINKFLAGS) (EXTRA_PATH) (OBJ) (EXTRA_LIB) (LIB) -o (EXE) 75 (SIZE) (EXE) 76 77 # Library target 78 79 lib: (OBJ)
80 (ARCHIVE) (ARFLAGS) (EXE) (OBJ)
81
82 # Compilation rules
83
84 .o:.cpp
85 (CC) (CCFLAGS) (EXTRA_INC) -c <
86
87 .d:.cpp
88 (CC) (CCFLAGS) (EXTRA_INC) (DEPFLAGS) < > @

and this is part of the makefile of atc, modified from Makefile.g++:

LIB = libatc.a
93 OBJ = $(SRC:.cpp=.o)
94
95 # ------ SETTINGS ------
96
97 # include any MPI settings needed for the ATC library to build with
98 # the same MPI library that LAMMPS is built with
99
100 CC = mpic++
101 CCFLAGS = -O -g -I/home/myname/blas/ -I/home/myname/lapack/ -I/home/myname/bin/fftw/include/ -I…/…/src -DMPICH_IGNORE_CXX_SEEK
102 ARCHIVE = ar
103 ARCHFLAG = -rc
104 DEPFLAGS = -M
105 LINK = mpic++
106 LINKFLAGS = -O -L/home/myname/bin/fftw/lib/ -L/home/myname/blas/ -L/home/myname/lapack/
107 USRLIB = -lfftw
108 SYSLIB =

I don’t know why there is a reference error. So, plz check my makefile, thanks alot

Best Regards

2010-04-22

Those are missing LAPACK routines. From the manual:

To use the user-atc package and library, the settings for
user-atc_SYSLIB and user-atc_SYSPATH must be correct. This is so that
the appropriate BLAS and LAPACK libs, used by the user-atc library,
can be found.

Steve