Merge pull request #1400 from akohlmey/collected-small-changes

Refactor USER-INTEL support in CMake and support Linux-2-Windows cross-compiling with CMake
This commit is contained in:
Axel Kohlmeyer
2019-04-02 17:48:21 -04:00
committed by GitHub
32 changed files with 427 additions and 320 deletions

View File

@ -322,7 +322,7 @@ pkg_depends(USER-SCAFACOS MPI)
find_package(OpenMP QUIET) find_package(OpenMP QUIET)
option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND}) option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND})
if(BUILD_OMP OR PKG_KOKKOS OR PKG_USER-INTEL) if(BUILD_OMP)
find_package(OpenMP REQUIRED) find_package(OpenMP REQUIRED)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
@ -560,6 +560,20 @@ if(PKG_USER-PLUMED)
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" OFF) option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" OFF)
if(DOWNLOAD_PLUMED) if(DOWNLOAD_PLUMED)
if(BUILD_MPI)
set(PLUMED_CONFIG_MPI "--enable-mpi")
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER})
else()
set(PLUMED_CONFIG_MPI "--disable-mpi")
set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER})
set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER})
endif()
if(BUILD_OMP)
set(PLUMED_CONFIG_OMP "--enable-openmp")
else()
set(PLUMED_CONFIG_OMP "--disable-openmp")
endif()
message(STATUS "PLUMED download requested - we will build our own") message(STATUS "PLUMED download requested - we will build our own")
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(plumed_build ExternalProject_Add(plumed_build
@ -569,8 +583,10 @@ if(PKG_USER-PLUMED)
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
${CONFIGURE_REQUEST_PIC} ${CONFIGURE_REQUEST_PIC}
--enable-modules=all --enable-modules=all
CXX=${CMAKE_MPI_CXX_COMPILER} ${PLUMED_CONFIG_MPI}
CC=${CMAKE_MPI_C_COMPILER} ${PLUMED_CONFIG_OMP}
CXX=${PLUMED_CONFIG_CXX}
CC=${PLUMED_CONFIG_CC}
) )
ExternalProject_get_property(plumed_build INSTALL_DIR) ExternalProject_get_property(plumed_build INSTALL_DIR)
set(PLUMED_INSTALL_DIR ${INSTALL_DIR}) set(PLUMED_INSTALL_DIR ${INSTALL_DIR})
@ -607,7 +623,10 @@ if(PKG_USER-MOLFILE)
set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers") set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
add_library(molfile INTERFACE) add_library(molfile INTERFACE)
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
# no need to link with -ldl on windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
endif()
list(APPEND LAMMPS_LINK_LIBS molfile) list(APPEND LAMMPS_LINK_LIBS molfile)
endif() endif()
@ -944,7 +963,7 @@ if(PKG_USER-OMP)
# detects styles which have USER-OMP version # detects styles which have USER-OMP version
RegisterStylesExt(${USER-OMP_SOURCES_DIR} omp OMP_SOURCES) RegisterStylesExt(${USER-OMP_SOURCES_DIR} omp OMP_SOURCES)
RegisterFixStyle("${USER-OMP_SOURCES_DIR}/fix_omp.h") RegisterFixStyle(${USER-OMP_SOURCES_DIR}/fix_omp.h)
get_property(USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES) get_property(USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES)
@ -1057,24 +1076,10 @@ if(PKG_OPT)
endif() endif()
if(PKG_USER-INTEL) if(PKG_USER-INTEL)
find_package(TBB REQUIRED) if(LAMMPS_SIZES STREQUAL BIGBIG)
find_package(MKL REQUIRED) message(FATAL_ERROR "The USER-INTEL Package is not compatible with -DLAMMPS_BIGBIG")
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 needs at least a 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
endif()
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() endif()
add_definitions(-DLMP_USER_INTEL)
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)") set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
set(INTEL_ARCH_VALUES cpu knl) set(INTEL_ARCH_VALUES cpu knl)
@ -1082,12 +1087,68 @@ if(PKG_USER-INTEL)
validate_option(INTEL_ARCH INTEL_ARCH_VALUES) validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
string(TOUPPER ${INTEL_ARCH} INTEL_ARCH) string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
find_package(Threads QUIET)
if(Threads_FOUND)
set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
else()
set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
endif()
set(INTEL_LRT_VALUES none threads c++11)
set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES})
validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES)
string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE)
if(INTEL_LRT_MODE STREQUAL "THREADS")
if(Threads_FOUND)
add_definitions(-DLMP_INTEL_USELRT)
list(APPEND LAMMPS_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})
else()
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
endif()
endif()
if(INTEL_LRT_MODE STREQUAL "C++11")
add_definitions(-DLMP_INTEL_USERLRT -DLMP_INTEL_LRT11)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
message(FATAL_ERROR "USER-INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
endif()
else()
message(WARNING "USER-INTEL gives best performance with Intel compilers")
endif()
find_package(TBB QUIET)
if(TBB_FOUND)
list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES})
else()
add_definitions(-DLMP_INTEL_NO_TBB)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
message(WARNING "USER-INTEL with Intel compilers should use TBB malloc libraries")
endif()
endif()
find_package(MKL QUIET)
if(MKL_FOUND)
add_definitions(-DLMP_USE_MKL_RNG)
list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES})
else()
message(STATUS "Pair style dpd/intel will be faster with MKL libraries")
endif()
if((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256"))
message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256 on this platform")
endif()
if(INTEL_ARCH STREQUAL "KNL") if(INTEL_ARCH STREQUAL "KNL")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
message(FATAL_ERROR "Must use Intel compiler with USER-INTEL for KNL architecture")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload") 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\\\"\"") 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_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
add_definitions(-DLMP_INTEL_OFFLOAD) add_definitions(-DLMP_INTEL_OFFLOAD)
else() else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4) 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") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512")
else() else()
@ -1100,28 +1161,28 @@ if(PKG_USER-INTEL)
add_compile_options(${_FLAG}) add_compile_options(${_FLAG})
endif() endif()
endforeach() endforeach()
else()
add_compile_options(-O3 -ffast-math)
endif()
endif() endif()
add_definitions(-DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG) # collect sources
list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES} ${MKL_LIBRARIES})
set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL) set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp
${USER-INTEL_SOURCES_DIR}/intel_buffers.h ${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp
${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp
${USER-INTEL_SOURCES_DIR}/math_extra_intel.h
${USER-INTEL_SOURCES_DIR}/nbin_intel.h
${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp
${USER-INTEL_SOURCES_DIR}/npair_intel.h
${USER-INTEL_SOURCES_DIR}/npair_intel.cpp ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp
${USER-INTEL_SOURCES_DIR}/intel_simd.h ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp)
${USER-INTEL_SOURCES_DIR}/intel_intrinsics.h)
set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}")
# detects styles which have USER-INTEL version # detect styles which have a USER-INTEL version
RegisterStylesExt(${USER-INTEL_SOURCES_DIR} opt USER-INTEL_SOURCES) RegisterStylesExt(${USER-INTEL_SOURCES_DIR} intel USER-INTEL_SOURCES)
RegisterNBinStyle(${USER-INTEL_SOURCES_DIR}/nbin_intel.h)
RegisterNPairStyle(${USER-INTEL_SOURCES_DIR}/npair_intel.h)
RegisterFixStyle(${USER-INTEL_SOURCES_DIR}/fix_intel.h)
RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES)

