From 26f9a84c4f156b743f953e4835fe538320bd5de7 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 14 Aug 2024 14:15:48 -0600 Subject: [PATCH] doc: more build section updates --- doc/src/Build_basics.rst | 31 +-- doc/src/Build_cmake.rst | 2 +- doc/src/Build_extras.rst | 492 ++++++++++++++++++++++++------------- doc/src/Build_link.rst | 10 +- doc/src/Build_make.rst | 2 +- doc/src/Build_package.rst | 58 +++-- doc/src/Build_settings.rst | 96 +++++--- 7 files changed, 451 insertions(+), 240 deletions(-) diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst index f01c32bda9..1473c182cf 100644 --- a/doc/src/Build_basics.rst +++ b/doc/src/Build_basics.rst @@ -38,8 +38,8 @@ standard. A more detailed discussion of that is below. .. code-block:: bash -D BUILD_MPI=value # yes or no, default is yes if CMake finds MPI - -D BUILD_OMP=value # yes or no, default is yes if a compatible compiler - # is detected + -D BUILD_OMP=value # yes or no, default is yes if a compatible + # compiler is detected -D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc # no default value @@ -268,7 +268,7 @@ LAMMPS. When the cmake command completes, it prints a summary to the screen which compilers it is using and what flags and settings will be used for the compilation. Note that if the top-level - compiler is mpicxx, it is simply a wrapper on a real compiler. + compiler is ``mpicxx``, it is simply a wrapper on a real compiler. The underlying compiler info is what CMake will try to determine and report. You should check to confirm you are using the compiler and optimization flags you want. @@ -287,19 +287,19 @@ LAMMPS. .. code-block:: make - CC = mpicxx - CCFLAGS = -g -O3 - LINK = mpicxx - LINKFLAGS = -g -O + CC = mpicxx + CCFLAGS = -g -O3 + LINK = mpicxx + LINKFLAGS = -g -O Serial build with GNU gcc (see ``src/MAKE/Makefile.serial``): .. code-block:: make - CC = g++ - CCFLAGS = -g -O3 - LINK = g++ - LINKFLAGS = -g -O + CC = g++ + CCFLAGS = -g -O3 + LINK = g++ + LINKFLAGS = -g -O .. note:: @@ -325,10 +325,10 @@ LAMMPS. there may be specific compiler or linker flags that are either required or recommended to enable required features and to achieve optimal performance. You need to include these in the - CCFLAGS and LINKFLAGS settings above. For details, see the + ``CCFLAGS`` and ``LINKFLAGS`` settings above. For details, see the documentation for the individual packages listed on the :doc:`Speed_packages` page. Or examine these files in the - src/MAKE/OPTIONS directory. They correspond to each of the 5 + ``src/MAKE/OPTIONS`` directory. They correspond to each of the 5 accelerator packages and their hardware variants: .. code-block:: bash @@ -498,8 +498,9 @@ using CMake or Make. .. code-block:: bash - -D BUILD_TOOLS=value # yes or no (default). Build binary2txt, chain.x, - # micelle2d.x, msi2lmp, phana, stl_bin2txt + -D BUILD_TOOLS=value # yes or no (default). Build binary2txt, + # chain.x, micelle2d.x, msi2lmp, phana, + # stl_bin2txt -D BUILD_LAMMPS_GUI=value # yes or no (default). Build LAMMPS-GUI The generated binaries will also become part of the LAMMPS installation diff --git a/doc/src/Build_cmake.rst b/doc/src/Build_cmake.rst index 9768d7066c..1b2bef936e 100644 --- a/doc/src/Build_cmake.rst +++ b/doc/src/Build_cmake.rst @@ -144,7 +144,7 @@ once, as the settings from the preset files are stored in the by adding one or more ``-D`` flags to the CMake command line. Generating files for alternate build tools (e.g. Ninja) and project files -for IDEs like Eclipse, CodeBlocks, or Kate can be selected using the *-G* +for IDEs like Eclipse, CodeBlocks, or Kate can be selected using the ``-G`` command line flag. A list of available generator settings for your specific CMake version is given when running ``cmake --help``. diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index eae247d66a..3282b9e76f 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -14,7 +14,7 @@ in addition to cmake -D PKG_NAME=yes - - .. code-block:: console + - .. code-block:: bash make yes-name @@ -73,7 +73,7 @@ COMPRESS package To build with this package you must have the `zlib compression library `_ available on your system to build dump styles with -a '/gz' suffix. There are also styles using the +a ``/gz`` suffix. There are also styles using the `Zstandard `_ library which have a '/zstd' suffix. The zstd library version must be at least 1.4. Older versions use an incompatible API and thus LAMMPS will fail to compile. @@ -95,7 +95,7 @@ versions use an incompatible API and thus LAMMPS will fail to compile. `_ tool to identify the necessary flags to compile with this library, so the corresponding ``libzstandard.pc`` file must be in a folder where - pkg-config can find it, which may require adding it to the + ``pkg-config`` can find it, which may require adding it to the ``PKG_CONFIG_PATH`` environment variable. .. tab:: Traditional make @@ -127,46 +127,53 @@ CMake build # value = double or mixed (default) or single -D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda # value = sm_XX (see below, default is sm_50) - -D GPU_DEBUG=value # enable debug code in the GPU package library, mostly useful for developers + -D GPU_DEBUG=value # enable debug code in the GPU package library, + # mostly useful for developers # value = yes or no (default) - -D HIP_PATH=value # value = path to HIP installation. Must be set if GPU_API=HIP + -D HIP_PATH=value # value = path to HIP installation. Must be set if + # GPU_API=HIP -D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip # value depends on selected HIP_PLATFORM - # default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for HIP_PLATFORM=nvcc + # default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for + # HIP_PLATFORM=nvcc -D HIP_USE_DEVICE_SORT=value # enables GPU sorting # value = yes (default) or no - -D CUDPP_OPT=value # use GPU binning on with CUDA (should be off for modern GPUs) - # enables CUDA Performance Primitives, must be "no" for CUDA_MPS_SUPPORT=yes + -D CUDPP_OPT=value # use GPU binning with CUDA (should be off for modern GPUs) + # enables CUDA Performance Primitives, must be "no" for + # CUDA_MPS_SUPPORT=yes # value = yes or no (default) - -D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon + -D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active + # nvidia-cuda-mps daemon # value = yes or no (default) - -D CUDA_BUILD_MULTIARCH=value # enables building CUDA kernels for all supported GPU architectures + -D CUDA_BUILD_MULTIARCH=value # enables building CUDA kernels for all supported GPU + # architectures # value = yes (default) or no - -D USE_STATIC_OPENCL_LOADER=value # downloads/includes OpenCL ICD loader library, no local OpenCL headers/libs needed + -D USE_STATIC_OPENCL_LOADER=value # downloads/includes OpenCL ICD loader library, + # no local OpenCL headers/libs needed # value = yes (default) or no -:code:`GPU_ARCH` settings for different GPU hardware is as follows: +``GPU_ARCH`` settings for different GPU hardware is as follows: -* 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) -* sm_60 or sm_61 for Pascal (supported since CUDA 8) -* sm_70 for Volta (supported since CUDA 9) -* sm_75 for Turing (supported since CUDA 10) -* sm_80 or sm_86 for Ampere (supported since CUDA 11, sm_86 since CUDA 11.1) -* sm_89 for Lovelace (supported since CUDA 11.8) -* sm_90 for Hopper (supported since CUDA 12.0) +* ``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) +* ``sm_60`` or ``sm_61`` for Pascal (supported since CUDA 8) +* ``sm_70`` for Volta (supported since CUDA 9) +* ``sm_75`` for Turing (supported since CUDA 10) +* ``sm_80`` or sm_86 for Ampere (supported since CUDA 11, sm_86 since CUDA 11.1) +* ``sm_89`` for Lovelace (supported since CUDA 11.8) +* ``sm_90`` for Hopper (supported since CUDA 12.0) A more detailed list can be found, for example, at `Wikipedia's CUDA article `_ CMake can detect which version of the CUDA toolkit is used and thus will try to include support for **all** major GPU architectures supported by -this toolkit. Thus the GPU_ARCH setting is merely an optimization, to +this toolkit. 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. This behavior can be turned off (e.g. to speed up compilation) by -setting :code:`CUDA_ENABLE_MULTIARCH` to :code:`no`. +setting ``CUDA_ENABLE_MULTIARCH`` to ``no``. 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, @@ -185,21 +192,21 @@ build, and link with a static OpenCL ICD loader library and standard OpenCL headers. This way no local OpenCL development headers or library needs to be present and only OpenCL compatible drivers need to be installed to use OpenCL. If this is not desired, you can set -:code:`USE_STATIC_OPENCL_LOADER` to :code:`no`. +``USE_STATIC_OPENCL_LOADER`` to ``no``. The GPU library has some multi-thread support using OpenMP. If LAMMPS is built with ``-D BUILD_OMP=on`` this will also be enabled. If you are compiling with HIP, note that before running CMake you will have to set appropriate environment variables. Some variables such as -:code:`HCC_AMDGPU_TARGET` (for ROCm <= 4.0) or :code:`CUDA_PATH` are -necessary for :code:`hipcc` and the linker to work correctly. +``HCC_AMDGPU_TARGET`` (for ROCm <= 4.0) or ``CUDA_PATH`` are +necessary for ``hipcc`` and the linker to work correctly. .. versionadded:: 3Aug2022 Using the CHIP-SPV implementation of HIP is supported. It allows one to run HIP code on Intel GPUs via the OpenCL or Level Zero backends. To use -CHIP-SPV, you must set :code:`-DHIP_USE_DEVICE_SORT=OFF` in your CMake +CHIP-SPV, you must set ``-DHIP_USE_DEVICE_SORT=OFF`` in your CMake command line as CHIP-SPV does not yet support hipCUB. As of Summer 2022, the use of HIP for Intel GPUs is experimental. You should only use this option in preparations to run on Aurora system at Argonne. @@ -263,22 +270,22 @@ script with the specified args: make lib-gpu args="-m mpi -a sm_60 -p mixed -b" # build GPU library with mixed precision and P100 using other settings in Makefile.mpi Note that this procedure starts with a Makefile.machine in lib/gpu, as -specified by the "-m" switch. For your convenience, machine makefiles +specified by the ``-m`` switch. For your convenience, machine makefiles for "mpi" and "serial" are provided, which have the same settings as the corresponding machine makefiles in the main LAMMPS source folder. In addition you can alter 4 important settings in the -Makefile.machine you start from via the corresponding -c, -a, -p, -e +Makefile.machine you start from via the corresponding ``-c``, ``-a``, ``-p``, ``-e`` switches (as in the examples above), and also save a copy of the new Makefile if desired: * ``CUDA_HOME`` = where NVIDIA CUDA software is installed on your system -* ``CUDA_ARCH`` = sm_XX, what GPU hardware you have, same as CMake GPU_ARCH above +* ``CUDA_ARCH`` = ``sm_XX``, what GPU hardware you have, same as CMake ``GPU_ARCH`` above * ``CUDA_PRECISION`` = precision (double, mixed, single) -* ``EXTRAMAKE`` = which Makefile.lammps.\* file to copy to Makefile.lammps +* ``EXTRAMAKE`` = which ``Makefile.lammps.*`` file to copy to Makefile.lammps -The file Makefile.cuda is set up to include support for multiple +The file ``Makefile.cuda`` is set up to include support for multiple GPU architectures as supported by the CUDA toolkit in use. This is done -through using the "--gencode " flag, which can be used multiple times and +through using the ``--gencode`` flag, which can be used multiple times and thus support all GPU architectures supported by your CUDA compiler. To enable GPU binning via CUDA performance primitives set the Makefile variable @@ -349,12 +356,16 @@ minutes to hours) to build. Of course you only need to do that once.) .. code-block:: bash - -D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes - -D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on - -D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer, value = no (default) or yes - -D KIM_EXTRA_UNITTESTS=value # enables extra unit tests, value = no (default) or yes + -D DOWNLOAD_KIM=value # download OpenKIM API v2 for build + # value = no (default) or yes + -D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off + # value = off (default) or on + -D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer + # value = no (default) or yes + -D KIM_EXTRA_UNITTESTS=value # enables extra unit tests + # value = no (default) or yes - If ``DOWNLOAD_KIM`` is set to *yes* (or *on*), the KIM API library + If ``DOWNLOAD_KIM`` is set to ``yes`` (or ``on``), the KIM API library will be downloaded and built inside the CMake build directory. If the KIM library is already installed on your system (in a location where CMake cannot find it), you may need to set the @@ -362,7 +373,7 @@ minutes to hours) to build. Of course you only need to do that once.) found, or run the command ``source kim-api-activate``. Extra unit tests can only be available if they are explicitly requested - (``KIM_EXTRA_UNITTESTS`` is set to *yes* (or *on*)) and the prerequisites + (``KIM_EXTRA_UNITTESTS`` is set to ``yes`` (or ``on``)) and the prerequisites are met. See :ref:`KIM Extra unit tests ` for more details on this. @@ -376,15 +387,28 @@ minutes to hours) to build. Of course you only need to do that once.) .. code-block:: bash - make lib-kim # print help message - make lib-kim args="-b " # (re-)install KIM API lib with only example models - make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model - make lib-kim args="-b -a everything" # install KIM API lib with all models - make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver - make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location - make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver + # print help message + make lib-kim - When using the "-b " option, the KIM library is built using its native + # (re-)install KIM API lib with only example models + make lib-kim args="-b " + + # ditto plus one model + make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" + + # install KIM API lib with all models + make lib-kim args="-b -a everything" + + # add one model or model driver + make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" + + # use an existing KIM API installation at the provided location + make lib-kim args="-p " + + # ditto but add one model or driver + make lib-kim args="-p -a EAM_Dynamo_Ackland_W__MO_141627196590_002" + + When using the ``-b `` option, the KIM library is built using its native cmake build system. The ``lib/kim/Install.py`` script supports a ``CMAKE`` environment variable if the cmake executable is named other than ``cmake`` on your system. Additional environment variables may be @@ -394,7 +418,9 @@ minutes to hours) to build. Of course you only need to do that once.) .. code-block:: bash - CMAKE=cmake3 CXX=g++-11 CC=gcc-11 FC=gfortran-11 make lib-kim args="-b " # (re-)install KIM API lib using cmake3 and gnu v11 compilers with only example models + # (re-)install KIM API lib using cmake3 and gnu v11 compilers + # with only example models + CMAKE=cmake3 CXX=g++-11 CC=gcc-11 FC=gfortran-11 make lib-kim args="-b " Settings for debugging OpenKIM web queries discussed below need to be applied by adding them to the ``LMP_INC`` variable through @@ -434,7 +460,7 @@ KIM Extra unit tests (CMake only) During development, testing, or debugging, if :doc:`unit testing ` is enabled in LAMMPS, one can also enable extra tests on :doc:`KIM commands ` by setting the -``KIM_EXTRA_UNITTESTS`` to *yes* (or *on*). +``KIM_EXTRA_UNITTESTS`` to ``yes`` (or ``on``). Enabling the extra unit tests have some requirements, @@ -449,10 +475,10 @@ Enabling the extra unit tests have some requirements, *conda-forge* channel as ``conda install kim-property`` if LAMMPS is built in Conda. More detailed information is available at: `kim-property installation `_. -* It is also necessary to install - ``EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000``, - ``EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005``, and - ``LennardJones612_UniversalShifted__MO_959249795837_003`` KIM models. +* It is also necessary to install the following KIM models: + - ``EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000`` + - ``EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005`` + - ``LennardJones612_UniversalShifted__MO_959249795837_003`` See `Obtaining KIM Models `_ to learn how to install a pre-built binary of the OpenKIM Repository of Models or see @@ -729,7 +755,8 @@ This list was last updated for version 4.3.0 of the Kokkos library. mkdir build-kokkos-cuda cd build-kokkos-cuda - cmake -C ../cmake/presets/basic.cmake -C ../cmake/presets/kokkos-cuda.cmake ../cmake + cmake -C ../cmake/presets/basic.cmake \ + -C ../cmake/presets/kokkos-cuda.cmake ../cmake cmake --build . .. tab:: Basic traditional make settings: @@ -757,9 +784,10 @@ This list was last updated for version 4.3.0 of the Kokkos library. .. code-block:: make KOKKOS_DEVICES = Cuda - KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU - KOKKOS_CUDA_OPTIONS = "enable_lambda" + KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is + # hosting the GPU # GPUARCH = GPU from list above + KOKKOS_CUDA_OPTIONS = "enable_lambda" FFT_INC = -DFFT_CUFFT # enable use of cuFFT (optional) FFT_LIB = -lcufft # link to cuFFT library @@ -787,10 +815,11 @@ This list was last updated for version 4.3.0 of the Kokkos library. .. code-block:: make KOKKOS_DEVICES = HIP - KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU + 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 + FFT_INC = -DFFT_HIPFFT # enable use of hipFFT (optional) + FFT_LIB = -lhipfft # link to hipFFT library Advanced KOKKOS compilation settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -874,11 +903,16 @@ included in the LAMMPS source distribution in the ``lib/lepton`` folder. .. code-block:: bash - make lib-lepton # print help message - make lib-lepton args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - make lib-lepton args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + # print help message + make lib-lepton - The "machine" argument of the "-m" flag is used to find a + # build with GNU g++ compiler (settings as with "make serial") + make lib-lepton args="-m serial" + + # build with default MPI compiler (settings as with "make mpi") + make lib-lepton args="-m mpi" + + The "machine" argument of the ``-m`` flag is used to find a Makefile.machine to use as build recipe. The build should produce a ``build`` folder and the library ``lib/lepton/liblmplepton.a`` @@ -900,7 +934,8 @@ Eigen3 is a template library, so you do not need to build it. .. code-block:: bash -D DOWNLOAD_EIGEN3 # download Eigen3, value = no (default) or yes - -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a custom location) + -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a + # custom location) If ``DOWNLOAD_EIGEN3`` is set, the Eigen3 library will be downloaded and inside the CMake build directory. If the Eigen3 @@ -918,9 +953,14 @@ Eigen3 is a template library, so you do not need to build it. .. code-block:: bash - make lib-machdyn # print help message - make lib-machdyn args="-b" # download to lib/machdyn/eigen3 - make lib-machdyn args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 + # print help message + make lib-machdyn + + # download to lib/machdyn/eigen3 + make lib-machdyn args="-b" + + # use existing Eigen installation in /usr/include/eigen3 + make lib-machdyn args="-p /usr/include/eigen3" Note that a symbolic (soft) link named ``includelink`` is created in ``lib/machdyn`` to point to the Eigen dir. When LAMMPS builds it @@ -994,7 +1034,7 @@ OPT package The compiler flag ``-restrict`` must be used to build LAMMPS with the OPT package when using Intel compilers. It should be added to - the :code:`CCFLAGS` line of your ``Makefile.machine``. See + the ``CCFLAGS`` line of your ``Makefile.machine``. See ``src/MAKE/OPTIONS/Makefile.opt`` for an example. ---------- @@ -1021,10 +1061,17 @@ POEMS package .. code-block:: bash - make lib-poems # print help message - make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") - make lib-poems args="-m icc" # build with Intel icc compiler + # print help message + make lib-poems + + # build with GNU g++ compiler (settings as with "make serial") + make lib-poems args="-m serial" + + # build with default MPI C++ compiler (settings as with "make mpi") + make lib-poems args="-m mpi" + + # build with Intel icc compiler + make lib-poems args="-m icc" The build should produce two files: ``lib/poems/libpoems.a`` and ``lib/poems/Makefile.lammps``. The latter is copied from an @@ -1088,9 +1135,12 @@ binary package provided by your operating system. .. code-block:: bash - -D DOWNLOAD_VORO=value # download Voro++ for build, value = no (default) or yes - -D VORO_LIBRARY=path # Voro++ library file (only needed if at custom location) - -D VORO_INCLUDE_DIR=path # Voro++ include directory (only needed if at custom location) + -D DOWNLOAD_VORO=value # download Voro++ for build + # value = no (default) or yes + -D VORO_LIBRARY=path # Voro++ library file + # (only needed if at custom location) + -D VORO_INCLUDE_DIR=path # Voro++ include directory + # (only needed if at custom location) If ``DOWNLOAD_VORO`` is set, the Voro++ library will be downloaded and built inside the CMake build directory. If the Voro++ library @@ -1110,12 +1160,19 @@ binary package provided by your operating system. .. code-block:: bash - make lib-voronoi # print help message - make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++- - make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++ - make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 + # print help message + make lib-voronoi - Note that 2 symbolic (soft) links, ``includelink`` and + # download and build the default version in lib/voronoi/voro++- + make lib-voronoi args="-b" + + # use existing Voro++ installation in $HOME/voro++ + make lib-voronoi args="-p $HOME/voro++" + + # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 + make lib-voronoi args="-b -v voro++0.4.6" + + Note that two symbolic (soft) links, ``includelink`` and ``liblink``, are created in lib/voronoi to point to the Voro++ source dir. When LAMMPS builds in ``src`` it will use these links. You should not need to edit the @@ -1189,10 +1246,17 @@ The ATC package requires the MANYBODY package also be installed. .. code-block:: bash - make lib-atc # print help message - make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - make lib-atc args="-m icc" # build with Intel icc compiler + # print help message + make lib-atc + + # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + make lib-atc args="-m serial" + + # build with default MPI compiler (settings as with "make mpi") + make lib-atc args="-m mpi" + + # build with Intel icc compiler + make lib-atc args="-m icc" The build should produce two files: ``lib/atc/libatc.a`` and ``lib/atc/Makefile.lammps``. The latter is copied from an @@ -1211,10 +1275,17 @@ The ATC package requires the MANYBODY package also be installed. .. code-block:: bash - make lib-linalg # print help message - make lib-linalg args="-m serial" # build with GNU C++ compiler (settings as with "make serial") - make lib-linalg args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") - make lib-linalg args="-m g++" # build with GNU Fortran compiler + # print help message + make lib-linalg + + # build with GNU C++ compiler (settings as with "make serial") + make lib-linalg args="-m serial" + + # build with default MPI C++ compiler (settings as with "make mpi") + make lib-linalg args="-m mpi" + + # build with GNU Fortran compiler + make lib-linalg args="-m g++" ---------- @@ -1240,10 +1311,17 @@ AWPMD package .. code-block:: bash - make lib-awpmd # print help message - make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - make lib-awpmd args="-m icc" # build with Intel icc compiler + # print help message + make lib-awpmd + + # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + make lib-awpmd args="-m serial" + + # build with default MPI compiler (settings as with "make mpi") + make lib-awpmd args="-m mpi" + + # build with Intel icc compiler + make lib-awpmd args="-m icc" The build should produce two files: ``lib/awpmd/libawpmd.a`` and ``lib/awpmd/Makefile.lammps``. The latter is copied from an @@ -1262,10 +1340,17 @@ AWPMD package .. code-block:: bash - make lib-linalg # print help message - make lib-linalg args="-m serial" # build with GNU C++ compiler (settings as with "make serial") - make lib-linalg args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") - make lib-linalg args="-m g++" # build with GNU C++ compiler + # print help message + make lib-linalg + + # build with GNU C++ compiler (settings as with "make serial") + make lib-linalg args="-m serial" + + # build with default MPI C++ compiler (settings as with "make mpi") + make lib-linalg args="-m mpi" + + # build with GNU C++ compiler + make lib-linalg args="-m g++" ---------- @@ -1298,10 +1383,17 @@ module included in the LAMMPS source distribution. .. code-block:: bash - make lib-colvars # print help message - make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled + # print help message + make lib-colvars + + # build with GNU g++ compiler (settings as with "make serial") + make lib-colvars args="-m serial" + + # build with default MPI compiler (settings as with "make mpi") + make lib-colvars args="-m mpi" + + # build with GNU g++ compiler and colvars debugging enabled + make lib-colvars args="-m g++-debug" The "machine" argument of the "-m" flag is used to find a ``Makefile.machine`` file to use as build recipe. If such recipe does @@ -1320,8 +1412,11 @@ module included in the LAMMPS source distribution. .. code-block:: bash - COLVARS_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower) - COLVARS_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise) + # Build with debug code (much slower) + COLVARS_DEBUG=yes make lib-colvars args="-m machine" + + # Build without Lepton (included otherwise) + COLVARS_LEPTON=no make lib-colvars args="-m machine" The build should produce two files: the library ``lib/colvars/libcolvars.a`` and the specification file @@ -1368,9 +1463,14 @@ This package depends on the KSPACE package. .. code-block:: bash - make lib-electrode # print help message - make lib-electrode args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - make lib-electrode args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + # print help message + make lib-electrode + + # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + make lib-electrode args="-m serial" + + # build with default MPI compiler (settings as with "make mpi") + make lib-electrode args="-m mpi" Note that the ``Makefile.lammps`` file has settings for the BLAS @@ -1381,10 +1481,17 @@ This package depends on the KSPACE package. .. code-block:: bash - make lib-linalg # print help message - make lib-linalg args="-m serial" # build with GNU C++ compiler (settings as with "make serial") - make lib-linalg args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") - make lib-linalg args="-m g++" # build with GNU C++ compiler + # print help message + make lib-linalg + + # build with GNU C++ compiler (settings as with "make serial") + make lib-linalg args="-m serial" + + # build with default MPI C++ compiler (settings as with "make mpi") + make lib-linalg args="-m mpi" + + # build with GNU C++ compiler + make lib-linalg args="-m g++" The package itself is activated with ``make yes-KSPACE`` and ``make yes-ELECTRODE`` @@ -1424,8 +1531,11 @@ at: `https://github.com/ICAMS/lammps-user-pace/ - make lib-scafacos args="-p $HOME/scafacos # use existing ScaFaCoS installation in $HOME/scafacos + # print help message + make lib-scafacos - Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``, are + # download and build in lib/scafacos/scafacos- + make lib-scafacos args="-b" + + # use existing ScaFaCoS installation in $HOME/scafacos + make lib-scafacos args="-p $HOME/scafacos + + Note that two symbolic (soft) links, ``includelink`` and ``liblink``, are created in ``lib/scafacos`` to point to the ScaFaCoS src dir. When LAMMPS builds in src it will use these links. You should not need to edit the ``lib/scafacos/Makefile.lammps`` file. diff --git a/doc/src/Build_link.rst b/doc/src/Build_link.rst index efd6691d30..255a451b29 100644 --- a/doc/src/Build_link.rst +++ b/doc/src/Build_link.rst @@ -37,7 +37,7 @@ executable code from the library is copied into the calling executable. .. tab:: CMake build This assumes that LAMMPS has been configured without setting a - ``LAMMPS_MACHINE`` name, installed with "make install", and the + ``LAMMPS_MACHINE`` name, installed with ``make install``, and the ``PKG_CONFIG_PATH`` environment variable has been updated to include the ``liblammps.pc`` file installed into the configured destination folder. The commands to compile and link a coupled @@ -59,10 +59,10 @@ executable code from the library is copied into the calling executable. mpicc -c -O -I${HOME}/lammps/src caller.c mpicxx -o caller caller.o -L${HOME}/lammps/src -llammps_mpi - The *-I* argument is the path to the location of the ``library.h`` + The ``-I`` argument is the path to the location of the ``library.h`` header file containing the interface to the LAMMPS C-style library - interface. The *-L* argument is the path to where the - ``liblammps_mpi.a`` file is located. The *-llammps_mpi* argument + interface. The ``-L`` argument is the path to where the + ``liblammps_mpi.a`` file is located. The ``-llammps_mpi`` argument is shorthand for telling the compiler to link the file ``liblammps_mpi.a``. If LAMMPS has been built as a shared library, then the linker will use ``liblammps_mpi.so`` instead. @@ -142,7 +142,7 @@ When linking to LAMMPS built as a shared library, the situation becomes much simpler, as all dependent libraries and objects are either included in the shared library or registered as a dependent library in the shared library file. Thus, those libraries need not be specified when linking -the calling executable. Only the *-I* flags are needed. So the example +the calling executable. Only the ``-I`` flags are needed. So the example case from above of the serial version static LAMMPS library with the POEMS package installed becomes: diff --git a/doc/src/Build_make.rst b/doc/src/Build_make.rst index f6764100e0..932050d410 100644 --- a/doc/src/Build_make.rst +++ b/doc/src/Build_make.rst @@ -25,7 +25,7 @@ additional tools to be available and functioning. require adding flags like ``-std=c++11`` to enable the C++11 mode. * A Bourne shell compatible "Unix" shell program (frequently this is ``bash``) * A few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname`` - * Python (optional, required for ``make lib-`` in the src + * Python (optional, required for ``make lib-`` in the ``src`` folder). Python scripts are currently tested with python 2.7 and 3.6 to 3.11. The procedure for :doc:`building the documentation ` *requires* Python 3.5 or later. diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index b70a1ca4d1..8b2da8ad30 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -100,10 +100,10 @@ versus make. .. code-block:: bash cd lammps/src - make ps # check which packages are currently installed - make yes-name # install a package with name - make no-name # uninstall a package with name - make mpi # build LAMMPS with whatever packages are now installed + make ps # check which packages are currently installed + make yes-name # install a package with name + make no-name # uninstall a package with name + make mpi # build LAMMPS with whatever packages are now installed Examples: @@ -172,18 +172,41 @@ make a copy of one of them and modify it to suit your needs. .. code-block:: bash - cmake -C ../cmake/presets/basic.cmake [OPTIONS] ../cmake # enable just a few core packages - cmake -C ../cmake/presets/most.cmake [OPTIONS] ../cmake # enable most packages - cmake -C ../cmake/presets/download.cmake [OPTIONS] ../cmake # enable packages which download sources or potential files - cmake -C ../cmake/presets/nolib.cmake [OPTIONS] ../cmake # disable packages that do require extra libraries or tools - cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake # change settings to use the Clang compilers by default - cmake -C ../cmake/presets/gcc.cmake [OPTIONS] ../cmake # change settings to use the GNU compilers by default - cmake -C ../cmake/presets/intel.cmake [OPTIONS] ../cmake # change settings to use the Intel compilers by default - cmake -C ../cmake/presets/pgi.cmake [OPTIONS] ../cmake # change settings to use the PGI compilers by default - cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages - 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 - cmake -C ../cmake/presets/macos-multiarch.cmake [OPTIONS] ../cmake # compile serial multi-arch binaries on macOS + # enable just a few core packages + cmake -C ../cmake/presets/basic.cmake [OPTIONS] ../cmake + + # enable most packages + cmake -C ../cmake/presets/most.cmake [OPTIONS] ../cmake + + # enable packages which download sources or potential files + cmake -C ../cmake/presets/download.cmake [OPTIONS] ../cmake + + # disable packages that do require extra libraries or tools + cmake -C ../cmake/presets/nolib.cmake [OPTIONS] ../cmake + + # change settings to use the Clang compilers by default + cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake + + # change settings to use the GNU compilers by default + cmake -C ../cmake/presets/gcc.cmake [OPTIONS] ../cmake + + # change settings to use the Intel compilers by default + cmake -C ../cmake/presets/intel.cmake [OPTIONS] ../cmake + + # change settings to use the PGI compilers by default + cmake -C ../cmake/presets/pgi.cmake [OPTIONS] ../cmake + + # enable all packages + cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake + + # disable all packages + cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake + + # compile with MinGW cross-compilers + mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake + + # compile serial multi-arch binaries on macOS + cmake -C ../cmake/presets/macos-multiarch.cmake [OPTIONS] ../cmake Presets that have names starting with "windows" are specifically for compiling LAMMPS :doc:`natively on Windows ` and @@ -209,7 +232,8 @@ Example # GPU package and configure it for using CUDA. You can run. mkdir build cd build - cmake -C ../cmake/presets/most.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on -D GPU_API=cuda ../cmake + cmake -C ../cmake/presets/most.cmake -C ../cmake/presets/nolib.cmake \ + -D PKG_GPU=on -D GPU_API=cuda ../cmake # to add another package, say BODY to the previous configuration you can run: cmake -D PKG_BODY=on . diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index a2dfa386f3..dcf61a8d88 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -1,3 +1,7 @@ +.. raw:: latex + + \clearpage + Optional build settings ======================= @@ -54,7 +58,7 @@ LAMMPS can use them if they are available on your system. Alternatively, LAMMPS can use the `heFFTe `_ library for the MPI communication algorithms, which comes with many optimizations for -special cases, e.g. leveraging available 2D and 3D FFTs in the back end +special cases, e.g. leveraging available 2D and 3D FFTs in the backend libraries and better pipelining for packing and communication. .. tabs:: @@ -74,11 +78,11 @@ libraries and better pipelining for packing and communication. .. note:: When the Kokkos variant of a package is compiled and selected at run time, - the FFT library selected by the FFT_KOKKOS variable applies. Otherwise, + the FFT library selected by the ``FFT_KOKKOS`` variable applies. Otherwise, the FFT library selected by the FFT variable applies. - The same FFT settings apply to both. FFT_KOKKOS must be compatible with the - Kokkos back end - for example, when using the CUDA back end of Kokkos, - you must use either CUFFT or KISS. + The same FFT settings apply to both. ``FFT_KOKKOS`` must be compatible with the + Kokkos backend - for example, when using the CUDA backend of Kokkos, + you must use either ``CUFFT`` or ``KISS``. Usually these settings are all that is needed. If FFTW3 is selected, then CMake will try to detect, if threaded FFTW @@ -102,7 +106,7 @@ libraries and better pipelining for packing and communication. .. note:: - heFFTe comes with a builtin (= stock) back end for FFTs, i.e. a + heFFTe comes with a builtin (= stock) backend for FFTs, i.e. a default internal FFT implementation; however, this stock back end is intended for testing purposes only and is not optimized for production runs. @@ -116,32 +120,50 @@ libraries and better pipelining for packing and communication. .. code-block:: make - FFT_INC = -DFFT_FFTW3 # -DFFT_FFTW3, -DFFT_FFTW (same as -DFFT_FFTW3), - # -DFFT_MKL, or -DFFT_KISS - # default is KISS if not specified - FFT_INC = -DFFT_KOKKOS_CUFFT # -DFFT_KOKKOS_{FFTW,FFTW3,MKL,CUFFT,HIPFFT,KISS} - # default is KISS if not specified - FFT_INC = -DFFT_SINGLE # do not specify for double precision - FFT_INC = -DFFT_FFTW_THREADS # enable using threaded FFTW3 libraries - FFT_INC = -DFFT_MKL_THREADS # enable using threaded FFTs with MKL libraries - FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY - # default is FFT_PACK_ARRAY if not specified + FFT_INC = -DFFT_ # where is KISS (default), FFTW3, + # FFTW (same as FFTW3), or MKL + FFT_INC = -DFFT_KOKKOS_ # where is KISS (default), FFTW3, + # FFTW (same as FFTW3), MKL, CUFFT, or HIPFFT + FFT_INC = -DFFT_SINGLE # do not specify for double precision + FFT_INC = -DFFT_FFTW_THREADS # enable using threaded FFTW3 libraries + FFT_INC = -DFFT_MKL_THREADS # enable using threaded FFTs with MKL libraries + FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY + # default is FFT_PACK_ARRAY if not specified .. code-block:: make FFT_INC = -I/usr/local/include FFT_PATH = -L/usr/local/lib - FFT_LIB = -lhipfft # hipFFT either precision - FFT_LIB = -lcufft # cuFFT either precision - FFT_LIB = -lfftw3 # FFTW3 double precision - FFT_LIB = -lfftw3 -lfftw3_omp # FFTW3 double precision with threads - # (needs -DFFT_FFTW_THREADS) - FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision - FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # serial MKL with Intel compiler, - FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # serial MKL with GNU compiler, - FFT_LIB = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core # threaded MKL with Intel compiler - FFT_LIB = -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core # threaded MKL with GNU compiler - FFT_LIB = -lmkl_rt # MKL with automatic runtime selection of interface libs + + # hipFFT either precision + FFT_LIB = -lhipfft + + # cuFFT either precision + FFT_LIB = -lcufft + + # FFTW3 double precision + FFT_LIB = -lfftw3 + + # FFTW3 double precision with threads (needs -DFFT_FFTW_THREADS) + FFT_LIB = -lfftw3 -lfftw3_omp + + # FFTW3 single precision + FFT_LIB = -lfftw3 -lfftw3f + + # serial MKL with Intel compiler + FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core + + # serial MKL with GNU compiler + FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core + + # threaded MKL with Intel compiler + FFT_LIB = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core + + # threaded MKL with GNU compiler + FFT_LIB = -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core + + # MKL with automatic runtime selection of interface libs + FFT_LIB = -lmkl_rt As with CMake, you do not need to set paths in ``FFT_INC`` or ``FFT_PATH``, if the compiler can find the FFT header and library @@ -198,7 +220,7 @@ above). The cuFFT and hipFFT FFT libraries are packaged with NVIDIA's CUDA and AMD's HIP installations, respectively. These FFT libraries require the -Kokkos acceleration package to be enabled and the Kokkos back end to be +Kokkos acceleration package to be enabled and the Kokkos backend to be GPU-resident (i.e., HIP or CUDA). Performing 3d FFTs in parallel can be time-consuming due to data access @@ -233,7 +255,7 @@ ARRAY mode. When using ``-DFFT_HEFFTE`` CMake will first look for an existing install with hints provided by ``-DHeffte_ROOT``, as recommended by the CMake standard and note that the name is case sensitive. If CMake cannot -find a heFFTe installation with the correct back end (e.g., FFTW or +find a heFFTe installation with the correct backend (e.g., FFTW or MKL), it will attempt to download and build the library automatically. In this case, LAMMPS CMake will also accept all heFFTe specific variables listed in the `heFFTe documentation @@ -242,6 +264,10 @@ and those variables will be passed into the heFFTe build. ---------- +.. raw:: latex + + \clearpage + .. _size: Size of LAMMPS integer types and size limits @@ -512,11 +538,11 @@ LAMMPS is compiled accordingly which needs the following settings: Memory allocation alignment --------------------------- -This setting enables the use of the "posix_memalign()" call instead of -"malloc()" when LAMMPS allocates large chunks of memory. Vector +This setting enables the use of the ``posix_memalign()`` call instead of +``malloc()`` when LAMMPS allocates large chunks of memory. Vector instructions on CPUs may become more efficient, if dynamically allocated memory is aligned on larger-than-default byte boundaries. On most -current operating systems, the "malloc()" implementation returns +current operating systems, the ``malloc()`` implementation returns pointers that are aligned to 16-byte boundaries. Using SSE vector instructions efficiently, however, requires memory blocks being aligned on 64-byte boundaries. @@ -530,9 +556,9 @@ on 64-byte boundaries. -D LAMMPS_MEMALIGN=value # 0, 8, 16, 32, 64 (default) Use a ``LAMMPS_MEMALIGN`` value of 0 to disable using - "posix_memalign()" and revert to using the "malloc()" C-library + ``posix_memalign()`` and revert to using the ``malloc()`` C-library function instead. When compiling LAMMPS for Windows systems, - "malloc()" will always be used and this setting is ignored. + ``malloc()`` will always be used and this setting is ignored. .. tab:: Traditional make @@ -541,7 +567,7 @@ on 64-byte boundaries. LMP_INC = -DLAMMPS_MEMALIGN=value # 8, 16, 32, 64 Do not set ``-DLAMMPS_MEMALIGN``, if you want to have memory - allocated with the "malloc()" function call + allocated with the ``malloc()`` function call instead. ``-DLAMMPS_MEMALIGN`` **cannot** be used on Windows, as Windows different function calls with different semantics for allocating aligned memory, that are not compatible with how LAMMPS