Wednesday, July 10, 2019

Compiling Lammps/22Aug18 with Intel 14.0, OpenMPI 1.8.1 and FFTW 3.3.4 (USC)

I.  Assum that Intel compiler and correspoding OpenMPI & FFTW werer be installed

 module avail
 module display "module_name"

II:  Load modules

 module load   intel/intel-14.0
 module load   intel/mkl-14.0
 module load   mpi/intel-14.0/openmpi-1.8.1
 module load   fftw/3.3.4/openmpi-1.8.1/intel-14.0/double/fftw-3.3.4
check 
 module list

III: Compiling LAMMPS

tar -xzvf lammps*.tar.gz

Step 1: chose the packages

Go to src directory
cd lammps_folder

1a. Check which packages are included
make package-status
1b. Choose all the standard
make yes-standard

make yes-user-fep
make yes-user-misc
make yes-user-phonon
make yes-user-meamc
make yes-user-reaxc
1c. Exclude packages that are not required
 make no-voronoi
 make no-kim
 make no-gpu
 make no-kokkos
 make no-mscg

make no-latte
make no-message

Step2: Prepare libraries for the chosed packages

2a. lib/reax
make -f Makefile.ifort
2b. lib/meam
There are 2 ways to do:
way 1: manually
$ cd lib/meam
$ vi Makefile.lammps.ifort
      - - - as below - - - (in Vi press "i" to insert mode --> Esc --> :wq)

$ make -f Makefile.ifort
[Makefile.lammps.ifort modify
meam_SYSINC =
meam_SYSLIB =
meam_SYSPATH =
way 2: perform in lammps/src

cd lammps/src

make lib-meam # print help message
make lib-meam args="-m mpi" # build with default Fortran compiler compatible with your MPI library
make lib-meam args="-m serial" # build with compiler compatible with "make serial" (GNU Fortran)
make lib-meam args="-m ifort" # build with Intel Fortran compiler using Makefile.ifort
2c. lib/poems
cd lib/poems
make -f Makefile.icc
2d. lib/atc
 cd lib/atc
 vi Makefile.lammps.installed
        - - - as below- - -

 make -f Makefile.mpic++
[Makefile.lammps.installed modify]


user-atc_SYSINC =
user-atc_SYSLIB =
user-atc_SYSPATH =
2e. lib/awpmd


$ cd lib/awpmd
$ vi Makefile.lammps.installed
     - - - as below - - -

$ make -f Makefile.mpicc
[Makefile.lammps.installed 수정]


user-awpmd_SYSINC =
user-awpmd_SYSLIB =
user-awpmd_SYSPATH =
2f. lib/linalg


$ cd lib/linalg
$ cp -p Makefile.gfortran Makefile.ifort
$ vi Makefile.ifort
- - - 수정 사항은 아래 참조 - - -
$ make -f Makefile.ifort
[Makefile.ifort 수정]


FC = ifort
FFLAGS = -O3 -fPIC
FFLAGS0 = -O0 -fPIC
2g. lib/latte


finding way...

Step 3: Edit makefile

Copy file src/MAKE/Makefile.mpi
to  src/MAKE/MINE/Makefile.f3mpi   and then edit file Makefile.f3mpi

3a # compiler/linker settings:


CCFLAGS = -O3 -fno-alias -restrict -ip -unroll0 -shared-intel
LINKFLAGS = -O -L/opt/intel/composer_xe_2013_sp1.3.174/mkl/lib/intel64
LIB = -lstdc++ -lpthread -lmkl_sequential -lmkl_intel_lp64 -lmkl_core 

3b MPI Library
MPI_INC =   -I/opt/mpi/intel-14.0/openmpi-1.8.1/include -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1
MPI_PATH =    
MPI_LIB = -L/opt/mpi/intel-14.0/openmpi-1.8.1/lib
3c FFT library
FFT_INC =   -I/opt/fftw/3.3.4/openmpi-1.8.1/intel-14.0/double/include/fftw3 
FFT_PATH = 
FFT_LIB = /opt/fftw/3.3.4/openmpi-1.8.1/intel-14.0/double/lib/libfftw3.a

Step 4: Compile LAMMPS

Check make options. Go to src  (delete previous make --> make clean-all)
# make
# make f3mpi -j8
test:  mpirun -np 2 lmp_f3mpi


Step 5: Create a /usr/local/lammps/11Aug17ti/bin and copy libraries. 

Go to lammps root directory
 cp -Rv  bench   /uhome/p001cao/local/lammps/11Aug18/bench 
 cp -Rv  doc      /uhome/p001cao/local/lammps/11Aug17ti/doc
 cp -Rv  examples    /uhome/p001cao/local/lammps/11Aug17ti/examples
 cp -Rv  potentials   /uhome/p001cao/local/lammps/11Aug17ti/potentials
 cp -Rv tools   /uhome/p001cao/local/lammps/11Aug17ti/tools
 cp -Rv lib     /uhome/p001cao/local/lammps/11Aug17ti/lib
    cd src
 cp -p lmp_f3mpi  /uhome/p001cao/local/lammps/11Aug17ti/bin


cd /uhome/p001cao/local/lammps/11Aug17ti/bin
cp -p  lmp_f3mpi  lmp_mpi 
* Test: at /bin
mpirun -np 2 lmp_mpi
LAMMPS (11 Aug 2017)


Step 6. Create a Modulefile

create modulefile:  lammps/11Aug17ti
and put it into folder:  /uhome/p001cao/local/share/lmodfiles
# for Tcl script use only
set     topdir          /uhome/p001cao/local/lammps
set     version         11.Aug.2017fep

module load   mpi/intel-14.0/openmpi-1.8.1
module load   fftw/3.3.4/openmpi-1.8.1/intel-14.0/double/fftw-3.3.4

setenv          LAMMPS                  $topdir/11Aug17ti
prepend-path    PATH                    $topdir/11Aug17ti/bin
prepend-path    LD_LIBRARY_PATH         $topdir/11Aug17ti/lib
load module

. /etc/profile
module use /uhome/p001cao/local/share/lmodfiles
module load lammps/11Aug17ti
mpirun -np $NSLOTS -machinefile $TMPDIR/machines lmp_mpi ...
Step 7. (Optional) make module usable:
# attach the following command to .bashrc file
module use /uhome/p001cao/local/share/lmodfiles
cd ~ls -la                                                        # to see invisible filesvi .bashrc

References:

Notes:
If copy lmp_linux file using WinSCP, then have to use this command to set it as executable file (assume staying .../bin
#   chmod  +x  lmp_linux 

No comments:

Post a Comment