LAMMPS

From CCI User Wiki
Jump to: navigation, search

Building on the BGQ

The following instructions were tested with the February 10, 2015 release of LAMMPS.

GCC with IEEE floating point conformance

Create a file named src/MAKE/Makefile.bgqGCC with the following contents:

#IEEE fp conformance
SHELL = /bin/sh
CC =		mpicxx
CCFLAGS  =      -g -O3
DEPFLAGS =	-M
LINK =		mpicxx
LINKFLAGS =	${CCFLAGS} -lm
LIB = 
SIZE =		size
ARCHIVE =	ar
ARFLAGS =	-rc
SHFLAGS    =
SHLIBFLAGS = 
LMP_INC =	-DLAMMPS_GZIP
MPI_INC =       -DMPICH_SKIP_MPICXX 
MPI_PATH = 
MPI_LIB =	
FFT_INC =  -DFFT_FFTW3 -I${FFTW_INSTALL_DIR}/include
FFT_PATH = -L${FFTW_INSTALL_DIR}/lib/
FFT_LIB = -lfftw3
JPG_INC =       
JPG_PATH = 	
JPG_LIB =	
include	Makefile.package.settings
include	Makefile.package
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
vpath %.cpp ..
vpath %.h ..
$(EXE):	$(OBJ)
	$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
	$(SIZE) $(EXE)
lib:	$(OBJ)
	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
shlib:	$(OBJ)
	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
        $(OBJ) $(EXTRA_LIB) $(LIB)
%.o:%.cpp
	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
%.d:%.cpp
	$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@ 2> /dev/null
%.o:%.cu
	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
DEPENDS = $(OBJ:.o=.d)
sinclude $(DEPENDS)


Load the GCC and fftw modules

 module load gnu-4.7.2 fftw/gnu472/3.3.4

Build

 cd pathToLammps/src
 make bgqGCC -j16


GCC without strict IEEE floating point conformance

Create a file named src/MAKE/Makefile.bgqGCCFast with the following contents:

#without strict IEEE fp conformance
SHELL = /bin/sh
CC =		mpicxx
CCFLAGS  =      -g -O3 -ffast-math -funroll-loops -ftree-vectorize -std=c++0x -mcpu=a2
DEPFLAGS =	-M
LINK =		mpicxx
LINKFLAGS =	${CCFLAGS} -lm
LIB = 
SIZE =		size
ARCHIVE =	ar
ARFLAGS =	-rc
SHFLAGS    =
SHLIBFLAGS = 
LMP_INC =	-DLAMMPS_GZIP
MPI_INC =       -DMPICH_SKIP_MPICXX 
MPI_PATH = 
MPI_LIB =	
FFT_INC =  -DFFT_FFTW3 -I${FFTW_INSTALL_DIR}/include
FFT_PATH = -L${FFTW_INSTALL_DIR}/lib/
FFT_LIB = -lfftw3
JPG_INC =       
JPG_PATH = 	
JPG_LIB =	
include	Makefile.package.settings
include	Makefile.package
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
vpath %.cpp ..
vpath %.h ..
$(EXE):	$(OBJ)
	$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
	$(SIZE) $(EXE)
lib:	$(OBJ)
	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
shlib:	$(OBJ)
	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
        $(OBJ) $(EXTRA_LIB) $(LIB)
%.o:%.cpp
	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
%.d:%.cpp
	$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@ 2> /dev/null
%.o:%.cu
	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
DEPENDS = $(OBJ:.o=.d)
sinclude $(DEPENDS)

Load the GCC and fftw modules

 module load gnu-4.7.2 fftw/gnu472/3.3.4fast

Build

 cd pathToLammps/src
 make bgqGCCFast -j16


Running on the BGQ

Create a file named run.sh with the following contents:

#!/bin/sh -ex
MY_RUNJOB_OPTS="\
BG_SMP_FAST_WAKEUP=1 \
PAMI_MAX_COMMTHREADS=0 \
PAMID_ASYNC_PROGRESS=0 \
PAMID_CONTEX_POST=1 \
BG_THREADMODEL=1"

case=pathToLammpsInputFile
exe=pathToLammps/src/lmp_bgqGCCFast

srun --runjob-opts="--envs $MY_RUNJOB_OPTS" --overcommit $exe < $case > $SLURM_JOB_ID.out

Submit the job

 sbatch -n numberOfProcesses -N numberOfNodes -t numberOfMinutes -p nameOfJobQueue ./run.sh