diff --git a/examples/melt/in.melt b/examples/melt/in.melt new file mode 100644 index 0000000000..8431a4344e --- /dev/null +++ b/examples/melt/in.melt @@ -0,0 +1,33 @@ +# 3d Lennard-Jones melt + +units lj +atom_style atomic + +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 1 box +create_atoms 1 box +mass 1 1.0 + +velocity all create 3.0 87287 + +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 2.5 + +neighbor 0.3 bin +neigh_modify every 20 delay 0 check no + +fix 1 all nve + +#dump id all atom 50 dump.melt + +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +thermo 50 +run 250 diff --git a/examples/peptide/in.peptide b/examples/peptide/in.peptide new file mode 100644 index 0000000000..1a4bc6df31 --- /dev/null +++ b/examples/peptide/in.peptide @@ -0,0 +1,42 @@ +# Solvated 5-mer peptide + +units real +atom_style full + +pair_style lj/charmm/coul/long 8.0 10.0 10.0 +bond_style harmonic +angle_style charmm +dihedral_style charmm +improper_style harmonic +kspace_style pppm 0.0001 + +read_data data.peptide + +neighbor 2.0 bin +neigh_modify delay 5 + +timestep 2.0 + +thermo_style multi +thermo 50 + +fix 1 all nvt temp 275.0 275.0 100.0 tchain 1 +fix 2 all shake 0.0001 10 100 b 4 6 8 10 12 14 18 a 31 + +group peptide type <= 12 + +#dump 1 peptide atom 10 dump.peptide + +#dump 2 peptide image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 bond atom 0.5 +#dump_modify 2 pad 3 + +#dump 3 peptide movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 bond atom 0.5 +#dump_modify 3 pad 3 + +#compute bnd all property/local btype batom1 batom2 +#dump 2 peptide local 300 dump.bond index c_bnd[1] c_bnd[2] c_bnd[3] + +run 300 + diff --git a/examples/rigid/in.rigid b/examples/rigid/in.rigid new file mode 100644 index 0000000000..930c025aa3 --- /dev/null +++ b/examples/rigid/in.rigid @@ -0,0 +1,81 @@ +# Simple rigid body system + +units lj +atom_style atomic + +pair_style lj/cut 2.5 + +read_data data.rigid + +velocity all create 100.0 4928459 + +# unconnected bodies + +group clump1 id <> 1 9 +group clump2 id <> 10 18 +group clump3 id <> 19 27 +group clump4 id <> 28 36 +group clump5 id <> 37 45 +group clump6 id <> 46 54 +group clump7 id <> 55 63 +group clump8 id <> 64 72 +group clump9 id <> 73 81 + +fix 1 all rigid group 9 clump1 clump2 clump3 clump4 clump5 & + clump6 clump7 clump8 clump9 + +# 1 chain of connected bodies + +#group clump1 id <> 1 9 +#group clump2 id <> 9 18 +#group clump3 id <> 18 27 +#group clump4 id <> 27 36 +#group clump5 id <> 36 45 +#group clump6 id <> 45 54 +#group clump7 id <> 54 63 +#group clump8 id <> 63 72 +#group clump9 id <> 72 81 + +#fix 1 all poems group clump1 clump2 clump3 clump4 clump5 & +# clump6 clump7 clump8 clump9 + +# 2 chains of connected bodies + +#group clump1 id <> 1 9 +#group clump2 id <> 9 18 +#group clump3 id <> 18 27 +#group clump4 id <> 27 36 +#group clump5 id <> 37 45 +#group clump6 id <> 45 54 +#group clump7 id <> 54 63 +#group clump8 id <> 63 72 +#group clump9 id <> 72 81 + +#fix 1 all poems group clump1 clump2 clump3 clump4 +#fix 2 all poems group clump5 clump6 clump7 clump8 clump9 + +neigh_modify exclude group clump1 clump1 +neigh_modify exclude group clump2 clump2 +neigh_modify exclude group clump3 clump3 +neigh_modify exclude group clump4 clump4 +neigh_modify exclude group clump5 clump5 +neigh_modify exclude group clump6 clump6 +neigh_modify exclude group clump7 clump7 +neigh_modify exclude group clump8 clump8 +neigh_modify exclude group clump9 clump9 + +thermo 100 + +#dump 1 all atom 50 dump.rigid + +#dump 2 all image 100 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 100 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 5 + +timestep 0.0001 +thermo 50 +run 10000 diff --git a/lib/gpu/Makefile.linux b/lib/gpu/Makefile.linux new file mode 100644 index 0000000000..ed5b6092d3 --- /dev/null +++ b/lib/gpu/Makefile.linux @@ -0,0 +1,52 @@ +# /* ---------------------------------------------------------------------- +# Generic Linux Makefile for CUDA +# - Change CUDA_ARCH for your GPU +# ------------------------------------------------------------------------- */ + +# which file will be copied to Makefile.lammps + +EXTRAMAKE = Makefile.lammps.standard + +ifeq ($(CUDA_HOME),) +CUDA_HOME = /usr/local/cuda +endif + +NVCC = nvcc + +# Tesla CUDA +CUDA_ARCH = -arch=sm_21 +# newer CUDA +#CUDA_ARCH = -arch=sm_13 +# older CUDA +#CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE +CUDA_ARCH = -arch=sm_35 + +# this setting should match LAMMPS Makefile +# one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL + +LMP_INC = -DLAMMPS_SMALLBIG + +# precision for GPU calculations +# -D_SINGLE_SINGLE # Single precision for all calculations +# -D_DOUBLE_DOUBLE # Double precision for all calculations +# -D_SINGLE_DOUBLE # Accumulation of forces, etc. in double + +CUDA_PRECISION = -D_SINGLE_DOUBLE + +CUDA_INCLUDE = -I$(CUDA_HOME)/include +CUDA_LIB = -L$(CUDA_HOME)/lib64 +CUDA_OPTS = -DUNIX -O3 -Xptxas -v --use_fast_math $(LMP_INC) -Xcompiler -fPIC + +CUDR_CPP = mpicxx -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 -fPIC +CUDR_OPTS = -O2 $(LMP_INC) # -xHost -no-prec-div -ansi-alias + +BIN_DIR = ./ +OBJ_DIR = ./ +LIB_DIR = ./ +AR = ar +BSH = /bin/sh + +CUDPP_OPT = -DUSE_CUDPP -Icudpp_mini + +include Nvidia.makefile + diff --git a/lib/kokkos/Makefile.kokkos b/lib/kokkos/Makefile.kokkos index 388a3f5544..4641232a1f 100644 --- a/lib/kokkos/Makefile.kokkos +++ b/lib/kokkos/Makefile.kokkos @@ -5,15 +5,16 @@ KOKKOS_PATH=../../lib/kokkos CXXFLAGS=$(CCFLAGS) # Options: Cuda,ROCm,OpenMP,Pthreads,Qthreads,Serial -KOKKOS_DEVICES ?= "Cuda, OpenMP" +KOKKOS_DEVICES ?= "OpenMP" #KOKKOS_DEVICES ?= "Pthreads" # Options: -KOKKOS_ARCH ?= "Pascal61" +# Intel: KNC,KNL,SNB,HSW,BDW,SKX # NVIDIA: Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61 # ARM: ARMv80,ARMv81,ARMv8-ThunderX # IBM: BGQ,Power7,Power8,Power9 # AMD-GPUS: Kaveri,Carrizo,Fiji,Vega # AMD-CPUS: AMDAVX,Ryzen,Epyc +KOKKOS_ARCH ?= "" # Options: yes,no KOKKOS_DEBUG ?= "no" # Options: hwloc,librt,experimental_memkind diff --git a/lib/kokkos/bin/nvcc_wrapper b/lib/kokkos/bin/nvcc_wrapper index 51b507b53c..76e33f3c66 100755 --- a/lib/kokkos/bin/nvcc_wrapper +++ b/lib/kokkos/bin/nvcc_wrapper @@ -12,7 +12,7 @@ # or g++ as their back-end compiler. The defaults can be overwritten # by using the usual arguments (e.g., -arch=sm_30 -ccbin icpc). -default_arch="sm_61" +default_arch="sm_35" #default_arch="sm_50" # diff --git a/lib/kokkos/config/nvcc_wrapper b/lib/kokkos/config/nvcc_wrapper new file mode 100755 index 0000000000..cb206cf88b --- /dev/null +++ b/lib/kokkos/config/nvcc_wrapper @@ -0,0 +1,284 @@ +#!/bin/bash +# +# This shell script (nvcc_wrapper) wraps both the host compiler and +# NVCC, if you are building legacy C or C++ code with CUDA enabled. +# The script remedies some differences between the interface of NVCC +# and that of the host compiler, in particular for linking. +# It also means that a legacy code doesn't need separate .cu files; +# it can just use .cpp files. +# +# Default settings: change those according to your machine. For +# example, you may have have two different wrappers with either icpc +# or g++ as their back-end compiler. The defaults can be overwritten +# by using the usual arguments (e.g., -arch=sm_30 -ccbin icpc). + +default_arch="sm_35" +#default_arch="sm_50" + +# +# The default C++ compiler. +# +host_compiler=${NVCC_WRAPPER_DEFAULT_COMPILER:-"g++"} +#host_compiler="icpc" +#host_compiler="/usr/local/gcc/4.8.3/bin/g++" +#host_compiler="/usr/local/gcc/4.9.1/bin/g++" + +# +# Internal variables +# + +# C++ files +cpp_files="" + +# Host compiler arguments +xcompiler_args="" + +# Cuda (NVCC) only arguments +cuda_args="" + +# Arguments for both NVCC and Host compiler +shared_args="" + +# Linker arguments +xlinker_args="" + +# Object files passable to NVCC +object_files="" + +# Link objects for the host linker only +object_files_xlinker="" + +# Shared libraries with version numbers are not handled correctly by NVCC +shared_versioned_libraries_host="" +shared_versioned_libraries="" + +# Does the User set the architecture +arch_set=0 + +# Does the user overwrite the host compiler +ccbin_set=0 + +#Error code of compilation +error_code=0 + +# Do a dry run without actually compiling +dry_run=0 + +# Skip NVCC compilation and use host compiler directly +host_only=0 + +# Enable workaround for CUDA 6.5 for pragma ident +replace_pragma_ident=0 + +# Mark first host compiler argument +first_xcompiler_arg=1 + +temp_dir=${TMPDIR:-/tmp} + +# Check if we have an optimization argument already +optimization_applied=0 + +#echo "Arguments: $# $@" + +while [ $# -gt 0 ] +do + case $1 in + #show the executed command + --show|--nvcc-wrapper-show) + dry_run=1 + ;; + #run host compilation only + --host-only) + host_only=1 + ;; + #replace '#pragma ident' with '#ident' this is needed to compile OpenMPI due to a configure script bug and a non standardized behaviour of pragma with macros + --replace-pragma-ident) + replace_pragma_ident=1 + ;; + #handle source files to be compiled as cuda files + *.cpp|*.cxx|*.cc|*.C|*.c++|*.cu) + cpp_files="$cpp_files $1" + ;; + # Ensure we only have one optimization flag because NVCC doesn't allow muliple + -O*) + if [ $optimization_applied -eq 1 ]; then + echo "nvcc_wrapper - *warning* you have set multiple optimization flags (-O*), only the first is used because nvcc can only accept a single optimization setting." + else + shared_args="$shared_args $1" + optimization_applied=1 + fi + ;; + #Handle shared args (valid for both nvcc and the host compiler) + -D*|-c|-I*|-L*|-l*|-g|--help|--version|-E|-M|-shared) + shared_args="$shared_args $1" + ;; + #Handle shared args that have an argument + -o|-MT) + shared_args="$shared_args $1 $2" + shift + ;; + #Handle known nvcc args + -gencode*|--dryrun|--verbose|--keep|--keep-dir*|-G|--relocatable-device-code*|-lineinfo|-expt-extended-lambda|--resource-usage|-Xptxas*) + cuda_args="$cuda_args $1" + ;; + #Handle more known nvcc args + --expt-extended-lambda|--expt-relaxed-constexpr) + cuda_args="$cuda_args $1" + ;; + #Handle known nvcc args that have an argument + -rdc|-maxrregcount|--default-stream) + cuda_args="$cuda_args $1 $2" + shift + ;; + #Handle c++11 setting + --std=c++11|-std=c++11) + shared_args="$shared_args $1" + ;; + #strip of -std=c++98 due to nvcc warnings and Tribits will place both -std=c++11 and -std=c++98 + -std=c++98|--std=c++98) + ;; + #strip of pedantic because it produces endless warnings about #LINE added by the preprocessor + -pedantic|-Wpedantic|-ansi) + ;; + #strip -Xcompiler because we add it + -Xcompiler) + if [ $first_xcompiler_arg -eq 1 ]; then + xcompiler_args="$2" + first_xcompiler_arg=0 + else + xcompiler_args="$xcompiler_args,$2" + fi + shift + ;; + #strip of "-x cu" because we add that + -x) + if [[ $2 != "cu" ]]; then + if [ $first_xcompiler_arg -eq 1 ]; then + xcompiler_args="-x,$2" + first_xcompiler_arg=0 + else + xcompiler_args="$xcompiler_args,-x,$2" + fi + fi + shift + ;; + #Handle -ccbin (if its not set we can set it to a default value) + -ccbin) + cuda_args="$cuda_args $1 $2" + ccbin_set=1 + host_compiler=$2 + shift + ;; + #Handle -arch argument (if its not set use a default + -arch*) + cuda_args="$cuda_args $1" + arch_set=1 + ;; + #Handle -Xcudafe argument + -Xcudafe) + cuda_args="$cuda_args -Xcudafe $2" + shift + ;; + #Handle args that should be sent to the linker + -Wl*) + xlinker_args="$xlinker_args -Xlinker ${1:4:${#1}}" + host_linker_args="$host_linker_args ${1:4:${#1}}" + ;; + #Handle object files: -x cu applies to all input files, so give them to linker, except if only linking + *.a|*.so|*.o|*.obj) + object_files="$object_files $1" + object_files_xlinker="$object_files_xlinker -Xlinker $1" + ;; + #Handle object files which always need to use "-Xlinker": -x cu applies to all input files, so give them to linker, except if only linking + *.dylib) + object_files="$object_files -Xlinker $1" + object_files_xlinker="$object_files_xlinker -Xlinker $1" + ;; + #Handle shared libraries with *.so.* names which nvcc can't do. + *.so.*) + shared_versioned_libraries_host="$shared_versioned_libraries_host $1" + shared_versioned_libraries="$shared_versioned_libraries -Xlinker $1" + ;; + #All other args are sent to the host compiler + *) + if [ $first_xcompiler_arg -eq 1 ]; then + xcompiler_args=$1 + first_xcompiler_arg=0 + else + xcompiler_args="$xcompiler_args,$1" + fi + ;; + esac + + shift +done + +#Add default host compiler if necessary +if [ $ccbin_set -ne 1 ]; then + cuda_args="$cuda_args -ccbin $host_compiler" +fi + +#Add architecture command +if [ $arch_set -ne 1 ]; then + cuda_args="$cuda_args -arch=$default_arch" +fi + +#Compose compilation command +nvcc_command="nvcc $cuda_args $shared_args $xlinker_args $shared_versioned_libraries" +if [ $first_xcompiler_arg -eq 0 ]; then + nvcc_command="$nvcc_command -Xcompiler $xcompiler_args" +fi + +#Compose host only command +host_command="$host_compiler $shared_args $xcompiler_args $host_linker_args $shared_versioned_libraries_host" + +#nvcc does not accept '#pragma ident SOME_MACRO_STRING' but it does accept '#ident SOME_MACRO_STRING' +if [ $replace_pragma_ident -eq 1 ]; then + cpp_files2="" + for file in $cpp_files + do + var=`grep pragma ${file} | grep ident | grep "#"` + if [ "${#var}" -gt 0 ] + then + sed 's/#[\ \t]*pragma[\ \t]*ident/#ident/g' $file > $temp_dir/nvcc_wrapper_tmp_$file + cpp_files2="$cpp_files2 $temp_dir/nvcc_wrapper_tmp_$file" + else + cpp_files2="$cpp_files2 $file" + fi + done + cpp_files=$cpp_files2 + #echo $cpp_files +fi + +if [ "$cpp_files" ]; then + nvcc_command="$nvcc_command $object_files_xlinker -x cu $cpp_files" +else + nvcc_command="$nvcc_command $object_files" +fi + +if [ "$cpp_files" ]; then + host_command="$host_command $object_files $cpp_files" +else + host_command="$host_command $object_files" +fi + +#Print command for dryrun +if [ $dry_run -eq 1 ]; then + if [ $host_only -eq 1 ]; then + echo $host_command + else + echo $nvcc_command + fi + exit 0 +fi + +#Run compilation command +if [ $host_only -eq 1 ]; then + $host_command +else + $nvcc_command +fi +error_code=$? + +#Report error code +exit $error_code diff --git a/src/MAKE/MACHINES/Makefile.icex b/src/MAKE/MACHINES/Makefile.icex new file mode 100644 index 0000000000..ceeec48870 --- /dev/null +++ b/src/MAKE/MACHINES/Makefile.icex @@ -0,0 +1,116 @@ +# mpi = MPI with its default compiler + +SHELL = /bin/sh + +# --------------------------------------------------------------------- +# compiler/linker settings +# specify flags and libraries needed for your compiler + +CC = mpicxx +CCFLAGS = -g -O3 -Wall -Wextra -frounding-math -fsignaling-nans -march=native +SHFLAGS = -shared -MD -mcmodel=medium -fpic -fPIC +DEPFLAGS = -M + +LINK = mpicxx +LINKFLAGS = -g -O +LIB = +SIZE = size + +ARCHIVE = ar +ARFLAGS = -rc +SHLIBFLAGS = -shared + +# --------------------------------------------------------------------- +# LAMMPS-specific settings, all OPTIONAL +# specify settings for LAMMPS features you will use +# if you change any -D setting, do full re-compile after "make clean" + +# LAMMPS ifdef settings +# see possible settings in Section 2.2 (step 4) of manual + +LMP_INC = -DLAMMPS_GZIP +#LMP_INC += -DLAMMPS_JPEG +LMP_INC += -DLAMMPS_MEMALIGN=64 + +# MPI library +# see discussion in Section 2.2 (step 5) of manual +# MPI wrapper compiler/linker can provide this info +# can point to dummy MPI library in src/STUBS as in Makefile.serial +# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts +# INC = path for mpi.h, MPI compiler settings +# PATH = path for MPI library +# LIB = name of MPI library + +MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 +MPI_PATH = +MPI_LIB = + +# FFT library +# see discussion in Section 2.2 (step 6) of manual +# can be left blank to use provided KISS FFT library +# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings +# PATH = path for FFT library +# LIB = name of FFT library + +FFT_INC = +FFT_PATH = +FFT_LIB = + +# JPEG and/or PNG library +# see discussion in Section 2.2 (step 7) of manual +# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC +# INC = path(s) for jpeglib.h and/or png.h +# PATH = path(s) for JPEG library and/or PNG library +# LIB = name(s) of JPEG library and/or PNG library + +JPG_INC = +JPG_PATH = +JPG_LIB = + +# --------------------------------------------------------------------- +# build rules and dependencies +# do not edit this section + +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) +EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) +EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) + +# Path to src files + +vpath %.cpp .. +vpath %.h .. + +# Link target + +$(EXE): $(OBJ) $(EXTRA_LINK_DEPENDS) + $(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE) + $(SIZE) $(EXE) + +# Library targets + +lib: $(OBJ) $(EXTRA_LINK_DEPENDS) + $(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ) + +shlib: $(OBJ) $(EXTRA_LINK_DEPENDS) + $(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \ + $(OBJ) $(EXTRA_LIB) $(LIB) + +# Compilation rules + +%.o:%.cpp + $(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $< + +# Individual dependencies + +depend : fastdep.exe $(SRC) + @./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1 + +fastdep.exe: ../DEPEND/fastdep.c + cc -O -o $@ $< + +sinclude .depend