View File

@ -91,6 +91,10 @@ function(RegisterFixStyle path)
AddStyleHeader(${path} FIX) AddStyleHeader(${path} FIX)
endfunction(RegisterFixStyle) endfunction(RegisterFixStyle)
function(RegisterIntegrateStyle path)
AddStyleHeader(${path} INTEGRATE)
endfunction(RegisterIntegrateStyle)
function(RegisterStyles search_path) function(RegisterStyles search_path)
FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force
FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid

View File

@ -155,11 +155,13 @@ make
The CMake build exposes a lot of different options. In the old build system The CMake build exposes a lot of different options. In the old build system
some of the package selections were possible by using special make target like some of the package selections were possible by using special make target like
`make yes-std` or `make no-lib`. Achieving the same result with cmake requires `make yes-std` or `make no-lib`. Achieving a similar result with cmake requires
specifying all options manually. This can quickly become a very long command specifying all options manually. This can quickly become a very long command
line that is hard to handle. While these could be stored in a simple script line that is hard to handle. While these could be stored in a simple script
file, there is another way of defining "presets" to compile LAMMPS in a certain file, there is another way of defining "presets" to compile LAMMPS in a certain
way. way. Since the cmake build process - contrary to the conventional build system -
includes the compilation of the bundled libraries into the standard build process,
the grouping of those presets is somewhat different.
A preset is a regular CMake script file that can use constructs such as A preset is a regular CMake script file that can use constructs such as
variables, lists and for-loops to manipulate configuration options and create variables, lists and for-loops to manipulate configuration options and create
@ -171,10 +173,10 @@ Such a file can then be passed to cmake via the `-C` flag. Several examples of
presets can be found in the `cmake/presets` folder. presets can be found in the `cmake/presets` folder.
```bash ```bash
# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package # build LAMMPS with all packages enabled which don't use external libraries and enable GPU package
mkdir build mkdir build
cd build cd build
cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake cmake -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on ../cmake
``` ```
# Reference # Reference
@ -1429,6 +1431,17 @@ TODO
</dl> </dl>
</td> </td>
</tr> </tr>
<tr>
<td><code>INTEL_LRT_MODE</code></td>
<td>How to support Long-range thread mode in Verlet integration</td>
<td>
<dl>
<dt><code>threads</code> (default, if pthreads available)</dt>
<dt><code>none</code> (default, if pthreads not available)</dt>
<dt><code>c++11</code></dt>
</dl>
</td>
</tr>
</tbody> </tbody>
</table> </table>

View File

@ -1,21 +1,17 @@
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU # preset that turns on all existing packages off. can be used to reset
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC # an existing package selection without losing any other settings
MOLECULE MPIIO MSCG OPT PERI POEMS
PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI)
set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO
USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE VORONOI
USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK
USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-UEF USER-VTK) USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP
USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK) USER-TALLY USER-UEF USER-VTK USER-YAFF)
set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES})
foreach(PKG ${ALL_PACKAGES}) foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} OFF CACHE BOOL "" FORCE) set(PKG_${PKG} OFF CACHE BOOL "" FORCE)

View File

@ -1,21 +1,19 @@
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU # preset that turns on all existing packages. using the combination
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC # this preset followed by the nolib.cmake preset should configure a
MOLECULE MPIIO MSCG OPT PERI POEMS # LAMMPS binary, with as many packages included, that can be compiled
PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) # with just a working C++ compiler and an MPI library.
set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO
USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE VORONOI
USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK
USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-UEF USER-VTK) USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP
USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK) USER-TALLY USER-UEF USER-VTK USER-YAFF)
set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES})
foreach(PKG ${ALL_PACKAGES}) foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE) set(PKG_${PKG} ON CACHE BOOL "" FORCE)

View File

