Commit 929185da authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Merge branch 'master' into axilrod-teller

# Conflicts:
#	cmake/CMakeLists.txt
#	doc/src/Commands.txt
#	doc/src/Commands_bond.txt
#	doc/src/Howto.txt
#	doc/src/Howto_bioFF.txt
#	doc/src/Howto_coreshell.txt
#	doc/src/Howto_couple.txt
#	doc/src/Howto_diffusion.txt
#	doc/src/Howto_dispersion.txt
#	doc/src/Howto_granular.txt
#	doc/src/Howto_library.txt
#	doc/src/Howto_multiple.txt
#	doc/src/Howto_replica.txt
#	doc/src/Howto_restart.txt
#	doc/src/Howto_temperature.txt
#	doc/src/Howto_tip4p.txt
#	doc/src/Intro.txt
#	doc/src/Intro_authors.txt
#	doc/src/Intro_features.txt
#	doc/src/Intro_nonfeatures.txt
#	doc/src/Manual.txt
#	doc/src/Manual_version.txt
#	doc/src/Packages.txt
#	doc/src/Packages_details.txt
#	doc/src/Packages_standard.txt
#	doc/src/Packages_user.txt
#	doc/src/Section_start.txt
#	doc/src/Speed.txt
#	doc/src/Speed_compare.txt
#	doc/src/Speed_gpu.txt
#	doc/src/Speed_intel.txt
#	doc/src/Speed_kokkos.txt
#	doc/src/Speed_measure.txt
#	doc/src/Speed_omp.txt
#	doc/src/Speed_opt.txt
#	doc/src/Speed_packages.txt
#	doc/src/Speed_tips.txt
#	doc/src/fix_deform.txt
#	doc/src/fix_external.txt
#	doc/src/fix_property_atom.txt
#	doc/src/lammps.book
#	doc/src/neb.txt
#	doc/src/pair_eam.txt
#	doc/src/prd.txt
#	doc/src/run_style.txt
#	doc/src/temper.txt
#	src/version.h
parents 937d4707 b47e4922
......@@ -36,7 +36,14 @@ tools pre- and post-processing tools
Point your browser at any of these files to get started:
doc/Manual.html the LAMMPS manual
doc/Section_intro.html hi-level introduction to LAMMPS
doc/Section_start.html how to build and use LAMMPS
doc/Developer.pdf LAMMPS developer guide
http://lammps.sandia.gov/doc/Manual.html the LAMMPS manual
http://lammps.sandia.gov/doc/Intro.html hi-level introduction
http://lammps.sandia.gov/doc/Build.html how to build LAMMPS
http://lammps.sandia.gov/doc/Run_head.html how to run LAMMPS
http://lammps.sandia.gov/doc/Developer.pdf LAMMPS developer guide
You can also create these doc pages locally:
% cd doc
% make html # creates HTML pages in doc/html
% make pdf # creates Manual.pdf and Developer.pdf
......@@ -17,6 +17,32 @@ file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp)
file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})
# Utility functions
function(list_to_bulletpoints result)
list(REMOVE_AT ARGV 0)
set(temp "")
foreach(item ${ARGV})
set(temp "${temp}* ${item}\n")
endforeach()
set(${result} "${temp}" PARENT_SCOPE)
endfunction(list_to_bulletpoints)
function(validate_option name values)
string(TOLOWER ${${name}} needle_lower)
string(TOUPPER ${${name}} needle_upper)
list(FIND ${values} ${needle_lower} IDX_LOWER)
list(FIND ${values} ${needle_upper} IDX_UPPER)
if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0)
list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}})
message(FATAL_ERROR "\n########################################################################\n"
"Invalid value '${${name}}' for option ${name}\n"
"\n"
"Possible values are:\n"
"${POSSIBLE_VALUE_LIST}"
"########################################################################")
endif()
endfunction(validate_option)
# Cmake modules/macros are in a subdirectory to keep this file cleaner
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
......@@ -106,8 +132,6 @@ if(NOT BUILD_EXE AND NOT BUILD_LIB)
message(FATAL_ERROR "You need to at least enable one of two following options: BUILD_LIB or BUILD_EXE")
endif()
option(DEVELOPER_MODE "Enable developer mode" OFF)
mark_as_advanced(DEVELOPER_MODE)
option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
include(GNUInstallDirs)
......@@ -133,15 +157,21 @@ else()
list(APPEND LAMMPS_LINK_LIBS mpi_stubs)
endif()
set(LAMMPS_SIZE_LIMIT "LAMMPS_SMALLBIG" CACHE STRING "Lammps size limit")
set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS LAMMPS_SMALLBIG LAMMPS_BIGBIG LAMMPS_SMALLSMALL)
add_definitions(-D${LAMMPS_SIZE_LIMIT})
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${LAMMPS_SIZE_LIMIT}")
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS size limit")
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
add_definitions(-DLAMMPS_${LAMMPS_SIZES})
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -DLAMMPS_${LAMMPS_SIZES}")
# posix_memalign is not available on Windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS")
add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0")
add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
endif()
endif()
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF)
......@@ -216,10 +246,13 @@ if(PKG_KSPACE)
if(${FFTW}_FOUND)
set(FFT "${FFTW}" CACHE STRING "FFT library for KSPACE package")
else()
set(FFT "KISSFFT" CACHE STRING "FFT library for KSPACE package")
set(FFT "KISS" CACHE STRING "FFT library for KSPACE package")
endif()
set_property(CACHE FFT PROPERTY STRINGS KISSFFT ${FFTW} MKL)
if(NOT FFT STREQUAL "KISSFFT")
set(FFT_VALUES KISS ${FFTW} MKL)
set_property(CACHE FFT PROPERTY STRINGS ${FFT_VALUES})
validate_option(FFT FFT_VALUES)
string(TOUPPER ${FFT} FFT)
if(NOT FFT STREQUAL "KISS")
find_package(${FFT} REQUIRED)
if(NOT FFT STREQUAL "FFTW3F")
add_definitions(-DFFT_FFTW)
......@@ -228,11 +261,16 @@ if(PKG_KSPACE)
endif()
include_directories(${${FFT}_INCLUDE_DIRS})
list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES})
else()
add_definitions(-DFFT_KISS)
endif()
set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT")
set_property(CACHE PACK_OPTIMIZATION PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY)
if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY")
add_definitions(-D${PACK_OPTIMIZATION})
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
set(FFT_PACK_VALUES array pointer memcpy)
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
validate_option(FFT_PACK FFT_PACK_VALUES)
if(NOT FFT_PACK STREQUAL "array")
string(TOUPPER ${FFT_PACK} FFT_PACK)
add_definitions(-DFFT_PACK_${FFT_PACK})
endif()
endif()
......@@ -310,10 +348,17 @@ if(PKG_VORONOI)
option(DOWNLOAD_VORO "Download voro++ (instead of using the system's one)" OFF)
if(DOWNLOAD_VORO)
include(ExternalProject)
if(BUILD_SHARED_LIBS)
set(VORO_BUILD_OPTIONS "CFLAGS=-fPIC")
else()
set(VORO_BUILD_OPTIONS)
endif()
ExternalProject_Add(voro_build
URL http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz
URL_MD5 2338b824c3b7b25590e18e8df5d68af9
CONFIGURE_COMMAND "" BUILD_IN_SOURCE 1 INSTALL_COMMAND ""
CONFIGURE_COMMAND "" BUILD_COMMAND make ${VORO_BUILD_OPTIONS} BUILD_IN_SOURCE 1 INSTALL_COMMAND ""
)
ExternalProject_get_property(voro_build SOURCE_DIR)
set(VORO_LIBRARIES ${SOURCE_DIR}/src/libvoro++.a)
......@@ -332,6 +377,9 @@ endif()
if(PKG_LATTE)
option(DOWNLOAD_LATTE "Download latte (instead of using the system's one)" OFF)
if(DOWNLOAD_LATTE)
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
endif()
message(STATUS "LATTE not found - we will build our own")
include(ExternalProject)
ExternalProject_Add(latte_build
......@@ -367,8 +415,8 @@ if(PKG_USER-NETCDF)
endif()
if(PKG_USER-SMD)
option(DOWNLOAD_Eigen3 "Download Eigen3 (instead of using the system's one)" OFF)
if(DOWNLOAD_Eigen3)
option(DOWNLOAD_EIGEN3 "Download Eigen3 (instead of using the system's one)" OFF)
if(DOWNLOAD_EIGEN3)
include(ExternalProject)
ExternalProject_Add(Eigen3_build
URL http://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz
......@@ -381,7 +429,7 @@ if(PKG_USER-SMD)
else()
find_package(Eigen3)
if(NOT Eigen3_FOUND)
message(FATAL_ERROR "Eigen3 not found, help CMake to find it by setting EIGEN3_INCLUDE_DIR, or set DOWNLOAD_Eigen3=ON to download it")
message(FATAL_ERROR "Eigen3 not found, help CMake to find it by setting EIGEN3_INCLUDE_DIR, or set DOWNLOAD_EIGEN3=ON to download it")
endif()
endif()
include_directories(${EIGEN3_INCLUDE_DIR})
......@@ -434,6 +482,9 @@ if(PKG_MSCG)
find_package(GSL REQUIRED)
option(DOWNLOAD_MSCG "Download latte (instead of using the system's one)" OFF)
if(DOWNLOAD_MSCG)
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
endif()
include(ExternalProject)
if(NOT LAPACK_FOUND)
set(EXTRA_MSCG_OPTS "-DLAPACK_LIBRARIES=${CMAKE_CURRENT_BINARY_DIR}/liblinalg.a")
......@@ -492,12 +543,13 @@ include(CheckLibraryExists)
if (CMAKE_VERSION VERSION_LESS "3.4")
enable_language(C) # check_library_exists isn't supported without a c compiler before v3.4
endif()
foreach(FUNC sin cos)
check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES})
if(NOT FOUND_${FUNC}_${MATH_LIBRARIES})
message(FATAL_ERROR "Could not find needed math function - ${FUNC}")
endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES})
endforeach(FUNC)
# RB: disabled this check because it breaks with KOKKOS CUDA enabled
#foreach(FUNC sin cos)
# check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES})
# if(NOT FOUND_${FUNC}_${MATH_LIBRARIES})
# message(FATAL_ERROR "Could not find needed math function - ${FUNC}")
# endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES})
#endforeach(FUNC)
list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES})
######################################
......@@ -685,6 +737,11 @@ if(PKG_KOKKOS)
${KOKKOS_PKG_SOURCES_DIR}/npair_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
if(PKG_KSPACE)
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp)
endif()
set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}")
# detects styles which have KOKKOS version
......@@ -722,33 +779,55 @@ if(PKG_OPT)
endif()
if(PKG_USER-INTEL)
if(NOT DEVELOPER_MODE)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
find_package(TBB REQUIRED)
find_package(MKL REQUIRED)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
message(FATAL_ERROR "USER-INTEL is needed at least 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
endif()
endif()
option(INJECT_KNL_FLAG "Inject flags for KNL build" OFF)
if(INJECT_KNL_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xMIC-AVX512")
if(NOT BUILD_OMP)
message(FATAL_ERROR "USER-INTEL requires OpenMP")
endif()
if(NOT ${LAMMPS_MEMALIGN} STREQUAL "64")
message(FATAL_ERROR "USER-INTEL is only useful with LAMMPS_MEMALIGN=64")
endif()
option(INJECT_INTEL_FLAG "Inject OMG fast flags for USER-INTEL" ON)
if(INJECT_INTEL_FLAG AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
set(INTEL_ARCH_VALUES cpu knl)
set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
if(INTEL_ARCH STREQUAL "KNL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"")
add_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
add_definitions(-DLMP_INTEL_OFFLOAD)
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
endif()
include(CheckCXXCompilerFlag)
foreach(_FLAG -qopenmp -qno-offload -fno-alias -ansi-alias -restrict -DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG -O2 "-fp-model fast=2" -no-prec-div -qoverride-limits -qopt-zmm-usage=high)
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
check_cxx_compiler_flag("${__FLAG}" COMPILER_SUPPORTS${_FLAG})
if(COMPILER_SUPPORTS${_FLAG})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FLAG}")
add_compile_options(${_FLAG})
endif()
endforeach()
endif()
add_definitions(-DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG)
list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES} ${MKL_LIBRARIES})
set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h
${USER-INTEL_SOURCES_DIR}/intel_buffers.h
......@@ -781,11 +860,25 @@ if(PKG_GPU)
${GPU_SOURCES_DIR}/fix_gpu.h
${GPU_SOURCES_DIR}/fix_gpu.cpp)
set(GPU_API "OpenCL" CACHE STRING "API used by GPU package")
set_property(CACHE GPU_API PROPERTY STRINGS OpenCL CUDA)
set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "LAMMPS GPU precision size")
set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE)
set(GPU_API "opencl" CACHE STRING "API used by GPU package")
set(GPU_API_VALUES opencl cuda)
set_property(CACHE GPU_API PROPERTY STRINGS ${GPU_API_VALUES})
validate_option(GPU_API GPU_API_VALUES)
string(TOUPPER ${GPU_API} GPU_API)
set(GPU_PREC "mixed" CACHE STRING "LAMMPS GPU precision")
set(GPU_PREC_VALUES double mixed single)
set_property(CACHE GPU_PREC PROPERTY STRINGS ${GPU_PREC_VALUES})
validate_option(GPU_PREC GPU_PREC_VALUES)
string(TOUPPER ${GPU_PREC} GPU_PREC)
if(GPU_PREC STREQUAL "DOUBLE")
set(GPU_PREC_SETTING "DOUBLE_DOUBLE")
elseif(GPU_PREC STREQUAL "MIXED")
set(GPU_PREC_SETTING "SINGLE_DOUBLE")
elseif(GPU_PREC STREQUAL "SINGLE")
set(GPU_PREC_SETTING "SINGLE_SINGLE")
endif()
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp)
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
......@@ -798,7 +891,7 @@ if(PKG_GPU)
endif()
option(CUDPP_OPT "Enable CUDPP_OPT" ON)
set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM architecture (e.g. sm_60)")
set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM architecture (e.g. sm_60)")
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/*.cu)
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
......@@ -812,10 +905,10 @@ if(PKG_GPU)
endif()
cuda_compile_cubin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS
-DUNIX -O3 -Xptxas -v --use_fast_math -DNV_KERNEL -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC})
-DUNIX -O3 -Xptxas -v --use_fast_math -DNV_KERNEL -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC_SETTING})
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS $<$<BOOL:${BUILD_SHARED_LIBS}>:-Xcompiler=-fPIC>
-DUNIX -O3 -Xptxas -v --use_fast_math -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC})
-DUNIX -O3 -Xptxas -v --use_fast_math -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC_SETTING})
foreach(CU_OBJ ${GPU_GEN_OBJS})
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
......@@ -832,7 +925,7 @@ if(PKG_GPU)
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
target_link_libraries(gpu ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC} -DMPI_GERYON -DUCL_NO_EXIT)
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
if(CUDPP_OPT)
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
......@@ -846,10 +939,13 @@ if(PKG_GPU)
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
elseif(GPU_API STREQUAL "OpenCL")
elseif(GPU_API STREQUAL "OPENCL")
find_package(OpenCL REQUIRED)
set(OCL_TUNE "GENERIC" CACHE STRING "OpenCL Device Tuning")
set_property(CACHE OCL_TUNE PROPERTY STRINGS INTEL FERMI KEPLER CYPRESS GENERIC)
set(OCL_TUNE "generic" CACHE STRING "OpenCL Device Tuning")
set(OCL_TUNE_VALUES intel fermi kepler cypress generic)
set_property(CACHE OCL_TUNE PROPERTY STRINGS ${OCL_TUNE_VALUES})
validate_option(OCL_TUNE OCL_TUNE_VALUES)
string(TOUPPER ${OCL_TUNE} OCL_TUNE)
include(OpenCLUtils)
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
......@@ -871,7 +967,7 @@ if(PKG_GPU)
add_library(gpu STATIC ${GPU_LIB_SOURCES})
target_link_libraries(gpu ${OpenCL_LIBRARIES})
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu ${OpenCL_INCLUDE_DIRS})
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT)
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT)
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
list(APPEND LAMMPS_LINK_LIBS gpu)
......@@ -1124,7 +1220,7 @@ if(PKG_GPU)
message(STATUS "GPU Api: ${GPU_API}")
if(GPU_API STREQUAL "CUDA")
message(STATUS "GPU Arch: ${GPU_ARCH}")
elseif(GPU_API STREQUAL "OpenCL")
elseif(GPU_API STREQUAL "OPENCL")
message(STATUS "OCL Tune: ${OCL_TUNE}")
endif()
message(STATUS "GPU Precision: ${GPU_PREC}")
......
# - Find quip
# Find the native QUIP libraries.
#
# QUIP_LIBRARIES - List of libraries when using fftw3.
# QUIP_FOUND - True if fftw3 found.
# QUIP_LIBRARIES - List of libraries of the QUIP package
# QUIP_FOUND - True if QUIP library was found.
#
find_library(QUIP_LIBRARY NAMES quip)
......
# - Find parts of TBB
# Find the native TBB headers and libraries.
#
# TBB_INCLUDE_DIRS - where to find tbb.h, etc.
# TBB_LIBRARIES - List of libraries when using tbb.
# TBB_FOUND - True if tbb found.
#
########################################################
# TBB
# TODO use more generic FindTBB
find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATHS $ENV{TBBROOT}/include)
find_library(TBB_LIBRARY NAMES tbb PATHS $ENV{TBBROOT}/lib/intel64/gcc4.7
$ENV{TBBROOT}/lib/intel64/gcc4.4
$ENV{TBBROOT}/lib/intel64/gcc4.1)
set(TBB_LIBRARIES ${TBB_LIBRARY})
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set TBB_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARY TBB_INCLUDE_DIR)
mark_as_advanced(TBB_INCLUDE_DIR TBB_LIBRARY )
########################################################
# TBB Malloc
find_path(TBB_MALLOC_INCLUDE_DIR NAMES tbb/tbb.h PATHS $ENV{TBBROOT}/include)
find_library(TBB_MALLOC_LIBRARY NAMES tbbmalloc PATHS $ENV{TBBROOT}/lib/intel64/gcc4.7
$ENV{TBBROOT}/lib/intel64/gcc4.4
$ENV{TBBROOT}/lib/intel64/gcc4.1)
set(TBB_MALLOC_LIBRARIES ${TBB_MALLOC_LIBRARY})
set(TBB_MALLOC_INCLUDE_DIRS ${TBB_MALLOC_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set TBB_MALLOC_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(TBB_MALLOC DEFAULT_MSG TBB_MALLOC_LIBRARY TBB_MALLOC_INCLUDE_DIR)
mark_as_advanced(TBB_MALLOC_INCLUDE_DIR TBB_MALLOC_LIBRARY )
......@@ -62,7 +62,7 @@ should get you started.
git clone https://github.com/lammps/lammps.git
mkdir lammps/build
cd lammps/build
cmake ../cmake [-DOPTION_A=VALUE_A -DOPTION_B=VALUE_B ...]
cmake [-D OPTION_A=VALUE_A -D OPTION_B=VALUE_B ...] ../cmake
make
```
......@@ -174,7 +174,7 @@ presets can be found in the `cmake/presets` folder.
# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package
mkdir build
cd build
cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake
```
# Reference
......@@ -265,6 +265,26 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
</dl>
</td>
</tr>
<tr>
<td><code>BUILD_LIB</code></td>
<td>control whether to build LAMMPS as a library</td>
<td>
<dl>
<dt><code>off</code> (default)</dt>
<dt><code>on</code></dt>
</dl>
</td>
</tr>
<tr>
<td><code>BUILD_EXE</code></td>
<td>control whether to build LAMMPS executable</td>
<td>
<dl>
<dt><code>on</code> (default)</dt>
<dt><code>off</code></dt>
</dl>
</td>
</tr>
<tr>
<td><code>BUILD_SHARED_LIBS</code></td>
<td>control whether to build LAMMPS as a shared-library</td>
......@@ -315,8 +335,8 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
`mpicxx` in your path and use this MPI implementation.</td>
<td>
<dl>
<dt><code>off</code> (default)</dt>
<dt><code>on</code></dt>
<dt><code>on</code> (default, if found)</dt>
<dt><code>off</code></dt>
</dl>
</td>
</tr>
......@@ -325,8 +345,8 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
<td>control whether to build LAMMPS with OpenMP support.</td>
<td>
<dl>
<dt><code>off</code> (default)</dt>
<dt><code>on</code></dt>
<dt><code>on</code> (default, if found)</dt>
<dt><code>off</code></dt>
</dl>
</td>
</tr>
......@@ -1271,7 +1291,7 @@ providing the identical features and USER interface.</strong></p>
</td>
<td>
<dl>
<dt><code>KISSFFT</code></dt>
<dt><code>KISS</code></dt>
<dt><code>FFTW3</code></dt>
<dt><code>FFTW2</code></dt>
<dt><code>MKL</code></dt>
......@@ -1279,13 +1299,13 @@ providing the identical features and USER interface.</strong></p>
</td>
</tr>
<tr>
<td><code>PACK_ARRAY</code></td>
<td><code>FFT_PACK</code></td>
<td>Optimization for FFT</td>
<td>
<dl>
<dt><code>PACK_ARRAY</code></dt>
<dt><code>PACK_POINTER</code></dt>
<dt><code>PACK_MEMCPY</code></dt>
<dt><code>array (default)</code></dt>
<dt><code>pointer</code></dt>
<dt><code>memcpy</code></dt>
</dl>
</td>
</tr>
......@@ -1377,6 +1397,29 @@ TODO
### PYTHON Package
### USER-INTEL Package
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
<th>Values</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>INTEL_ARCH</code></td>
<td>Target architecture for USER-INTEL package</td>
<td>
<dl>
<dt><code>cpu</code> (default)</dt>
<dt><code>knl</code></dt>
</dl>
</td>
</tr>
</tbody>
</table>
### GPU Package
The GPU package builds a support library which can either use OpenCL or CUDA as
......@@ -1396,8 +1439,8 @@ target API.
<td>API used by GPU package</td>
<td>
<dl>
<dt><code>OpenCL</code> (default)</dt>
<dt><code>CUDA</code></dt>
<dt><code>opencl</code> (default)</dt>
<dt><code>cuda</code></dt>
</dl>
</td>
</tr>
......@@ -1406,9 +1449,9 @@ target API.
<td>Precision size used by GPU package kernels</td>
<td>
<dl>
<dt><code>SINGLE_DOUBLE</code></dt>
<dt><code>SINGLE_SINGLE</code></dt>
<dt><code>DOUBLE_DOUBLE</code></dt>
<dt><code>mixed</code> (default)</dt>
<dt><code>single</code></dt>
<dt><code>double</code></dt>
</dl>
</td>
</tr>
......@@ -1417,12 +1460,12 @@ target API.
<td>Tuning target for OpenCL driver code</td>
<td>
<dl>
<dt><code>GENERIC</code> (default)</dt>
<dt><code>INTEL</code> (Intel CPU)</dt>
<dt><code>PHI</code> (Intel Xeon Phi)</dt>
<dt><code>FERMI</code> (NVIDIA)</dt>
<dt><code>KEPLER</code> (NVIDIA)</dt>
<dt><code>CYPRESS</code> (AMD)</dt>
<dt><code>generic</code> (default)</dt>
<dt><code>intel</code> (Intel CPU)</dt>
<dt><code>phi</code> (Intel Xeon Phi)</dt>
<dt><code>fermi</code> (NVIDIA)</dt>
<dt><code>kepler</code> (NVIDIA)</dt>
<dt><code>cypress</code> (AMD)</dt>
</dl>
</td>
</tr>
......@@ -1517,6 +1560,16 @@ Requires a Eigen3 installation
</tr>
</thead>
<tbody>
<tr>
<td><code>WITH_JPEG</code></td>
<td>Enables/Disable JPEG support in LAMMPS</td>
<td>
<dl>
<dt><code>yes</code> (default, if found)</dt>
<dt><code>no</code></dt>
</dl>
</td>
</tr>
<tr>
<td><code>JPEG_INCLUDE_DIR</code></td>
<td></td>
......@@ -1544,6 +1597,16 @@ Requires a Eigen3 installation
</tr>
</thead>
<tbody>
<tr>
<td><code>WITH_PNG</code></td>
<td>Enables/Disable PNG support in LAMMPS</td>
<td>
<dl>
<dt><code>yes</code> (default, if found)</dt>
<dt><code>no</code></dt>
</dl>
</td>
</tr>
<tr>
<td><code>PNG_INCLUDE_DIR</code></td>