diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 182dd302b6..44a5ced761 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,8 +5,8 @@ Thank your for considering to contribute to the LAMMPS software project. The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project. Thus please also have a look at: -* [The guide for submitting new features in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html) -* [The guide on programming style and requirement in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html) +* [The guide for submitting new features in the LAMMPS manual](https://www.lammps.org/doc/Modify_contribute.html) +* [The guide on programming style and requirement in the LAMMPS manual](https://www.lammps.org/doc/Modify_style.html) * [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html) ## Table of Contents diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 35ec32e544..b31c262e32 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -26,6 +26,7 @@ jobs: shell: bash run: | python3 -m pip install numpy + python3 -m pip install pyyaml cmake -C cmake/presets/windows.cmake \ -D PKG_PYTHON=on \ -S cmake -B build \ diff --git a/.github/workflows/unittest-macos.yml b/.github/workflows/unittest-macos.yml index 6e2f9bd800..a222380f60 100644 --- a/.github/workflows/unittest-macos.yml +++ b/.github/workflows/unittest-macos.yml @@ -37,6 +37,7 @@ jobs: working-directory: build run: | ccache -z + python3 -m pip install pyyaml cmake -C ../cmake/presets/clang.cmake \ -C ../cmake/presets/most.cmake \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ diff --git a/bench/README b/bench/README index 7d5aced119..99a0484355 100644 --- a/bench/README +++ b/bench/README @@ -4,10 +4,8 @@ This directory contains 5 benchmark problems which are discussed in the Benchmark section of the LAMMPS documentation, and on the Benchmark page of the LAMMPS WWW site (https://www.lammps.org/bench.html). -This directory also has several sub-directories: +This directory also has one sub-directories: -FERMI benchmark scripts for desktop machine with Fermi GPUs (Tesla) -KEPLER benchmark scripts for GPU cluster with Kepler GPUs POTENTIALS benchmarks scripts for various potentials in LAMMPS The results for all of these benchmarks are displayed and discussed on diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0b270cc68f..c5a3707865 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -105,8 +105,28 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") endif() endif() +# silence excessive warnings for new Intel Compilers +if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare -Wno-unused-command-line-argument") +endif() + +# silence excessive warnings for PGI/NVHPC compilers +if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "PGI")) + set(CMAKE_TUNE_DEFAULT "-Minform=severe") +endif() + +# silence nvcc warnings +if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) + set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma") +endif() + # we require C++11 without extensions. Kokkos requires at least C++14 (currently) -set(CMAKE_CXX_STANDARD 11) +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() +if(CMAKE_CXX_STANDARD LESS 11) + message(FATAL_ERROR "C++ standard must be set to at least 11") +endif() if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) set(CMAKE_CXX_STANDARD 14) endif() @@ -141,10 +161,12 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared lib option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF) option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF) -# allow enabling clang-tidy for C++ files +# Support using clang-tidy for C++ files with selected options set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling") if(ENABLE_CLANG_TIDY) - set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*-header-filter=.*" CACHE STRING "") + set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings") +else() + unset(CMAKE_CXX_CLANG_TIDY CACHE) endif() include(GNUInstallDirs) @@ -172,6 +194,7 @@ set(STANDARD_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK @@ -188,6 +211,7 @@ set(STANDARD_PACKAGES DPD-SMOOTH DRUDE EFF + ELECTRODE EXTRA-COMPUTE EXTRA-DUMP EXTRA-FIX @@ -208,7 +232,6 @@ set(STANDARD_PACKAGES MDI MEAM MESONT - MESSAGE MGPT MISC ML-HDNNP @@ -307,7 +330,9 @@ string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES) target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES}) # posix_memalign is not available on Windows -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") +# with INTEL package and Intel compilers we use TBB's aligned malloc +if((CMAKE_SYSTEM_NAME STREQUAL "Windows") + AND NOT (PKG_INTEL AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")))) set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE) else() set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable") @@ -332,6 +357,7 @@ pkg_depends(DIELECTRIC KSPACE) pkg_depends(DIELECTRIC EXTRA-PAIR) pkg_depends(CG-DNA MOLECULE) pkg_depends(CG-DNA ASPHERE) +pkg_depends(ELECTRODE KSPACE) # detect if we may enable OpenMP support by default set(BUILD_OMP_DEFAULT OFF) @@ -369,7 +395,7 @@ if(BUILD_OMP) target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() -if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE) +if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE) enable_language(C) find_package(LAPACK) find_package(BLAS) @@ -451,7 +477,7 @@ else() endif() foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF - PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MESSAGE MSCG COMPRESS ML-PACE) + PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE) if(PKG_${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL}) endif() @@ -468,6 +494,7 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine separate_arguments(CMAKE_TUNE_FLAGS) foreach(_FLAG ${CMAKE_TUNE_FLAGS}) target_compile_options(lammps PRIVATE ${_FLAG}) + target_compile_options(lmp PRIVATE ${_FLAG}) endforeach() ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # @@ -572,6 +599,10 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT) endif() endforeach() +if(PKG_ELECTRODE) + target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES}) +endif() + if(PKG_AWPMD) target_link_libraries(awpmd PRIVATE ${LAPACK_LIBRARIES}) endif() @@ -810,6 +841,7 @@ endif() include(FeatureSummary) feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND) message(STATUS "<<< Build configuration >>> + LAMMPS Version: ${PROJECT_VERSION} Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION} Build type: ${LAMMPS_BUILD_TYPE} Install path: ${CMAKE_INSTALL_PREFIX} @@ -919,6 +951,12 @@ if(PKG_KSPACE) else() message(STATUS "Kokkos FFT: cuFFT") endif() + elseif(Kokkos_ENABLE_HIP) + if(FFT STREQUAL "KISS") + message(STATUS "Kokkos FFT: KISS") + else() + message(STATUS "Kokkos FFT: hipFFT") + endif() else() message(STATUS "Kokkos FFT: ${FFT}") endif() diff --git a/cmake/CMakeSettings.json b/cmake/CMakeSettings.json index d8ef47a220..b0f940277f 100644 --- a/cmake/CMakeSettings.json +++ b/cmake/CMakeSettings.json @@ -151,6 +151,190 @@ "type": "BOOL" } ] + }, + { + "name": "x64-Debug-IntelLLVM", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "inheritEnvironments": [], + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-llvm.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + }, + { + "name": "PKG_PLUGIN", + "value": "True", + "type": "BOOL" + } + ] + }, + { + "name": "x64-Release-IntelLLVM", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-llvm.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "inheritEnvironments": [], + "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + }, + { + "name": "PKG_PLUGIN", + "value": "True", + "type": "BOOL" + } + ] + }, + { + "name": "x64-Debug-Intel-Classic", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-classic.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "inheritEnvironments": [], + "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "False", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + }, + { + "name": "PKG_PLUGIN", + "value": "True", + "type": "BOOL" + } + ] + }, + { + "name": "x64-Release-Intel-Classic", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-classic.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "inheritEnvironments": [], + "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "False", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + }, + { + "name": "PKG_PLUGIN", + "value": "True", + "type": "BOOL" + } + ] } ] } \ No newline at end of file diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 16dd5dd4fa..35661843a2 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -7,13 +7,13 @@ if(BUILD_DOC) # Sphinx 3.x requires at least Python 3.5 if(CMAKE_VERSION VERSION_LESS 3.12) find_package(PythonInterp 3.5 REQUIRED) - set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv -p ${PYTHON_EXECUTABLE}) + set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv) else() find_package(Python3 REQUIRED COMPONENTS Interpreter) if(Python3_VERSION VERSION_LESS 3.5) message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation") endif() - set(VIRTUALENV ${Python3_EXECUTABLE} -m virtualenv -p ${Python3_EXECUTABLE}) + set(VIRTUALENV ${Python3_EXECUTABLE} -m venv) endif() find_package(Doxygen 1.8.10 REQUIRED) diff --git a/cmake/Modules/Packages/COLVARS.cmake b/cmake/Modules/Packages/COLVARS.cmake index 3488aa62b1..da5b685536 100644 --- a/cmake/Modules/Packages/COLVARS.cmake +++ b/cmake/Modules/Packages/COLVARS.cmake @@ -19,6 +19,10 @@ endif() add_library(colvars STATIC ${COLVARS_SOURCES}) target_compile_definitions(colvars PRIVATE -DCOLVARS_LAMMPS) +separate_arguments(CMAKE_TUNE_FLAGS) +foreach(_FLAG ${CMAKE_TUNE_FLAGS}) + target_compile_options(colvars PRIVATE ${_FLAG}) +endforeach() set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE}) target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) # The line below is needed to locate math_eigen_impl.h diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index aec8887c30..75569aa55d 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -80,14 +80,14 @@ if(GPU_API STREQUAL "CUDA") # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}") - # apply the following to build "fat" CUDA binaries only for known CUDA toolkits - if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - message(WARNING "Untested CUDA Toolkit version. Use at your own risk") + # apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0 + # only the Kepler achitecture and beyond is supported + if(CUDA_VERSION VERSION_LESS 8.0) + message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") + elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") + set(GPU_CUDA_GENCODE "-arch=all") else() - # Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0 - if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0")) - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20] ") - endif() # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ") @@ -120,6 +120,14 @@ if(GPU_API STREQUAL "CUDA") if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() + # # Lovelace (GPU Arch 9.x) is supported by CUDA 12.0? and later + #if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + # string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_9x,code=[sm_9x,compute_9x]") + #endif() endif() cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC} @@ -257,43 +265,47 @@ elseif(GPU_API STREQUAL "HIP") find_package(CUDA REQUIRED) set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)") - # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice - # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture - set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}") - # Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0 - if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0")) - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20]") - endif() - # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 - if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30]") - endif() - # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11.0 - if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]") - endif() - # Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]") - endif() - # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]") - endif() - # Volta (GPU Arch 7.0) is supported by CUDA 9 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]") - endif() - # Turing (GPU Arch 7.5) is supported by CUDA 10 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]") - endif() - # Ampere (GPU Arch 8.0) is supported by CUDA 11 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") - endif() - if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - message(WARNING "Unsupported CUDA version. Use at your own risk.") + if(CUDA_VERSION VERSION_LESS 8.0) + message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") + elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") + set(HIP_CUDA_GENCODE "-arch=all") + else() + # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice + # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture + set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}") + # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 + if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30]") + endif() + # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11.0 + if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]") + endif() + # Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]") + endif() + # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]") + endif() + # Volta (GPU Arch 7.0) is supported by CUDA 9 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]") + endif() + # Turing (GPU Arch 7.5) is supported by CUDA 10 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]") + endif() + # Ampere (GPU Arch 8.0) is supported by CUDA 11 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") + endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() endif() endif() @@ -347,6 +359,10 @@ elseif(GPU_API STREQUAL "HIP") target_link_libraries(gpu PRIVATE hip::host) if(HIP_USE_DEVICE_SORT) + if(HIP_PLATFORM STREQUAL "amd") + # newer version of ROCm (5.1+) require c++14 for rocprim + set_property(TARGET gpu PROPERTY CXX_STANDARD 14) + endif() # add hipCUB target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include) target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT) diff --git a/cmake/Modules/Packages/H5MD.cmake b/cmake/Modules/Packages/H5MD.cmake index 4fcae93027..6f6922f13e 100644 --- a/cmake/Modules/Packages/H5MD.cmake +++ b/cmake/Modules/Packages/H5MD.cmake @@ -1,5 +1,14 @@ enable_language(C) +# we don't use the parallel i/o interface. +set(HDF5_PREFER_PARALLEL FALSE) + find_package(HDF5 REQUIRED) + +# parallel HDF5 will import incompatible MPI headers with a serial build +if((NOT BUILD_MPI) AND HDF5_IS_PARALLEL) + message(FATAL_ERROR "Serial LAMMPS build and parallel HDF5 library are not compatible") +endif() + target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES}) target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS}) diff --git a/cmake/Modules/Packages/INTEL.cmake b/cmake/Modules/Packages/INTEL.cmake index af08249090..ce8455e542 100644 --- a/cmake/Modules/Packages/INTEL.cmake +++ b/cmake/Modules/Packages/INTEL.cmake @@ -38,7 +38,7 @@ if(INTEL_LRT_MODE STREQUAL "C++11") endif() endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") +if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) message(FATAL_ERROR "INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}") endif() @@ -46,12 +46,12 @@ else() message(WARNING "INTEL gives best performance with Intel compilers") endif() -find_package(TBB_MALLOC QUIET) +find_package(TBB_MALLOC) if(TBB_MALLOC_FOUND) target_link_libraries(lammps PRIVATE TBB::TBB_MALLOC) else() target_compile_definitions(lammps PRIVATE -DLMP_INTEL_NO_TBB) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")) message(WARNING "INTEL with Intel compilers should use TBB malloc libraries") endif() endif() @@ -112,5 +112,9 @@ if(PKG_KSPACE) RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h) endif() +if(PKG_ELECTRODE) + list(APPEND INTEL_SOURCES ${INTEL_SOURCES_DIR}/electrode_accel_intel.cpp) +endif() + target_sources(lammps PRIVATE ${INTEL_SOURCES}) target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR}) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 4e35e6dcc0..cf3d19c720 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -47,8 +47,8 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) - set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.5.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "079323d973ae0e1c38c0a54a150c674e" CACHE STRING "MD5 checksum of KOKKOS tarball") + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.6.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "b5c44ea961031795f434002cd7b31c20" CACHE STRING "MD5 checksum of KOKKOS tarball") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) ExternalProject_Add(kokkos_build @@ -72,7 +72,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 3.5.00 REQUIRED CONFIG) + find_package(Kokkos 3.6.00 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) target_link_libraries(lmp PRIVATE Kokkos::kokkos) else() @@ -130,6 +130,11 @@ if(PKG_KSPACE) target_compile_definitions(lammps PRIVATE -DFFT_CUFFT) target_link_libraries(lammps PRIVATE cufft) endif() + elseif(Kokkos_ENABLE_HIP) + if(NOT (FFT STREQUAL "KISS")) + target_compile_definitions(lammps PRIVATE -DFFT_HIPFFT) + target_link_libraries(lammps PRIVATE hipfft) + endif() endif() endif() diff --git a/cmake/Modules/Packages/MACHDYN.cmake b/cmake/Modules/Packages/MACHDYN.cmake index d90ca8146c..fcc298da2f 100644 --- a/cmake/Modules/Packages/MACHDYN.cmake +++ b/cmake/Modules/Packages/MACHDYN.cmake @@ -36,3 +36,5 @@ endif() if((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")) target_compile_definitions(lammps PRIVATE -DEIGEN_DONT_VECTORIZE) endif() + +target_compile_definitions(lammps PRIVATE -DEIGEN_NO_CUDA) diff --git a/cmake/Modules/Packages/MDI.cmake b/cmake/Modules/Packages/MDI.cmake index 047c30c603..88859f0285 100644 --- a/cmake/Modules/Packages/MDI.cmake +++ b/cmake/Modules/Packages/MDI.cmake @@ -8,8 +8,8 @@ option(DOWNLOAD_MDI "Download and compile the MDI library instead of using an al if(DOWNLOAD_MDI) message(STATUS "MDI download requested - we will build our own") - set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.2.9.tar.gz" CACHE STRING "URL for MDI tarball") - set(MDI_MD5 "ddfa46d6ee15b4e59cfd527ec7212184" CACHE STRING "MD5 checksum for MDI tarball") + set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.3.2.tar.gz" CACHE STRING "URL for MDI tarball") + set(MDI_MD5 "836f5da400d8cff0f0e4435640f9454f" CACHE STRING "MD5 checksum for MDI tarball") mark_as_advanced(MDI_URL) mark_as_advanced(MDI_MD5) enable_language(C) @@ -50,6 +50,7 @@ if(DOWNLOAD_MDI) -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dlanguage=C -Dlibtype=STATIC -Dmpi=${MDI_USE_MPI} diff --git a/cmake/Modules/Packages/MESSAGE.cmake b/cmake/Modules/Packages/MESSAGE.cmake deleted file mode 100644 index b5a61a1607..0000000000 --- a/cmake/Modules/Packages/MESSAGE.cmake +++ /dev/null @@ -1,31 +0,0 @@ -if(LAMMPS_SIZES STREQUAL "BIGBIG") - message(FATAL_ERROR "The MESSAGE Package is not compatible with -DLAMMPS_BIGBIG") -endif() -option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF) -file(GLOB_RECURSE cslib_SOURCES - ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp) - -add_library(cslib STATIC ${cslib_SOURCES}) -target_compile_definitions(cslib PRIVATE -DLAMMPS_${LAMMPS_SIZES}) -set_target_properties(cslib PROPERTIES OUTPUT_NAME lammps_cslib${LAMMPS_MACHINE}) -if(BUILD_MPI) - target_compile_definitions(cslib PRIVATE -DMPI_YES) - set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi") - target_link_libraries(cslib PRIVATE MPI::MPI_CXX) -else() - target_compile_definitions(cslib PRIVATE -DMPI_NO) - target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI) - set_target_properties(cslib PROPERTIES OUTPUT_NAME "csnompi") -endif() - -if(MESSAGE_ZMQ) - target_compile_definitions(cslib PRIVATE -DZMQ_YES) - find_package(ZMQ REQUIRED) - target_link_libraries(cslib PUBLIC ZMQ::ZMQ) -else() - target_compile_definitions(cslib PRIVATE -DZMQ_NO) - target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_ZMQ) -endif() - -target_link_libraries(lammps PRIVATE cslib) -target_include_directories(lammps PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src) diff --git a/cmake/Modules/Packages/ML-HDNNP.cmake b/cmake/Modules/Packages/ML-HDNNP.cmake index 5a4c287fa2..f52d7ca6f3 100644 --- a/cmake/Modules/Packages/ML-HDNNP.cmake +++ b/cmake/Modules/Packages/ML-HDNNP.cmake @@ -42,15 +42,9 @@ if(DOWNLOAD_N2P2) if(NOT BUILD_MPI) set(N2P2_PROJECT_OPTIONS "-DN2P2_NO_MPI") else() - # get path to MPI include directory when cross-compiling to windows - if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING) - get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES) - set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}") - endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES) - set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}") - endif() + # get path to MPI include directory + get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES) + set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}") endif() # prefer GNU make, if available. N2P2 lib seems to need it. diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index d46197114d..635a9ff2f5 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "a2ac3315c41a1a4a5c912bcb1bc9c5cc" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_MD5 "e0572de57039d4afedefb25707b6ceae" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) @@ -15,6 +15,10 @@ execute_process( ) file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) +# enforce building libyaml-cpp as static library and turn off optional features +set(YAML_BUILD_SHARED_LIBS OFF) +set(YAML_CPP_BUILD_CONTRIB OFF) +set(YAML_CPP_BUILD_TOOLS OFF) add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) diff --git a/cmake/Modules/Tools.cmake b/cmake/Modules/Tools.cmake index c3b0a0771d..d2758f1f24 100644 --- a/cmake/Modules/Tools.cmake +++ b/cmake/Modules/Tools.cmake @@ -3,6 +3,9 @@ if(BUILD_TOOLS) target_compile_definitions(binary2txt PRIVATE -DLAMMPS_${LAMMPS_SIZES}) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) + add_executable(stl_bin2txt ${LAMMPS_TOOLS_DIR}/stl_bin2txt.cpp) + install(TARGETS stl_bin2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) + include(CheckGeneratorSupport) if(CMAKE_GENERATOR_SUPPORT_FORTRAN) include(CheckLanguage) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index 2893bbab6b..895f26845f 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -8,6 +8,7 @@ set(ALL_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK @@ -24,6 +25,7 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP @@ -48,7 +50,6 @@ set(ALL_PACKAGES MDI MEAM MESONT - MESSAGE MGPT MISC ML-HDNNP diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 9f38f1e1e4..90b0f02c4b 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -10,6 +10,7 @@ set(ALL_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK @@ -26,6 +27,7 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP @@ -50,7 +52,6 @@ set(ALL_PACKAGES MDI MEAM MESONT - MESSAGE MGPT MISC ML-HDNNP diff --git a/cmake/presets/kokkos-cuda.cmake b/cmake/presets/kokkos-cuda.cmake index 36d099479d..ace8ff0879 100644 --- a/cmake/presets/kokkos-cuda.cmake +++ b/cmake/presets/kokkos-cuda.cmake @@ -3,9 +3,9 @@ # that is compatible with all higher CC, but not the default CC 3.5 set(PKG_KOKKOS ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) -set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE) -set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE) +set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) -get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE) -set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/kokkos-hip.cmake b/cmake/presets/kokkos-hip.cmake new file mode 100644 index 0000000000..827a37152b --- /dev/null +++ b/cmake/presets/kokkos-hip.cmake @@ -0,0 +1,20 @@ +# preset that enables KOKKOS and selects HIP compilation with OpenMP +# enabled as well. Also sets some performance related compiler flags. +set(PKG_KOKKOS ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_HIP ON CACHE BOOL "" FORCE) +set(Kokkos_ARCH_VEGA90A on CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS ON CACHE BOOL "" FORCE) +set(BUILD_OMP ON CACHE BOOL "" FORCE) + +set(CMAKE_CXX_COMPILER hipcc CACHE STRING "" FORCE) +set(CMAKE_TUNE_FLAGS "-munsafe-fp-atomics" CACHE STRING "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) + +# these flags are needed to build with Cray MPICH on OLCF Crusher +#-D CMAKE_CXX_FLAGS="-I/${MPICH_DIR}/include" +#-D MPI_CXX_LIBRARIES="-L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa" diff --git a/cmake/presets/kokkos-openmp.cmake b/cmake/presets/kokkos-openmp.cmake index 27d09f62cf..3a7c19ff3c 100644 --- a/cmake/presets/kokkos-openmp.cmake +++ b/cmake/presets/kokkos-openmp.cmake @@ -4,3 +4,6 @@ set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/kokkos-serial.cmake b/cmake/presets/kokkos-serial.cmake index 0208d2ee3a..f1bda7124a 100644 --- a/cmake/presets/kokkos-serial.cmake +++ b/cmake/presets/kokkos-serial.cmake @@ -3,3 +3,6 @@ set(PKG_KOKKOS ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/kokkos-sycl.cmake b/cmake/presets/kokkos-sycl.cmake new file mode 100644 index 0000000000..c706aca7d8 --- /dev/null +++ b/cmake/presets/kokkos-sycl.cmake @@ -0,0 +1,18 @@ +# preset that enables KOKKOS and selects SYCL compilation with OpenMP +# enabled as well. Also sets some performance related compiler flags. +set(PKG_KOKKOS ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_SYCL ON CACHE BOOL "" FORCE) +set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE) +set(BUILD_OMP ON CACHE BOOL "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) + +set(CMAKE_CXX_COMPILER clang++ CACHE STRING "" FORCE) +set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) +set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "-Xsycl-target-frontend -O3" CACHE STRING "" FORCE) +set(CMAKE_TUNE_FLAGS "-fgpu-inline-threshold=100000 -Xsycl-target-frontend -O3 -Xsycl-target-frontend -ffp-contract=on -Wno-unknown-cuda-version" CACHE STRING "" FORCE) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index fe828a6d9a..81db71729a 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -4,6 +4,7 @@ set(WIN_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK @@ -20,6 +21,7 @@ set(WIN_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 27ce57621c..5e408f17cf 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -6,6 +6,7 @@ set(ALL_PACKAGES ASPHERE BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK @@ -22,6 +23,7 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index fd9c2ed1ac..b6567ad617 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -6,6 +6,7 @@ set(PACKAGES_WITH_LIB ATC AWPMD COMPRESS + ELECTRODE GPU H5MD KIM @@ -15,7 +16,6 @@ set(PACKAGES_WITH_LIB MACHDYN MDI MESONT - MESSAGE ML-HDNNP ML-PACE ML-QUIP diff --git a/cmake/presets/pgi.cmake b/cmake/presets/pgi.cmake index b34cb05331..2b7fee7efa 100644 --- a/cmake/presets/pgi.cmake +++ b/cmake/presets/pgi.cmake @@ -1,4 +1,4 @@ -# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes) +# preset that will enable PGI (Nvidia) compilers with support for MPI and OpenMP (on Linux boxes) set(CMAKE_CXX_COMPILER "pgc++" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "pgcc" CACHE STRING "" FORCE) diff --git a/cmake/presets/windows-intel-classic.cmake b/cmake/presets/windows-intel-classic.cmake new file mode 100644 index 0000000000..ce6db622f0 --- /dev/null +++ b/cmake/presets/windows-intel-classic.cmake @@ -0,0 +1,8 @@ +# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes) + +set(CMAKE_CXX_COMPILER "icl" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "icl" CACHE STRING "" FORCE) +set(CMAKE_Fortran_COMPILER "ifort" CACHE STRING "" FORCE) + +unset(HAVE_OMP_H_INCLUDE CACHE) + diff --git a/cmake/presets/windows-intel-llvm.cmake b/cmake/presets/windows-intel-llvm.cmake new file mode 100644 index 0000000000..e9d88d22fe --- /dev/null +++ b/cmake/presets/windows-intel-llvm.cmake @@ -0,0 +1,8 @@ +# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes) + +set(CMAKE_CXX_COMPILER "icx" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE) +set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE) +set(INTEL_LRT_MODE "C++11" CACHE STRING "" FORCE) +unset(HAVE_OMP_H_INCLUDE CACHE) +set(CMAKE_TUNE_FLAGS -Wno-unused-command-line-argument) diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index d4e69c5fca..c83b16d855 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -2,6 +2,7 @@ set(WIN_PACKAGES ASPHERE BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK diff --git a/doc/.gitignore b/doc/.gitignore index 7649fb34f1..7c953d2432 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,6 +1,6 @@ /old /html -/html-offline +/fasthtml /epub /latex /mathjax diff --git a/doc/Makefile b/doc/Makefile index a082018dfb..113a64ec10 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -14,34 +14,22 @@ ANCHORCHECK = $(VENV)/bin/rst_anchor_check SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config MATHJAX = $(SPHINXCONFIG)/_static/mathjax -PYTHON = $(shell which python3) -DOXYGEN = $(shell which doxygen) -VIRTUALENV = virtualenv +PYTHON = $(word 3,$(shell type python3)) +DOXYGEN = $(word 3,$(shell type doxygen)) HAS_PYTHON3 = NO -HAS_VIRTUALENV = NO HAS_DOXYGEN = NO HAS_PDFLATEX = NO -ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type python3 >/dev/null 2>&1; echo $$?), 0) HAS_PYTHON3 = YES endif -ifeq ($(shell which doxygen >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type doxygen >/dev/null 2>&1; echo $$?), 0) HAS_DOXYGEN = YES endif -ifeq ($(shell which virtualenv-3 >/dev/null 2>&1; echo $$?), 0) -VIRTUALENV = virtualenv-3 -HAS_VIRTUALENV = YES -endif - -ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0) -VIRTUALENV = virtualenv -HAS_VIRTUALENV = YES -endif - -ifeq ($(shell which pdflatex >/dev/null 2>&1; echo $$?), 0) -ifeq ($(shell which latexmk >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type pdflatex >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type latexmk >/dev/null 2>&1; echo $$?), 0) HAS_PDFLATEX = YES endif endif @@ -58,7 +46,7 @@ SPHINXEXTRA = -E -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiproc # we only want to use explicitly listed files. DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//') -.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen +.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen fasthtml # ------------------------------------------ @@ -70,7 +58,8 @@ help: @echo " epub create ePUB format manual for e-book readers" @echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)" @echo " (requires ebook-convert tool from calibre)" - @echo " clean remove all intermediate RST files" + @echo " fasthtml approximate HTML page creation in fasthtml dir (for development)" + @echo " clean remove all intermediate files" @echo " clean-all reset the entire build environment" @echo " anchor_check scan for duplicate anchor labels" @echo " style_check check for complete and consistent style lists" @@ -83,7 +72,7 @@ clean-all: clean rm -rf $(BUILDDIR)/docenv $(MATHJAX) $(BUILDDIR)/LAMMPS.mobi $(BUILDDIR)/LAMMPS.epub $(BUILDDIR)/Manual.pdf clean: clean-spelling - rm -rf $(BUILDDIR)/html $(BUILDDIR)/epub $(BUILDDIR)/latex $(BUILDDIR)/doctrees $(BUILDDIR)/doxygen/xml $(BUILDDIR)/doxygen-warn.log $(BUILDDIR)/doxygen/Doxyfile $(SPHINXCONFIG)/conf.py + rm -rf $(BUILDDIR)/html $(BUILDDIR)/epub $(BUILDDIR)/latex $(BUILDDIR)/doctrees $(BUILDDIR)/doxygen/xml $(BUILDDIR)/doxygen-warn.log $(BUILDDIR)/doxygen/Doxyfile $(SPHINXCONFIG)/conf.py $(BUILDDIR)/fasthtml clean-spelling: rm -rf $(BUILDDIR)/spelling @@ -118,6 +107,23 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @rm -rf html/PDF/.[sg]* @echo "Build finished. The HTML pages are in doc/html." +fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) + @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi + @$(MAKE) $(MFLAGS) -C graphviz all + @mkdir -p fasthtml + @(\ + . $(VENV)/bin/activate ; env PYTHONWARNINGS= \ + sphinx-build -j 4 -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\ + deactivate ;\ + ) + @rm -rf fasthtml/_sources + @rm -rf fasthtml/PDF + @rm -rf fasthtml/USER + @rm -rf fasthtml/JPG + @cp -r src/PDF fasthtml/PDF + @rm -rf fasthtml/PDF/.[sg]* + @echo "Fast HTML build finished. The HTML pages are in doc/fasthtml." + spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @(\ @@ -220,9 +226,8 @@ $(VENV): @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_PYTHON3)" == "NO" ] ; then echo "python3 was not found! Please see README for further instructions" 1>&2; exit 1; fi @if [ "$(HAS_DOXYGEN)" == "NO" ] ; then echo "doxygen was not found! Please see README for further instructions" 1>&2; exit 1; fi - @if [ "$(HAS_VIRTUALENV)" == "NO" ] ; then echo "virtualenv was not found! Please see README for further instructions" 1>&2; exit 1; fi @( \ - $(VIRTUALENV) -p $(PYTHON) $(VENV); \ + $(PYTHON) -m venv $(VENV); \ . $(VENV)/bin/activate; \ pip $(PIP_OPTIONS) install --upgrade pip; \ pip $(PIP_OPTIONS) install -r $(BUILDDIR)/utils/requirements.txt; \ diff --git a/doc/doxygen/Doxyfile.in b/doc/doxygen/Doxyfile.in index d454898f4e..e905d5a64d 100644 --- a/doc/doxygen/Doxyfile.in +++ b/doc/doxygen/Doxyfile.in @@ -2,7 +2,7 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "LAMMPS Programmer's Guide" -PROJECT_NUMBER = "24 August 2020" +PROJECT_NUMBER = "4 May 2022" PROJECT_BRIEF = "Documentation of the LAMMPS library interface and Python wrapper" PROJECT_LOGO = lammps-logo.png CREATE_SUBDIRS = NO @@ -437,6 +437,8 @@ INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \ @LAMMPS_SOURCE_DIR@/math_eigen.h \ @LAMMPS_SOURCE_DIR@/platform.h \ @LAMMPS_SOURCE_DIR@/platform.cpp \ + @LAMMPS_SOURCE_DIR@/math_special.h \ + @LAMMPS_SOURCE_DIR@/math_special.cpp \ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/doc/lammps.1 b/doc/lammps.1 index b8011d0cb0..8ce751844a 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "1" "24 March 2022" "2022-3-24" +.TH LAMMPS "1" "4 May 2022" "2022-5-4" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. Version 24 March 2022 diff --git a/doc/msi2lmp.1 b/doc/msi2lmp.1 index ba771da7dc..f088603483 100644 --- a/doc/msi2lmp.1 +++ b/doc/msi2lmp.1 @@ -98,7 +98,7 @@ msi2lmp decane -c 0 -f oplsaa .SH COPYRIGHT -© 2003--2021 Sandia Corporation +© 2003--2022 Sandia Corporation This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index 5492a1e536..66e12a0d69 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -486,14 +486,14 @@ The following options are available. make fix-whitespace # correct whitespace issues in files make check-homepage # search for files with old LAMMPS homepage URLs make fix-homepage # correct LAMMPS homepage URLs in files + make check-errordocs # search for deprecated error docs in header files + make fix-errordocs # remove error docs in header files make check-permissions # search for files with permissions issues make fix-permissions # correct permissions issues in files + make check # run all check targets from above -These should help to replace all TAB characters with blanks and remove -any trailing whitespace. Also all LAMMPS homepage URL references can be -updated to the location change from Sandia to the lammps.org domain. -And the permission check can remove executable permissions from non-executable -files (like source code). +These should help to make source and documentation files conforming +to some the coding style preferences of the LAMMPS developers. Clang-format support -------------------- diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 9648df402f..14d0e290aa 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -45,7 +45,6 @@ This is the list of packages that may require additional steps. * :ref:`MACHDYN ` * :ref:`MDI ` * :ref:`MESONT ` - * :ref:`MESSAGE ` * :ref:`ML-HDNNP ` * :ref:`ML-IAP ` * :ref:`ML-PACE ` @@ -142,8 +141,6 @@ CMake build :code:`GPU_ARCH` settings for different GPU hardware is as follows: -* sm_12 or sm_13 for GT200 (supported by CUDA 3.2 until CUDA 6.5) -* sm_20 or sm_21 for Fermi (supported by CUDA 3.2 until CUDA 7.5) * sm_30 for Kepler (supported since CUDA 5 and until CUDA 10.x) * sm_35 or sm_37 for Kepler (supported since CUDA 5 and until CUDA 11.x) * sm_50 or sm_52 for Maxwell (supported since CUDA 6) @@ -161,6 +158,12 @@ Thus the GPU_ARCH setting is merely an optimization, to have code for the preferred GPU architecture directly included rather than having to wait for the JIT compiler of the CUDA driver to translate it. +When compiling for CUDA or HIP with CUDA, version 8.0 or later of the CUDA toolkit +is required and a GPU architecture of Kepler or later, which must *also* be +supported by the CUDA toolkit in use **and** the CUDA driver in use. +When compiling for OpenCL, OpenCL version 1.2 or later is required and the +GPU must be supported by the GPU driver and OpenCL runtime bundled with the driver. + When building with CMake, you **must NOT** build the GPU library in ``lib/gpu`` using the traditional build procedure. CMake will detect files generated by that process and will terminate with an error and a suggestion for how to remove them. @@ -638,13 +641,27 @@ This list was last updated for version 3.5.0 of the Kokkos library. -D CMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper - To simplify compilation, three preset files are included in the + For AMD or NVIDIA GPUs using HIP, set these variables: + + .. code-block:: bash + + -D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above + -D Kokkos_ARCH_GPUARCH=yes # GPUARCH = GPU from list above + -D Kokkos_ENABLE_HIP=yes + -D Kokkos_ENABLE_OPENMP=yes + + This will enable FFTs on the GPU, either by the internal KISSFFT library + or with the hipFFT wrapper library, which will call out to the + platform-appropriate vendor library: rocFFT on AMD GPUs or cuFFT on + NVIDIA GPUs. + + To simplify compilation, five preset files are included in the ``cmake/presets`` folder, ``kokkos-serial.cmake``, - ``kokkos-openmp.cmake``, and ``kokkos-cuda.cmake``. They will - enable the KOKKOS package and enable some hardware choice. So to - compile with OpenMP host parallelization, CUDA device - parallelization (for GPUs with CC 5.0 and up) with some common - packages enabled, you can do the following: + ``kokkos-openmp.cmake``, ``kokkos-cuda.cmake``, + ``kokkos-hip.cmake``, and ``kokkos-sycl.cmake``. They will enable + the KOKKOS package and enable some hardware choice. So to compile + with CUDA device parallelization (for GPUs with CC 5.0 and up) + with some common packages enabled, you can do the following: .. code-block:: bash @@ -703,6 +720,15 @@ This list was last updated for version 3.5.0 of the Kokkos library. KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) CC = mpicxx -cxx=$(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper + For AMD or NVIDIA GPUs using HIP: + + .. code-block:: make + + KOKKOS_DEVICES = HIP + KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU + # GPUARCH = GPU from list above + FFT_INC = -DFFT_HIPFFT # enable use of hipFFT (optional) + FFT_LIB = -lhipfft # link to hipFFT library Advanced KOKKOS compilation settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -796,47 +822,6 @@ library. ---------- -.. _message: - -MESSAGE package ------------------------------ - -This package can optionally include support for messaging via sockets, -using the open-source `ZeroMQ library `_, which must -be installed on your system. - -.. tabs:: - - .. tab:: CMake build - - .. code-block:: bash - - -D MESSAGE_ZMQ=value # build with ZeroMQ support, value = no (default) or yes - -D ZMQ_LIBRARY=path # ZMQ library file (only needed if a custom location) - -D ZMQ_INCLUDE_DIR=path # ZMQ include directory (only needed if a custom location) - - .. tab:: Traditional make - - Before building LAMMPS, you must build the CSlib library in - ``lib/message``\ . You can build the CSlib library manually if - you prefer; follow the instructions in ``lib/message/README``\ . - You can also do it in one step from the ``lammps/src`` dir, using - a command like these, which simply invoke the - ``lib/message/Install.py`` script with the specified args: - - .. code-block:: bash - - $ make lib-message # print help message - $ make lib-message args="-m -z" # build with MPI and socket (ZMQ) support - $ make lib-message args="-s" # build as serial lib with no ZMQ support - - The build should produce two files: ``lib/message/cslib/src/libmessage.a`` - and ``lib/message/Makefile.lammps``. The latter is copied from an - existing ``Makefile.lammps.*`` and has settings to link with the ZeroMQ - library if requested in the build. - ----------- - .. _mliap: ML-IAP package @@ -1289,6 +1274,41 @@ be built for the most part with all major versions of the C++ language. ---------- +.. _electrode: + +ELECTRODE package +----------------- + +This package depends on the KSPACE package. + +.. tabs:: + + .. tab:: CMake build + + No additional settings are needed besides ``-D PKG_KSPACE=yes`` and ``-D + PKG_ELECTRODE=yes``. + + .. tab:: Traditional make + + The package is activated with ``make yes-KSPACE`` and ``make + yes-ELECTRODE`` + + + Note that the ``Makefile.lammps`` file has settings for the BLAS and + LAPACK linear algebra libraries. As explained in ``lib/awpmd/README`` + these can either exist on your system, or you can use the files provided + in ``lib/linalg``. In the latter case you also need to build the library + in ``lib/linalg`` with a command like these: + + .. code-block:: bash + + $ make lib-linalg # print help message + $ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") + $ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") + $ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler + +---------- + .. _ml-pace: ML-PACE package diff --git a/doc/src/Build_manual.rst b/doc/src/Build_manual.rst index 5dbefd8b6e..90633d0811 100644 --- a/doc/src/Build_manual.rst +++ b/doc/src/Build_manual.rst @@ -78,11 +78,12 @@ folder. The following ``make`` commands are available: make html # generate HTML in html dir using Sphinx make pdf # generate PDF as Manual.pdf using Sphinx and PDFLaTeX - make fetch # fetch HTML pages and PDF files from LAMMPS website - # and unpack into the html_www folder and Manual_www.pdf make epub # generate LAMMPS.epub in ePUB format using Sphinx make mobi # generate LAMMPS.mobi in MOBI format using ebook-convert + make fasthtml # generate approximate HTML in fasthtml dir using Sphinx + # some Sphinx extensions do not work correctly with this + make clean # remove intermediate RST files created by HTML build make clean-all # remove entire build folder and any cached data @@ -193,8 +194,13 @@ folder need to be updated or new files added. These files are written in `reStructuredText `_ markup for translation with the Sphinx tool. Before contributing any documentation, please check that both the HTML -and the PDF format documentation can translate without errors. Please also -check the output to the console for any warnings or problems. There will +and the PDF format documentation can translate without errors. During +testing the html translation, you may use the ``make fasthtml`` command +which does an approximate translation (i.e. not all Sphinx features and +extensions will work), but runs very fast because it will only translate +files that have been changed since the last ``make fasthtml`` command. + +Please also check the output to the console for any warnings or problems. There will be multiple tests run automatically: - A test for correctness of all anchor labels and their references diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index a7dda52b41..9eeda4d8d4 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -45,7 +45,6 @@ packages: * :ref:`KOKKOS ` * :ref:`LATTE ` * :ref:`MACHDYN ` - * :ref:`MESSAGE ` * :ref:`ML-HDNNP ` * :ref:`ML-PACE ` * :ref:`ML-QUIP ` @@ -151,7 +150,7 @@ other files dependent on that package are also excluded. .. _cmake_presets: CMake presets for installing many packages -"""""""""""""""""""""""""""""""""""""""""" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Instead of specifying all the CMake options via the command-line, CMake allows initializing its settings cache using script files. @@ -179,6 +178,11 @@ one of them as a starting point and customize it to your needs. cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers +Presets that have names starting with "windows" are specifically for +compiling LAMMPS :doc:`natively on Windows ` and +presets that have names starting with "kokkos" are specifically for +selecting configurations for compiling LAMMPS with :ref:`KOKKOS `. + .. note:: Running cmake this way manipulates the CMake settings cache in your @@ -221,7 +225,8 @@ These commands install/un-install sets of packages: .. code-block:: bash make yes-all # install all packages - make no-all # uninstall all packages + make no-all # check for changes and uninstall all packages + make no-installed # only check and uninstall installed packages make yes-basic # install a few commonly used packages' make no-basic # remove a few commonly used packages' make yes-most # install most packages w/o libs' diff --git a/doc/src/Build_windows.rst b/doc/src/Build_windows.rst index c1af555696..d1748825eb 100644 --- a/doc/src/Build_windows.rst +++ b/doc/src/Build_windows.rst @@ -5,6 +5,7 @@ Notes for building LAMMPS on Windows * :ref:`Running Linux on Windows ` * :ref:`Using GNU GCC ported to Windows ` * :ref:`Using Visual Studio ` +* :ref:`Using Intel oneAPI compilers and libraries ` * :ref:`Using a cross-compiler ` ---------- @@ -25,8 +26,10 @@ assistance in resolving portability issues. This is particularly true for compiling LAMMPS on Windows, since this platform has significant differences in some low-level functionality. As of LAMMPS version 14 December 2021, large parts of LAMMPS can be compiled natively with the -Microsoft Visual C++ Compilers. This is largely facilitated by using -the :doc:`Developer_platform` in the ``platform`` namespace. +Microsoft Visual C++ Compilers. As of LAMMPS version 31 May 2022, also +the Intel oneAPI compilers can compile large parts of LAMMPS natively on +Windows. This is mostly facilitated by using the +:doc:`Developer_platform` in the ``platform`` namespace and CMake. Before trying to build LAMMPS on Windows yourself, please consider the `pre-compiled Windows installer packages `_ @@ -73,8 +76,9 @@ configuration should set this up automatically, but is untested. In case of problems, you are recommended to contact somebody with experience in using Cygwin. If you do come across portability problems requiring changes to the LAMMPS source code, or figure out corrections -yourself, please report them on the lammps-users mailing list, or file -them as an issue or pull request on the LAMMPS GitHub project. +yourself, please report them on the +`LAMMPS forum at MatSci `_, +or file them as an issue or pull request on the LAMMPS GitHub project. .. _msvc: @@ -98,6 +102,10 @@ It is possible to use both the integrated CMake support of the Visual Studio IDE or use an external CMake installation (e.g. downloaded from cmake.org) to create build files and compile LAMMPS from the command line. +Compilation via command line and unit tests are checked automatically +for the LAMMPS development branch through +`GitHub Actions `_. + .. note:: Versions of Visual Studio before version 17.1 may scan the entire @@ -110,6 +118,10 @@ Please note, that for either approach CMake will create a so-called the command lines for building and testing LAMMPS must be adjusted accordingly. +The LAMMPS cmake folder contains a ``CMakeSettings.json`` file with +build configurations for MSVC compilers and the MS provided Clang +compiler package in Debug and Release mode. + To support running in parallel you can compile with OpenMP enabled using the OPENMP package or install Microsoft MPI (including the SDK) and compile LAMMPS with MPI enabled. @@ -117,8 +129,55 @@ LAMMPS with MPI enabled. .. note:: This is work in progress and you should contact the LAMMPS developers - via GitHub, the forum, or the mailing list, if you have questions or - LAMMPS specific problems. + via GitHub or the `LAMMPS forum at MatSci `_, + if you have questions or LAMMPS specific problems. + +.. _oneapi: + +Using Intel oneAPI Compilers and Libraries +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 31May2022 + +After installing the `Intel oneAPI +`_ +base toolkit and the HPC toolkit, it is also possible to compile large +parts of LAMMPS natively on Windows using Intel compilers. The HPC +toolkit provides two sets of C/C++ and Fortran compilers: the so-called +"classic" compilers (``icl.exe`` and ``ifort.exe``) and newer, LLVM +based compilers (``icx.exe`` and ``ifx.exe``). In addition to the +compilers and their dependent modules, also the thread building blocks +(TBB) and the math kernel library (MKL) need to be installed. Two +presets (``cmake/presets/windows-intel-llvm.cmake`` and +``cmake/presets/windows-intel-classic.cmake``) are provided for +selecting the LLVM based or classic compilers, respectively. The preset +``cmake/presets/windows.cmake`` enables compatible packages that are not +dependent on additional features or libraries. You **must** use the +CMake based build procedure and use Ninja as build tool. For compiling +from the command prompt, thus both `CMake `_ and +`Ninja-build `_ binaries must be installed. It +is also possible to use Visual Studio, if it is started (``devenv.exe``) +from a command prompt that has the Intel oneAPI compilers enabled. The +Visual Studio settings file in the ``cmake`` folder contains +configurations for both compiler variants in debug and release settings. +Those will use the CMake and Ninja binaries bundled with Visual Studio, +thus a separate installation is not required. + +.. admonition:: Known Limitations + :class: note + + In addition to portability issues with several packages and external + libraries, the classic Intel compilers are currently not able to + compile the googletest libraries and thus enabling the ``-DENABLE_TESTING`` + option will result in compilation failure. The LLVM based compilers + are compatible. + +.. note:: + + This is work in progress and you should contact the LAMMPS developers + via GitHub or the `LAMMPS forum at MatSci `_, + if you have questions or LAMMPS specific problems. + .. _cross: @@ -144,14 +203,3 @@ LAMMPS developers. We instead rely on the feedback of the users of these pre-compiled LAMMPS packages for Windows. We will try to resolve issues to the best of our abilities if we become aware of them. However this is subject to time constraints and focus on HPC platforms. - -.. _native: - -Native Visual C++ support -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Support for the Visual C++ compilers is currently not available. The -CMake build system is capable of creating suitable a Visual Studio -style build environment, but the LAMMPS source code itself is not -ported to fully support Visual C++. Volunteers to take on this task -are welcome. diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index 8995ffdcc4..a868ad84fc 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -14,7 +14,7 @@ General commands ================ -An alphabetic list of all general LAMMPS commands. +An alphabetic list of general LAMMPS commands. .. table_from_list:: :columns: 5 @@ -47,36 +47,26 @@ An alphabetic list of all general LAMMPS commands. * :doc:`displace_atoms ` * :doc:`dump ` * :doc:`dump_modify ` - * :doc:`dynamical_matrix (k) ` * :doc:`echo ` * :doc:`fix ` * :doc:`fix_modify ` * :doc:`group ` - * :doc:`group2ndx ` - * :doc:`hyper ` * :doc:`if ` * :doc:`improper_coeff ` * :doc:`improper_style ` * :doc:`include ` * :doc:`info ` * :doc:`jump ` - * :doc:`kim ` * :doc:`kspace_modify ` * :doc:`kspace_style ` * :doc:`label