@ -1,71 +0,0 @@
set(PKG_ASPHERE OFF CACHE BOOL "" FORCE)
set(PKG_BODY OFF CACHE BOOL "" FORCE)
set(PKG_CLASS2 OFF CACHE BOOL "" FORCE)
set(PKG_COLLOID OFF CACHE BOOL "" FORCE)
set(PKG_COMPRESS OFF CACHE BOOL "" FORCE)
set(PKG_CORESHELL OFF CACHE BOOL "" FORCE)
set(PKG_DIPOLE OFF CACHE BOOL "" FORCE)
set(PKG_GPU OFF CACHE BOOL "" FORCE)
set(PKG_GRANULAR OFF CACHE BOOL "" FORCE)
set(PKG_KIM OFF CACHE BOOL "" FORCE)
set(PKG_KOKKOS OFF CACHE BOOL "" FORCE)
set(PKG_KSPACE OFF CACHE BOOL "" FORCE)
set(PKG_LATTE OFF CACHE BOOL "" FORCE)
set(PKG_LIB OFF CACHE BOOL "" FORCE)
set(PKG_MANYBODY OFF CACHE BOOL "" FORCE)
set(PKG_MC OFF CACHE BOOL "" FORCE)
set(PKG_MEAM OFF CACHE BOOL "" FORCE)
set(PKG_MISC OFF CACHE BOOL "" FORCE)
set(PKG_MOLECULE OFF CACHE BOOL "" FORCE)
set(PKG_MPIIO OFF CACHE BOOL "" FORCE)
set(PKG_MSCG OFF CACHE BOOL "" FORCE)
set(PKG_OPT OFF CACHE BOOL "" FORCE)
set(PKG_PERI OFF CACHE BOOL "" FORCE)
set(PKG_POEMS OFF CACHE BOOL "" FORCE)
set(PKG_PYTHOFF OFF CACHE BOOL "" FORCE)
set(PKG_QEQ OFF CACHE BOOL "" FORCE)
set(PKG_REAX OFF CACHE BOOL "" FORCE)
set(PKG_REPLICA OFF CACHE BOOL "" FORCE)
set(PKG_RIGID OFF CACHE BOOL "" FORCE)
set(PKG_SHOCK OFF CACHE BOOL "" FORCE)
set(PKG_SNAP OFF CACHE BOOL "" FORCE)
set(PKG_SRD OFF CACHE BOOL "" FORCE)
set(PKG_VOROFFOI OFF CACHE BOOL "" FORCE)
set(PKG_USER OFF CACHE BOOL "" FORCE)
set(PKG_USER-ATC OFF CACHE BOOL "" FORCE)
set(PKG_USER-AWPMD OFF CACHE BOOL "" FORCE)
set(PKG_USER-BOCS OFF CACHE BOOL "" FORCE)
set(PKG_USER-CGDNA OFF CACHE BOOL "" FORCE)
set(PKG_USER-CGSDK OFF CACHE BOOL "" FORCE)
set(PKG_USER-COLVARS OFF CACHE BOOL "" FORCE)
set(PKG_USER-DIFFRACTIOFF OFF CACHE BOOL "" FORCE)
set(PKG_USER-DPD OFF CACHE BOOL "" FORCE)
set(PKG_USER-DRUDE OFF CACHE BOOL "" FORCE)
set(PKG_USER-EFF OFF CACHE BOOL "" FORCE)
set(PKG_USER-FEP OFF CACHE BOOL "" FORCE)
set(PKG_USER-H5MD OFF CACHE BOOL "" FORCE)
set(PKG_USER-INTEL OFF CACHE BOOL "" FORCE)
set(PKG_USER-LB OFF CACHE BOOL "" FORCE)
set(PKG_USER-MANIFOLD OFF CACHE BOOL "" FORCE)
set(PKG_USER-MEAMC OFF CACHE BOOL "" FORCE)
set(PKG_USER-MESO OFF CACHE BOOL "" FORCE)
set(PKG_USER-MGPT OFF CACHE BOOL "" FORCE)
set(PKG_USER-MISC OFF CACHE BOOL "" FORCE)
set(PKG_USER-MOFFF OFF CACHE BOOL "" FORCE)
set(PKG_USER-MOLFILE OFF CACHE BOOL "" FORCE)
set(PKG_USER-NETCDF OFF CACHE BOOL "" FORCE)
set(PKG_USER-OMP OFF CACHE BOOL "" FORCE)
set(PKG_USER-PHONON OFF CACHE BOOL "" FORCE)
set(PKG_USER-PLUMED OFF CACHE BOOL "" FORCE)
set(PKG_USER-QMMM OFF CACHE BOOL "" FORCE)
set(PKG_USER-QTB OFF CACHE BOOL "" FORCE)
set(PKG_USER-QUIP OFF CACHE BOOL "" FORCE)
set(PKG_USER-REAXC OFF CACHE BOOL "" FORCE)
set(PKG_USER-SDPD OFF CACHE BOOL "" FORCE)
set(PKG_USER-SMD OFF CACHE BOOL "" FORCE)
set(PKG_USER-SMTBQ OFF CACHE BOOL "" FORCE)
set(PKG_USER-SPH OFF CACHE BOOL "" FORCE)
set(PKG_USER-TALLY OFF CACHE BOOL "" FORCE)
set(PKG_USER-UEF OFF CACHE BOOL "" FORCE)
set(PKG_USER-VTK OFF CACHE BOOL "" FORCE)

View File

