diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c15011b2af..59caf8ca9f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -322,7 +322,7 @@ pkg_depends(USER-SCAFACOS MPI) find_package(OpenMP QUIET) 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) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_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) 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") include(ExternalProject) ExternalProject_Add(plumed_build @@ -568,9 +582,11 @@ if(PKG_USER-PLUMED) BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure --prefix= ${CONFIGURE_REQUEST_PIC} - --enable-modules=all - CXX=${CMAKE_MPI_CXX_COMPILER} - CC=${CMAKE_MPI_C_COMPILER} + --enable-modules=all + ${PLUMED_CONFIG_MPI} + ${PLUMED_CONFIG_OMP} + CXX=${PLUMED_CONFIG_CXX} + CC=${PLUMED_CONFIG_CC} ) ExternalProject_get_property(plumed_build 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") add_library(molfile INTERFACE) target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) - target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) + # no need to link with -ldl on windows + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) + endif() list(APPEND LAMMPS_LINK_LIBS molfile) endif() @@ -944,7 +963,7 @@ if(PKG_USER-OMP) # detects styles which have USER-OMP version 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) @@ -1057,37 +1076,79 @@ if(PKG_OPT) endif() if(PKG_USER-INTEL) - find_package(TBB REQUIRED) - find_package(MKL REQUIRED) + if(LAMMPS_SIZES STREQUAL BIGBIG) + message(FATAL_ERROR "The USER-INTEL Package is not compatible with -DLAMMPS_BIGBIG") + endif() + add_definitions(-DLMP_USER_INTEL) - if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler") - endif() + 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(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() - - 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) + 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(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(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_ID STREQUAL "Intel") 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() @@ -1100,33 +1161,33 @@ if(PKG_USER-INTEL) add_compile_options(${_FLAG}) endif() endforeach() + else() + add_compile_options(-O3 -ffast-math) endif() + endif() - add_definitions(-DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG) + # collect sources + set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL) + set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp + ${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp + ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp + ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp + ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp + ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp) - list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES} ${MKL_LIBRARIES}) + set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") - 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 - ${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}/npair_intel.h - ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp - ${USER-INTEL_SOURCES_DIR}/intel_simd.h - ${USER-INTEL_SOURCES_DIR}/intel_intrinsics.h) + # detect styles which have a USER-INTEL version + 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) - set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") + get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) - # detects styles which have USER-INTEL version - RegisterStylesExt(${USER-INTEL_SOURCES_DIR} opt USER-INTEL_SOURCES) - - get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) - - list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) - include_directories(${USER-INTEL_SOURCES_DIR}) + list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) + include_directories(${USER-INTEL_SOURCES_DIR}) endif() if(PKG_GPU) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index a7b23b4cf1..ebaa5dae8e 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -91,6 +91,10 @@ function(RegisterFixStyle path) AddStyleHeader(${path} FIX) endfunction(RegisterFixStyle) +function(RegisterIntegrateStyle path) + AddStyleHeader(${path} INTEGRATE) +endfunction(RegisterIntegrateStyle) + function(RegisterStyles search_path) FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid diff --git a/cmake/README.md b/cmake/README.md index 1c37ecc92e..a635f3e06d 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -155,11 +155,13 @@ make 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 -`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 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 -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 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. ```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 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 @@ -1429,6 +1431,17 @@ TODO + + INTEL_LRT_MODE + How to support Long-range thread mode in Verlet integration + +
+
threads (default, if pthreads available)
+
none (default, if pthreads not available)
+
c++11
+
+ + diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index b434796d7c..0e37611da4 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -1,21 +1,17 @@ -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) +# preset that turns on all existing packages off. can be used to reset +# an existing package selection without losing any other settings -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}) +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO + MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD + VORONOI + USER-ADIOS 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-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP + USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH + USER-TALLY USER-UEF USER-VTK USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 3a1100f337..57f1228abe 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -1,21 +1,19 @@ -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) +# preset that turns on all existing packages. using the combination +# this preset followed by the nolib.cmake preset should configure a +# LAMMPS binary, with as many packages included, that can be compiled +# 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 - 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}) +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO + MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD + VORONOI + USER-ADIOS 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-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP + USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH + USER-TALLY USER-UEF USER-VTK USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) diff --git a/cmake/presets/manual_selection.cmake b/cmake/presets/manual_selection.cmake deleted file mode 100644 index 6db41b708c..0000000000 --- a/cmake/presets/manual_selection.cmake +++ /dev/null @@ -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) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake new file mode 100644 index 0000000000..b53e5a7b93 --- /dev/null +++ b/cmake/presets/mingw-cross.cmake @@ -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) diff --git a/cmake/presets/minimal.cmake b/cmake/presets/minimal.cmake new file mode 100644 index 0000000000..e9ce6d6103 --- /dev/null +++ b/cmake/presets/minimal.cmake @@ -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() diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake new file mode 100644 index 0000000000..35ad7ba55c --- /dev/null +++ b/cmake/presets/most.cmake @@ -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() diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index 4c02fb6210..663f87122b 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -1,21 +1,10 @@ -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) +# preset that turns off all packages that require some form of external +# library or special compiler (fortran or cuda) or equivalent. -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}) +set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MPIIO MSCG PYTHON + VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-LB + USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP + USER-SMD USER-VTK) foreach(PKG ${PACKAGES_WITH_LIB}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/std.cmake b/cmake/presets/std.cmake deleted file mode 100644 index 4176aba44e..0000000000 --- a/cmake/presets/std.cmake +++ /dev/null @@ -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() diff --git a/cmake/presets/std_nolib.cmake b/cmake/presets/std_nolib.cmake deleted file mode 100644 index aa067f2ba0..0000000000 --- a/cmake/presets/std_nolib.cmake +++ /dev/null @@ -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() diff --git a/cmake/presets/user.cmake b/cmake/presets/user.cmake deleted file mode 100644 index af606203e9..0000000000 --- a/cmake/presets/user.cmake +++ /dev/null @@ -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() diff --git a/doc/src/Build_cmake.txt b/doc/src/Build_cmake.txt index 5c29e11280..265c16e3d4 100644 --- a/doc/src/Build_cmake.txt +++ b/doc/src/Build_cmake.txt @@ -28,7 +28,7 @@ Makefile(s). Example: cd lammps # change to the LAMMPS distribution directory 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 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 CPU cores) can be much faster. If you plan to do development on 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 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 -G output # style of output CMake generates -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 described on the pages linked to from the "Build"_Build.html doc page. diff --git a/doc/src/Build_extras.txt b/doc/src/Build_extras.txt index 2aa304faff..17d18243f2 100644 --- a/doc/src/Build_extras.txt +++ b/doc/src/Build_extras.txt @@ -859,23 +859,34 @@ file. USER-INTEL package :h4,link(user-intel) 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 -"install the USER-OMP package"_#user-omp, as it can be used in tandem -with the USER-INTEL package to good effect, as explained on the "Speed -intel"_Speed_intel.html doc page. +build for, either x86 CPUs or Intel KNLs in offload mode. You should +also typically "install the USER-OMP package"_#user-omp, as it can be +used in tandem with the USER-INTEL package to good effect, as explained +on the "Speed intel"_Speed_intel.html doc page. [CMake build]: -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]: Choose which hardware to compile for in Makefile.machine via the 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: diff --git a/doc/src/Build_package.txt b/doc/src/Build_package.txt index c5eca96edb..e37936e052 100644 --- a/doc/src/Build_package.txt +++ b/doc/src/Build_package.txt @@ -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 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_off.cmake \[OPTIONS\] ../cmake | disable all packages -cmake -C ../cmake/presets/std.cmake \[OPTIONS\] ../cmake | enable standard packages -cmake -C ../cmake/presets/user.cmake \[OPTIONS\] ../cmake | enable user packages -cmake -C ../cmake/presets/std_nolib.cmake \[OPTIONS\] ../cmake | enable standard packages that do not require extra libraries -cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake | disable all packages that do not require extra libraries -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/all_on.cmake \[OPTIONS\] ../cmake | + enable all packages | +cmake -C ../cmake/presets/all_off.cmake \[OPTIONS\] ../cmake | + disable all packages | +cmake -C ../cmake/presets/minimal.cmake \[OPTIONS\] ../cmake | + enable just a few core packages | +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 -current build directory. You can combine presets and options with -multiple cmake runs. +current build directory. You can combine multiple presets and options +in a single cmake run, or change settings incrementally by running +cmake with new flags. [Example:] -# build LAMMPS with all "standard" packages which don't -# use libraries and enable GPU package +# build LAMMPS with most commonly used packages, but then remove +# those requiring additional library or tools, but still enable +# GPU package and configure it for using CUDA. You can run. mkdir 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 [Make shortcuts for installing many packages]: diff --git a/doc/src/Build_settings.txt b/doc/src/Build_settings.txt index f1db9f0130..287cd39ff6 100644 --- a/doc/src/Build_settings.txt +++ b/doc/src/Build_settings.txt @@ -57,10 +57,10 @@ FFT_INC = -DFFT_SINGLE # do not specify for double precision FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY :pre # default is FFT_PACK_ARRAY if not specified -FFT_INC = -I/usr/local/include +FFT_INC = -I/usr/local/include FFT_PATH = -L/usr/local/lib -FFT_LIB = -lfftw3 # FFTW3 double precision -FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision +FFT_LIB = -lfftw3 # FFTW3 double precision +FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compier :pre @@ -179,8 +179,11 @@ e.g. from 511 to -512, which can cause diagnostics like the mean-squared displacement, as calculated by the "compute msd"_compute_msd.html command, to be faulty. -Note that the USER-ATC package is not currently compatible with the -"bigbig" setting. +Note that the USER-ATC package and the USER-INTEL package are currently +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 compiled with the same size setting, or the link will fail. A CMake diff --git a/doc/src/Build_windows.txt b/doc/src/Build_windows.txt index bf1ec265a1..b3dbf775c9 100644 --- a/doc/src/Build_windows.txt +++ b/doc/src/Build_windows.txt @@ -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 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 -the old build system is provided. The CMake build system is untested -for this; you will have to request that makefiles are generated and -manually set the compiler. +the old build system is provided. Using CMake for this mode of compilation +is untested and not likely to work. -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 flags in LIB makefile variable. Try adding -static-libgcc or -static or 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 traditional build system, but CMake has also been successfully tested 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. Whether the resulting binaries do work correctly is no tested by the diff --git a/doc/src/Commands_pair.txt b/doc/src/Commands_pair.txt index b18d852c09..e887f0178a 100644 --- a/doc/src/Commands_pair.txt +++ b/doc/src/Commands_pair.txt @@ -98,6 +98,7 @@ OPT. "gran/hertz/history (o)"_pair_gran.html, "gran/hooke (o)"_pair_gran.html, "gran/hooke/history (ko)"_pair_gran.html, +"granular"_pair_granular.html, "gw"_pair_gw.html, "gw/zbl"_pair_gw.html, "hbond/dreiding/lj (o)"_pair_hbond_dreiding.html, diff --git a/doc/src/Howto_library.txt b/doc/src/Howto_library.txt index 40a8bf0a70..ba009cfad9 100644 --- a/doc/src/Howto_library.txt +++ b/doc/src/Howto_library.txt @@ -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_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 coords, atom types, forces, etc) from all processors, and returns the 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 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 system, ordered by atom ID, from 1 to N. The 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 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 with atom types and coords (required), an optionally atom IDs and velocities and image flags. It uses the coords of each atom to assign diff --git a/doc/src/Speed_intel.txt b/doc/src/Speed_intel.txt index dc38cb0956..2688b43e6f 100644 --- a/doc/src/Speed_intel.txt +++ b/doc/src/Speed_intel.txt @@ -24,7 +24,7 @@ LAMMPS to run on the CPU cores and co-processor cores simultaneously. Angle Styles: charmm, harmonic :ulb,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 Improper Styles: cvff, harmonic :l Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long, diff --git a/doc/src/kim_query.txt b/doc/src/kim_query.txt index be46783d82..c581de0ebb 100644 --- a/doc/src/kim_query.txt +++ b/doc/src/kim_query.txt @@ -26,12 +26,13 @@ kim_query latconst get_test_result test=TE_156715955670 model=MO_800509458712 & The kim_query command allows to retrieve properties from the OpenKIM through a web query. The result is stored in a string style "variable"_variable.html, the name of which must be given as the first -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 +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 arguments are parameters handed over to the web query in the format -{keyword=value}. This list of supported keywords and the type of how -the value has to be encoded depends on the query function used. -For more details on this, please refer to the OpenKIM homepage. +{keyword=value}. The list of supported keywords and the type of how +the value has to be encoded depends on the query function used. This +mirrors the functionality available on the OpenKIM webpage at +"https://query.openkim.org"_https://query.openkim.org/ [Restrictions:] diff --git a/doc/src/pair_granular.txt b/doc/src/pair_granular.txt index e4b9bb3250..d287123246 100644 --- a/doc/src/pair_granular.txt +++ b/doc/src/pair_granular.txt @@ -19,7 +19,7 @@ pair_style granular command :h3 pair_style granular cutoff :pre -cutoff = global cutoff (optional). See discussion below. :l +cutoff = global cutoff (optional). See discussion below. :ul [Examples:] diff --git a/doc/src/velocity.txt b/doc/src/velocity.txt index 96d3fa6dc4..decdf2a923 100644 --- a/doc/src/velocity.txt +++ b/doc/src/velocity.txt @@ -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; if rot = yes, the angular momentum is zeroed. -*line +:line If specified, the {temp} keyword is used by {create} and {scale} to specify a "compute"_compute.html that calculates temperature in a diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 973acbbaf4..ce6cae75e4 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -872,16 +872,16 @@ void PairGranular::coeff(int narg, char **arg) if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for twist model"); - twist_model_one = TWIST_SDS; - twist_history = 1; - // kt and gammat and friction coeff - twist_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); - twist_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); - twist_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); - iarg += 5; + twist_model_one = TWIST_SDS; + twist_history = 1; + // kt and gammat and friction coeff + twist_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); + twist_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); + twist_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); + iarg += 5; } else { - error->all(FLERR, "Illegal pair_coeff command, " - "twisting friction model not recognized"); + error->all(FLERR, "Illegal pair_coeff command, " + "twisting friction model not recognized"); } } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index fa10c6d30f..0a6372fdf8 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -36,6 +36,10 @@ #include "atom_kokkos.h" #include "kokkos.h" +#ifdef _OPENMP +#include +#endif + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecialKokkos; diff --git a/src/STUBS/mpi.c b/src/STUBS/mpi.c index 053108fee8..09bb48ecdc 100644 --- a/src/STUBS/mpi.c +++ b/src/STUBS/mpi.c @@ -200,7 +200,11 @@ int MPI_Request_free(MPI_Request *request) int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { - printf("MPI Stub WARNING: Should not send message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not send message to self\n"); + ++callcount; + } 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 source, int tag, MPI_Comm comm, MPI_Request *request) { - printf("MPI Stub WARNING: Should not send message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not send message to self\n"); + ++callcount; + } 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 dest, int tag, MPI_Comm comm) { - printf("MPI Stub WARNING: Should not rsend message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not rsend message to self\n"); + ++callcount; + } 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 source, int tag, MPI_Comm comm, MPI_Status *status) { - printf("MPI Stub WARNING: Should not recv message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not recv message from self\n"); + ++callcount; + } 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 source, int tag, MPI_Comm comm, MPI_Request *request) { - printf("MPI Stub WARNING: Should not recv message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not recv message from self\n"); + ++callcount; + } 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) { - printf("MPI Stub WARNING: Should not wait on message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not wait on message from self\n"); + ++callcount; + } 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) { - printf("MPI Stub WARNING: Should not wait on message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not wait on message from self\n"); + ++callcount; + } 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, MPI_Status *status) { - printf("MPI Stub WARNING: Should not wait on message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not wait on message from self\n"); + ++callcount; + } 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_Comm comm, MPI_Status *status) { - printf("MPI Stub WARNING: Should not send message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not send message to self\n"); + ++callcount; + } 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) { - printf("MPI Stub WARNING: Should not get count of message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not get count of message to self\n"); + ++callcount; + } return 0; } diff --git a/src/USER-PTM/ptm_polar.cpp b/src/USER-PTM/ptm_polar.cpp index 7a2695b504..5e234127a9 100644 --- a/src/USER-PTM/ptm_polar.cpp +++ b/src/USER-PTM/ptm_polar.cpp @@ -88,6 +88,7 @@ #include #include #include +#include "ptm_polar.h" #include "ptm_quat.h" diff --git a/src/library.cpp b/src/library.cpp index d8c55159a2..a653b83adb 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -801,6 +801,17 @@ void lammps_reset_box(void *ptr, double *boxlo, double *boxhi, 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, int type, int count, void *data) { @@ -905,6 +916,7 @@ void lammps_gather_atoms(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- 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 ------------------------------------------------------------------------- */ +#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, int type, int count, void *data) { @@ -1047,6 +1070,7 @@ void lammps_gather_atoms_concat(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- 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 ------------------------------------------------------------------------- */ +#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, int type, int count, int ndata, int *ids, void *data) @@ -1188,6 +1224,7 @@ void lammps_gather_atoms_subset(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- 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 ------------------------------------------------------------------------- */ +#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, int type, int count, void *data) { @@ -1299,6 +1347,7 @@ void lammps_scatter_atoms(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- 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 ------------------------------------------------------------------------- */ +#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, int type, int count, int ndata, int *ids, void *data) @@ -1420,6 +1481,7 @@ void lammps_scatter_atoms_subset(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- create N atoms and assign them to procs based on coords diff --git a/src/lmpwindows.h b/src/lmpwindows.h index 546fa62535..92a248a05e 100644 --- a/src/lmpwindows.h +++ b/src/lmpwindows.h @@ -24,14 +24,13 @@ inline double pow(int i, int j){ return pow((double)i,j); } -#endif -inline double sqrt(int i){ - return sqrt((double) i); -} - inline double fabs(int i){ return fabs((double) i); } +inline double sqrt(int i){ + return sqrt((double) i); +} +#endif inline double trunc(double x) { return x > 0 ? floor(x) : ceil(x); diff --git a/src/memory.cpp b/src/memory.cpp index 971de3dce6..b2f8a95b17 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -26,7 +26,7 @@ #endif #endif -#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) +#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) #define LAMMPS_MEMALIGN 64 #endif diff --git a/src/my_page.h b/src/my_page.h index 5cd7098d8c..01542a9174 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -48,7 +48,7 @@ methods: #ifndef 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 #endif