@ -0,0 +1,17 @@
set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS QEQ
REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI USER-ATC USER-AWPMD
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD
USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE USER-OMP
USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SDPD USER-SMD
USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-YAFF)
foreach(PKG ${WIN_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE)
set(INTEL_LRT_MODE "none" CACHE STRING "" FORCE)

View File

@ -0,0 +1,8 @@
# preset that turns on just a few, frequently used packages
# this will be compiled quickly and handle a lot of common inputs.
set(ALL_PACKAGES KSPACE MANYBODY MOLECULE RIGID)
foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()

15
cmake/presets/most.cmake Normal file
View File

@ -0,0 +1,15 @@
# preset that turns on a wide range of packages, some of which require
# external libraries. Compared to all_on.cmake some more unusual packages
# are removed. The resulting binary should be able to run most inputs.
set(ALL_PACKAGES ASPHERE CLASS2 COLLOID CORESHELL DIPOLE
GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI
PYTHON QEQ REPLICA RIGID SHOCK SRD VORONOI
USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD
USER-DRUDE USER-FEP USER-MEAMC USER-MESO
USER-MISC USER-MOFFF USER-OMP USER-PLUMED USER-PHONON USER-REAXC
USER-SPH USER-SMD USER-UEF USER-YAFF)
foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()

View File

@ -1,21 +1,10 @@
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU # preset that turns off all packages that require some form of external
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC # library or special compiler (fortran or cuda) or equivalent.
MOLECULE MPIIO MSCG OPT PERI POEMS
PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI)
set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MPIIO MSCG PYTHON
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-LB
USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-SMD USER-VTK)
USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB
USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY
USER-UEF USER-VTK)
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI
USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE
USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK)
set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES})
foreach(PKG ${PACKAGES_WITH_LIB}) foreach(PKG ${PACKAGES_WITH_LIB})
set(PKG_${PKG} OFF CACHE BOOL "" FORCE) set(PKG_${PKG} OFF CACHE BOOL "" FORCE)

View File

@ -1,22 +0,0 @@
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC
MOLECULE MPIIO MSCG OPT PERI POEMS
PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI)
set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE
USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB
USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY
USER-UEF USER-VTK)
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI
USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE
USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK)
set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES})
foreach(PKG ${STANDARD_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()

View File

@ -1,26 +0,0 @@
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC
MOLECULE MPIIO MSCG OPT PERI POEMS
PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI)
set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE
USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB
USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY
USER-UEF USER-VTK)
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI
USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE
USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK)
set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES})
foreach(PKG ${STANDARD_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()
foreach(PKG ${PACKAGES_WITH_LIB})
set(PKG_${PKG} OFF CACHE BOOL "" FORCE)
endforeach()

View File

@ -1,22 +0,0 @@
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC
MOLECULE MPIIO MSCG OPT PERI POEMS
PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI)
set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO
USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE
USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB
USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY
USER-UEF USER-VTK)
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI
USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE
USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK)
set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES})
foreach(PKG ${USER_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()

View File

@ -28,7 +28,7 @@ Makefile(s). Example:
cd lammps # change to the LAMMPS distribution directory cd lammps # change to the LAMMPS distribution directory
mkdir build; cd build # create a new directory (folder) for build mkdir build; cd build # create a new directory (folder) for build
cmake ../cmake \[options ...\] # configuration with (command-line) cmake cmake \[options ...\] ../cmake # configuration with (command-line) cmake
make # compilation :pre make # compilation :pre
The cmake command will detect available features, enable selected The cmake command will detect available features, enable selected
@ -41,7 +41,8 @@ If your machine has multiple CPU cores (most do these days), using a
command like "make -jN" (with N being the number of available local command like "make -jN" (with N being the number of available local
CPU cores) can be much faster. If you plan to do development on CPU cores) can be much faster. If you plan to do development on
LAMMPS or need to re-compile LAMMPS repeatedly, installation of the LAMMPS or need to re-compile LAMMPS repeatedly, installation of the
ccache (= Compiler Cache) software may speed up compilation even more. ccache (= Compiler Cache) software may speed up repeated compilation
even more.
After compilation, you can optionally copy the LAMMPS executable and After compilation, you can optionally copy the LAMMPS executable and
library into your system folders (by default under $HOME/.local) with: library into your system folders (by default under $HOME/.local) with:
@ -108,7 +109,8 @@ command-line options. Several useful ones are:
-D CMAKE_BUILD_TYPE=type # type = Release or Debug -D CMAKE_BUILD_TYPE=type # type = Release or Debug
-G output # style of output CMake generates -G output # style of output CMake generates
-DVARIABLE=value # setting for a LAMMPS feature to enable -DVARIABLE=value # setting for a LAMMPS feature to enable
-D VARIABLE=value # ditto, but cannot come after CMakeLists.txt dir :pre -D VARIABLE=value # ditto, but cannot come after CMakeLists.txt dir
-C path/to/preset/file # load some CMake settings before configuring :pre
All the LAMMPS-specific -D variables that a LAMMPS build supports are All the LAMMPS-specific -D variables that a LAMMPS build supports are
described on the pages linked to from the "Build"_Build.html doc page. described on the pages linked to from the "Build"_Build.html doc page.

View File

@ -859,23 +859,34 @@ file.
USER-INTEL package :h4,link(user-intel) USER-INTEL package :h4,link(user-intel)
To build with this package, you must choose which hardware you want to To build with this package, you must choose which hardware you want to
build for, either Intel CPUs or Intel KNLs. You should also typically build for, either x86 CPUs or Intel KNLs in offload mode. You should
"install the USER-OMP package"_#user-omp, as it can be used in tandem also typically "install the USER-OMP package"_#user-omp, as it can be
with the USER-INTEL package to good effect, as explained on the "Speed used in tandem with the USER-INTEL package to good effect, as explained
intel"_Speed_intel.html doc page. on the "Speed intel"_Speed_intel.html doc page.
[CMake build]: [CMake build]:
-D INTEL_ARCH=value # value = cpu (default) or knl -D INTEL_ARCH=value # value = cpu (default) or knl
-D BUILD_OMP=yes # also required to build with the USER-INTEl package :pre -D INTEL_LRT_MODE=value # value = threads, none, or c++11 :pre
Requires an Intel compiler as well as the Intel TBB and MKL libraries. In Long-range thread mode (LRT) a modified verlet style is used, that
operates the Kspace calculation in a separate thread concurrently to
other calculations. This has to be enabled in the "package intel"_package.html
command at runtime. With the setting "threads" it used the pthreads
library, while c++11 will use the built-in thread support of C++11
compilers. The option "none" skips compilation of this feature. The
default is to use "threads" if pthreads is available and otherwise "none".
Best performance is achieved with Intel hardware, Intel compilers, as well as
the Intel TBB and MKL libraries. However, the code also compiles, links, and
runs with other compilers and without TBB and MKL.
[Traditional make]: [Traditional make]:
Choose which hardware to compile for in Makefile.machine via the Choose which hardware to compile for in Makefile.machine via the
following settings. See src/MAKE/OPTIONS/Makefile.intel_cpu* and following settings. See src/MAKE/OPTIONS/Makefile.intel_cpu* and
Makefile.knl files for examples. Makefile.knl files for examples. and src/USER-INTEL/README for
additional information.
For CPUs: For CPUs:

View File

@ -149,26 +149,39 @@ system. Using these files you can enable/disable portions of the
available packages in LAMMPS. If you need a custom preset you can take available packages in LAMMPS. If you need a custom preset you can take
one of them as a starting point and customize it to your needs. one of them as a starting point and customize it to your needs.
cmake -C ../cmake/presets/all_on.cmake \[OPTIONS\] ../cmake | enable all packages cmake -C ../cmake/presets/all_on.cmake \[OPTIONS\] ../cmake |
cmake -C ../cmake/presets/all_off.cmake \[OPTIONS\] ../cmake | disable all packages enable all packages |
cmake -C ../cmake/presets/std.cmake \[OPTIONS\] ../cmake | enable standard packages cmake -C ../cmake/presets/all_off.cmake \[OPTIONS\] ../cmake |
cmake -C ../cmake/presets/user.cmake \[OPTIONS\] ../cmake | enable user packages disable all packages |
cmake -C ../cmake/presets/std_nolib.cmake \[OPTIONS\] ../cmake | enable standard packages that do not require extra libraries cmake -C ../cmake/presets/minimal.cmake \[OPTIONS\] ../cmake |
cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake | disable all packages that do not require extra libraries enable just a few core packages |
cmake -C ../cmake/presets/manual_selection.cmake \[OPTIONS\] ../cmake | example of how to create a manual selection of packages :tb(s=|,a=l) cmake -C ../cmake/presets/most.cmake \[OPTIONS\] ../cmake |
enable most common packages |
cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake |
disable packages that do require extra libraries or tools |
cmake -C ../cmake/presets/mingw.cmake \[OPTIONS\] ../cmake |
enable all packages compatible with MinGW compilers :tb(c=2,s=|,a=l)
NOTE: Running cmake this way manipulates the variable cache in your NOTE: Running cmake this way manipulates the variable cache in your
current build directory. You can combine presets and options with current build directory. You can combine multiple presets and options
multiple cmake runs. in a single cmake run, or change settings incrementally by running
cmake with new flags.
[Example:] [Example:]
# build LAMMPS with all "standard" packages which don't # build LAMMPS with most commonly used packages, but then remove
# use libraries and enable GPU package # those requiring additional library or tools, but still enable
# GPU package and configure it for using CUDA. You can run.
mkdir build mkdir build
cd build cd build
cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake :pre cmake -C ../cmake/presets/most.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on -D GPU_API=cuda ../cmake :pre
# to add another package, say BODY to the previous configuration you can run:
cmake -D PKG_BODY=on . :pre
# to reset the package selection from above to the default of no packages
# but leaving all other settings untouched. You can run:
cmake -C ../cmake/presets/no_all.cmake . :pre
:line :line
[Make shortcuts for installing many packages]: [Make shortcuts for installing many packages]:

View File

@ -179,8 +179,11 @@ e.g. from 511 to -512, which can cause diagnostics like the
mean-squared displacement, as calculated by the "compute mean-squared displacement, as calculated by the "compute
msd"_compute_msd.html command, to be faulty. msd"_compute_msd.html command, to be faulty.
Note that the USER-ATC package is not currently compatible with the Note that the USER-ATC package and the USER-INTEL package are currently
"bigbig" setting. not compatible with the "bigbig" setting. Also, there are limitations
when using the library interface. Some functions with known issues
have been replaced by dummy calls printing a corresponding error rather
than crashing randomly or corrupting data.
Also note that the GPU package requires its lib/gpu library to be Also note that the GPU package requires its lib/gpu library to be
compiled with the same size setting, or the link will fail. A CMake compiled with the same size setting, or the link will fail. A CMake

View File

@ -51,11 +51,10 @@ provides a unix/linux interface to low-level Windows functions, so LAMMPS
can be compiled on Windows. The necessary (minor) modifications to LAMMPS can be compiled on Windows. The necessary (minor) modifications to LAMMPS
are included, but may not always up-to-date for recently added functionality are included, but may not always up-to-date for recently added functionality
and the corresponding new code. A machine makefile for using cygwin for and the corresponding new code. A machine makefile for using cygwin for
the old build system is provided. The CMake build system is untested the old build system is provided. Using CMake for this mode of compilation
for this; you will have to request that makefiles are generated and is untested and not likely to work.
manually set the compiler.
When compiling for Windows [not] set the -DLAMMPS_MEMALIGN define When compiling for Windows do [not] set the -DLAMMPS_MEMALIGN define
in the LMP_INC makefile variable and add -lwsock32 -lpsapi to the linker in the LMP_INC makefile variable and add -lwsock32 -lpsapi to the linker
flags in LIB makefile variable. Try adding -static-libgcc or -static or flags in LIB makefile variable. Try adding -static-libgcc or -static or
both to the linker flags when your resulting LAMMPS Windows executable both to the linker flags when your resulting LAMMPS Windows executable
@ -79,7 +78,13 @@ probably the currently best tested and supported way to build LAMMPS
executables for Windows. There are makefiles provided for the executables for Windows. There are makefiles provided for the
traditional build system, but CMake has also been successfully tested traditional build system, but CMake has also been successfully tested
using the mingw32-cmake and mingw64-cmake wrappers that are bundled using the mingw32-cmake and mingw64-cmake wrappers that are bundled
with the cross-compiler environment on Fedora machines. with the cross-compiler environment on Fedora machines. A CMake preset
selecting all packages compatible with this cross-compilation build
is provided. You likely need to disable the GPU package unless you
download and install the contents of the pre-compiled "OpenCL ICD loader
library"_https://download.lammps.org/thirdparty/opencl-win-devel.tar.gz
into your MinGW64 cross-compiler environment. The cross-compilation
currently will only produce non-MPI serial binaries.
Please keep in mind, though, that this only applies to compiling LAMMPS. Please keep in mind, though, that this only applies to compiling LAMMPS.
Whether the resulting binaries do work correctly is no tested by the Whether the resulting binaries do work correctly is no tested by the

View File

@ -98,6 +98,7 @@ OPT.
"gran/hertz/history (o)"_pair_gran.html, "gran/hertz/history (o)"_pair_gran.html,
"gran/hooke (o)"_pair_gran.html, "gran/hooke (o)"_pair_gran.html,
"gran/hooke/history (ko)"_pair_gran.html, "gran/hooke/history (ko)"_pair_gran.html,
"granular"_pair_granular.html,
"gw"_pair_gw.html, "gw"_pair_gw.html,
"gw/zbl"_pair_gw.html, "gw/zbl"_pair_gw.html,
"hbond/dreiding/lj (o)"_pair_hbond_dreiding.html, "hbond/dreiding/lj (o)"_pair_hbond_dreiding.html,

View File

@ -166,9 +166,6 @@ void lammps_gather_atoms_subset(void *, char *, int, int, int, int *, void *)
void lammps_scatter_atoms(void *, char *, int, int, void *) void lammps_scatter_atoms(void *, char *, int, int, void *)
void lammps_scatter_atoms_subset(void *, char *, int, int, int, int *, void *) :pre void lammps_scatter_atoms_subset(void *, char *, int, int, int, int *, void *) :pre
void lammps_create_atoms(void *, int, tagint *, int *, double *, double *,
imageint *, int) :pre
The gather functions collect peratom info of the requested type (atom The gather functions collect peratom info of the requested type (atom
coords, atom types, forces, etc) from all processors, and returns the coords, atom types, forces, etc) from all processors, and returns the
same vector of values to each calling processor. The scatter same vector of values to each calling processor. The scatter
@ -176,6 +173,11 @@ functions do the inverse. They distribute a vector of peratom values,
passed by all calling processors, to individual atoms, which may be passed by all calling processors, to individual atoms, which may be
owned by different processors. owned by different processors.
IMPORTANT NOTE: These functions are not compatible with the
-DLAMMPS_BIGBIG setting when compiling LAMMPS. Dummy functions
that result in an error message and abort will be substituted
instead of resulting in random crashes and memory corruption.
The lammps_gather_atoms() function does this for all N atoms in the The lammps_gather_atoms() function does this for all N atoms in the
system, ordered by atom ID, from 1 to N. The system, ordered by atom ID, from 1 to N. The
lammps_gather_atoms_concat() function does it for all N atoms, but lammps_gather_atoms_concat() function does it for all N atoms, but
@ -196,6 +198,9 @@ those values to each atom in the system. The
lammps_scatter_atoms_subset() function takes a subset of IDs as an lammps_scatter_atoms_subset() function takes a subset of IDs as an
argument and only scatters those values to the owning atoms. argument and only scatters those values to the owning atoms.
void lammps_create_atoms(void *, int, tagint *, int *, double *, double *,
imageint *, int) :pre
The lammps_create_atoms() function takes a list of N atoms as input The lammps_create_atoms() function takes a list of N atoms as input
with atom types and coords (required), an optionally atom IDs and with atom types and coords (required), an optionally atom IDs and
velocities and image flags. It uses the coords of each atom to assign velocities and image flags. It uses the coords of each atom to assign

View File

@ -24,7 +24,7 @@ LAMMPS to run on the CPU cores and co-processor cores simultaneously.
Angle Styles: charmm, harmonic :ulb,l Angle Styles: charmm, harmonic :ulb,l
Bond Styles: fene, fourier, harmonic :l Bond Styles: fene, fourier, harmonic :l
Dihedral Styles: charmm, harmonic, opls :l Dihedral Styles: charmm, fourier, harmonic, opls :l
Fixes: nve, npt, nvt, nvt/sllod, nve/asphere :l Fixes: nve, npt, nvt, nvt/sllod, nve/asphere :l
Improper Styles: cvff, harmonic :l Improper Styles: cvff, harmonic :l
Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long, Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long,

View File

@ -29,9 +29,10 @@ through a web query. The result is stored in a string style
argument of the kim_query command. The second required argument is the argument of the kim_query command. The second required argument is the
name of the actual query function (e.g. {get_test_result}). All following name of the actual query function (e.g. {get_test_result}). All following
arguments are parameters handed over to the web query in the format arguments are parameters handed over to the web query in the format
{keyword=value}. This list of supported keywords and the type of how {keyword=value}. The list of supported keywords and the type of how
the value has to be encoded depends on the query function used. the value has to be encoded depends on the query function used. This
For more details on this, please refer to the OpenKIM homepage. mirrors the functionality available on the OpenKIM webpage at
"https://query.openkim.org"_https://query.openkim.org/
[Restrictions:] [Restrictions:]

View File

@ -19,7 +19,7 @@ pair_style granular command :h3
pair_style granular cutoff :pre pair_style granular cutoff :pre
cutoff = global cutoff (optional). See discussion below. :l cutoff = global cutoff (optional). See discussion below. :ul
[Examples:] [Examples:]

View File

@ -134,7 +134,7 @@ The {mom} and {rot} keywords are used by {create}. If mom = yes, the
linear momentum of the newly created ensemble of velocities is zeroed; linear momentum of the newly created ensemble of velocities is zeroed;
if rot = yes, the angular momentum is zeroed. if rot = yes, the angular momentum is zeroed.
*line :line
If specified, the {temp} keyword is used by {create} and {scale} to If specified, the {temp} keyword is used by {create} and {scale} to
specify a "compute"_compute.html that calculates temperature in a specify a "compute"_compute.html that calculates temperature in a

View File

@ -36,6 +36,10 @@
#include "atom_kokkos.h" #include "atom_kokkos.h"
#include "kokkos.h" #include "kokkos.h"
#ifdef _OPENMP
#include <omp.h>
#endif
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
using namespace MathSpecialKokkos; using namespace MathSpecialKokkos;

View File

@ -200,7 +200,11 @@ int MPI_Request_free(MPI_Request *request)
int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int MPI_Send(const void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm) int dest, int tag, MPI_Comm comm)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not send message to self\n"); printf("MPI Stub WARNING: Should not send message to self\n");
++callcount;
}
return 0; return 0;
} }
@ -209,7 +213,11 @@ int MPI_Send(const void *buf, int count, MPI_Datatype datatype,
int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int MPI_Isend(const void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request) int source, int tag, MPI_Comm comm, MPI_Request *request)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not send message to self\n"); printf("MPI Stub WARNING: Should not send message to self\n");
++callcount;
}
return 0; return 0;
} }
@ -218,7 +226,11 @@ int MPI_Isend(const void *buf, int count, MPI_Datatype datatype,
int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype, int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm) int dest, int tag, MPI_Comm comm)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not rsend message to self\n"); printf("MPI Stub WARNING: Should not rsend message to self\n");
++callcount;
}
return 0; return 0;
} }
@ -227,7 +239,11 @@ int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype,
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int MPI_Recv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Status *status) int source, int tag, MPI_Comm comm, MPI_Status *status)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not recv message from self\n"); printf("MPI Stub WARNING: Should not recv message from self\n");
++callcount;
}
return 0; return 0;
} }
@ -236,7 +252,11 @@ int MPI_Recv(void *buf, int count, MPI_Datatype datatype,
int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request) int source, int tag, MPI_Comm comm, MPI_Request *request)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not recv message from self\n"); printf("MPI Stub WARNING: Should not recv message from self\n");
++callcount;
}
return 0; return 0;
} }
@ -244,7 +264,11 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
int MPI_Wait(MPI_Request *request, MPI_Status *status) int MPI_Wait(MPI_Request *request, MPI_Status *status)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not wait on message from self\n"); printf("MPI Stub WARNING: Should not wait on message from self\n");
++callcount;
}
return 0; return 0;
} }
@ -252,7 +276,11 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status)
int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status) int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not wait on message from self\n"); printf("MPI Stub WARNING: Should not wait on message from self\n");
++callcount;
}
return 0; return 0;
} }
@ -261,7 +289,11 @@ int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status)
int MPI_Waitany(int count, MPI_Request *request, int *index, int MPI_Waitany(int count, MPI_Request *request, int *index,
MPI_Status *status) MPI_Status *status)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not wait on message from self\n"); printf("MPI Stub WARNING: Should not wait on message from self\n");
++callcount;
}
return 0; return 0;
} }
@ -272,7 +304,11 @@ int MPI_Sendrecv(const void *sbuf, int scount, MPI_Datatype sdatatype,
MPI_Datatype rdatatype, int source, int rtag, MPI_Datatype rdatatype, int source, int rtag,
MPI_Comm comm, MPI_Status *status) MPI_Comm comm, MPI_Status *status)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not send message to self\n"); printf("MPI Stub WARNING: Should not send message to self\n");
++callcount;
}
return 0; return 0;
} }
@ -280,7 +316,11 @@ int MPI_Sendrecv(const void *sbuf, int scount, MPI_Datatype sdatatype,
int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count)
{ {
static int callcount=0;
if (callcount == 0) {
printf("MPI Stub WARNING: Should not get count of message to self\n"); printf("MPI Stub WARNING: Should not get count of message to self\n");
++callcount;
}
return 0; return 0;
} }

View File

@ -88,6 +88,7 @@
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include "ptm_polar.h"
#include "ptm_quat.h" #include "ptm_quat.h"

View File

@ -801,6 +801,17 @@ void lammps_reset_box(void *ptr, double *boxlo, double *boxhi,
Allreduce to sum vector into data across all procs Allreduce to sum vector into data across all procs
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#if defined(LAMMPS_BIGBIG)
void lammps_gather_atoms(void *ptr, char * /*name */,
int /*type*/, int /*count*/, void * /*data*/)
{
LAMMPS *lmp = (LAMMPS *) ptr;
BEGIN_CAPTURE
lmp->error->all(FLERR,"Library function lammps_gather_atoms() not compatible with -DLAMMPS_BIGBIG");
END_CAPTURE
}
#else
void lammps_gather_atoms(void *ptr, char *name, void lammps_gather_atoms(void *ptr, char *name,
int type, int count, void *data) int type, int count, void *data)
{ {
@ -905,6 +916,7 @@ void lammps_gather_atoms(void *ptr, char *name,
} }
END_CAPTURE END_CAPTURE
} }
#endif
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
gather the named atom-based entity for all atoms gather the named atom-based entity for all atoms
@ -927,6 +939,17 @@ void lammps_gather_atoms(void *ptr, char *name,
Allgather Nlocal atoms from each proc into data Allgather Nlocal atoms from each proc into data
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#if defined(LAMMPS_BIGBIG)
void lammps_gather_atoms_concat(void *ptr, char * /*name */,
int /*type*/, int /*count*/, void * /*data*/)
{
LAMMPS *lmp = (LAMMPS *) ptr;
BEGIN_CAPTURE
lmp->error->all(FLERR,"Library function lammps_gather_atoms_concat() not compatible with -DLAMMPS_BIGBIG");
END_CAPTURE
}
#else
void lammps_gather_atoms_concat(void *ptr, char *name, void lammps_gather_atoms_concat(void *ptr, char *name,
int type, int count, void *data) int type, int count, void *data)
{ {
@ -1047,6 +1070,7 @@ void lammps_gather_atoms_concat(void *ptr, char *name,
} }
END_CAPTURE END_CAPTURE
} }
#endif
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
gather the named atom-based entity for a subset of atoms gather the named atom-based entity for a subset of atoms
@ -1071,6 +1095,18 @@ void lammps_gather_atoms_concat(void *ptr, char *name,
Allreduce to sum vector into data across all procs Allreduce to sum vector into data across all procs
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#if defined(LAMMPS_BIGBIG)
void lammps_gather_atoms_subset(void *ptr, char * /*name */,
int /*type*/, int /*count*/,
int /*ndata*/, int * /*ids*/, void * /*data*/)
{
LAMMPS *lmp = (LAMMPS *) ptr;
BEGIN_CAPTURE
lmp->error->all(FLERR,"Library function lammps_gather_atoms_subset() not compatible with -DLAMMPS_BIGBIG");
END_CAPTURE
}
#else
void lammps_gather_atoms_subset(void *ptr, char *name, void lammps_gather_atoms_subset(void *ptr, char *name,
int type, int count, int type, int count,
int ndata, int *ids, void *data) int ndata, int *ids, void *data)
@ -1188,6 +1224,7 @@ void lammps_gather_atoms_subset(void *ptr, char *name,
} }
END_CAPTURE END_CAPTURE
} }
#endif
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
scatter the named atom-based entity in data to all atoms scatter the named atom-based entity in data to all atoms
@ -1205,6 +1242,17 @@ void lammps_gather_atoms_subset(void *ptr, char *name,
loop over Natoms, if I own atom ID, set its values from data loop over Natoms, if I own atom ID, set its values from data
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#if defined(LAMMPS_BIGBIG)
void lammps_scatter_atoms(void *ptr, char * /*name */,
int /*type*/, int /*count*/, void * /*data*/)
{
LAMMPS *lmp = (LAMMPS *) ptr;
BEGIN_CAPTURE
lmp->error->all(FLERR,"Library function lammps_scatter_atoms() not compatible with -DLAMMPS_BIGBIG");
END_CAPTURE
}
#else
void lammps_scatter_atoms(void *ptr, char *name, void lammps_scatter_atoms(void *ptr, char *name,
int type, int count, void *data) int type, int count, void *data)
{ {
@ -1299,6 +1347,7 @@ void lammps_scatter_atoms(void *ptr, char *name,
} }
END_CAPTURE END_CAPTURE
} }
#endif
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
scatter the named atom-based entity in data to a subset of atoms scatter the named atom-based entity in data to a subset of atoms
@ -1318,6 +1367,18 @@ void lammps_scatter_atoms(void *ptr, char *name,
loop over Ndata, if I own atom ID, set its values from data loop over Ndata, if I own atom ID, set its values from data
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#if defined(LAMMPS_BIGBIG)
void lammps_scatter_atoms_subset(void *ptr, char * /*name */,
int /*type*/, int /*count*/,
int /*ndata*/, int * /*ids*/, void * /*data*/)
{
LAMMPS *lmp = (LAMMPS *) ptr;
BEGIN_CAPTURE
lmp->error->all(FLERR,"Library function lammps_scatter_atoms_subset() not compatible with -DLAMMPS_BIGBIG");
END_CAPTURE
}
#else
void lammps_scatter_atoms_subset(void *ptr, char *name, void lammps_scatter_atoms_subset(void *ptr, char *name,
int type, int count, int type, int count,
int ndata, int *ids, void *data) int ndata, int *ids, void *data)
@ -1420,6 +1481,7 @@ void lammps_scatter_atoms_subset(void *ptr, char *name,
} }
END_CAPTURE END_CAPTURE
} }
#endif
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create N atoms and assign them to procs based on coords create N atoms and assign them to procs based on coords

View File

@ -24,14 +24,13 @@
inline double pow(int i, int j){ inline double pow(int i, int j){
return pow((double)i,j); return pow((double)i,j);
} }
#endif
inline double sqrt(int i){
return sqrt((double) i);
}
inline double fabs(int i){ inline double fabs(int i){
return fabs((double) i); return fabs((double) i);
} }
inline double sqrt(int i){
return sqrt((double) i);
}
#endif
inline double trunc(double x) { inline double trunc(double x) {
return x > 0 ? floor(x) : ceil(x); return x > 0 ? floor(x) : ceil(x);

View File

@ -26,7 +26,7 @@
#endif #endif
#endif #endif
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) #if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#define LAMMPS_MEMALIGN 64 #define LAMMPS_MEMALIGN 64
#endif #endif

View File

@ -48,7 +48,7 @@ methods:
#ifndef LAMMPS_MY_PAGE_H #ifndef LAMMPS_MY_PAGE_H
#define LAMMPS_MY_PAGE_H #define LAMMPS_MY_PAGE_H
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) #if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#define LAMMPS_MEMALIGN 64 #define LAMMPS_MEMALIGN 64
#endif #endif