GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing docs.lammps.org — 3.6. Optional build settings — LAMMPS documentation 3.6. Optional build settingsLAMMPS can be built with several optional settings. Each subsection explains how to do this for building both with CMake and make. ++17 standard compliance C++17 standard compliance when building all of LAMMPS —————————————————– Changed in version 10Sep2025. A C++17 standard compatible compiler is currently the minimum requirement for compiling LAMMPS. LAMMPS version 22 July 2025 is the last version compatible with the C++11 standard for the core code and most packages. Most currently used C++ compilers are compatible with C++17, but some older ones may need extra flags to enable C++17 compliance. CCFLAGS = -g -O3 -std=c++17 Individual packages may require compliance with a later C++ standard like C++20. These requirements will be documented with the individual packages. 3.6.1. FFT libraryWhen the KSPACE package is included in a LAMMPS build, the kspace_style pppm or esp commands and their variants perform 3d FFTs which require use of an FFT library to compute 1d FFTs. The KISS FFT library is included with LAMMPS, but other libraries can be faster. LAMMPS can use them if they are available on your system. Added in version 7Feb2024. 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 libraries and better pipelining for packing and communication. -D FFT=value # FFTW3 or MKL or NVPL or KISS, # default is FFTW3 if found, else KISS -D FFT_KOKKOS=value # FFTW3 or MKL or NVPL or KISS or CUFFT # or HIPFFT or MKL_GPU, default is KISS -D FFT_SINGLE=value # on or off (default), off = double precision -D FFT_PACK=value # array (default) or pointer or memcpy -D FFT_USE_HEFFTE=value # on or off (default), on links to heFFTe Note When the Kokkos variant of a package is compiled and selected at run time,
the FFT library selected by the Usually these settings are all that is needed. If FFTW3 is selected, then CMake will try to detect, if threaded FFTW libraries are available and enable them by default. This setting is independent of whether OpenMP threads are enabled and a package like KOKKOS or OPENMP is used. If CMake cannot detect the FFT library, you can set these variables to assist: -D FFTW3_INCLUDE_DIR=path # path to FFTW3 include files -D FFTW3_LIBRARY=path # path to FFTW3 libraries -D FFTW3_OMP_LIBRARY=path # path to FFTW3 OpenMP wrapper libraries -D FFT_FFTW_THREADS=on # enable using OpenMP threaded FFTW3 libraries -D MKL_INCLUDE_DIR=path # ditto for Intel MKL library -D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries -D MKL_LIBRARY=path # path to MKL libraries -D FFT_HEFFTE_BACKEND=value # FFTW or MKL or empty/undefined for the stock # heFFTe back end -D Heffte_ROOT=path # path to an existing heFFTe installation -D nvpl_fft_INCLUDE_DIR=path # path to NVPL FFT include files -D nvpl_fft_LIBRARY_DIR=path # path to NVPL FFT libraries Note heFFTe comes with a builtin (= stock) back end 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. To change the FFT library to be used and its options, you have to edit your machine Makefile. Below are examples how the makefile variables could be changed. FFT_INC = -DFFT_<NAME> # where <NAME> is KISS (default), FFTW3, # FFTW (same as FFTW3), NVPL, or MKL FFT_INC = -DFFT_KOKKOS_<NAME> # where <NAME> is KISS (default), FFTW3, # FFTW (same as FFTW3), NVPL, MKL, CUFFT, # HIPFFT, or MKL_GPU 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 = -I/usr/local/include FFT_PATH = -L/usr/local/lib # hipFFT either precision FFT_LIB = -lhipfft # cuFFT either precision FFT_LIB = -lcufft # MKL_GPU either precision FFT_LIB = -lmkl_sycl_dft -lmkl_intel_ilp64 -lmkl_tbb_thread -lmkl_core -ltbb # 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 # threaded NVPL FFT FFT_LIB = -lnvpl_fftw As with CMake, you do not need to set paths in Traditional make can also link to heFFTe using an existing installation include <path-to-heffte-installation>/share/heffte/HeffteMakefile.in FFT_INC = -DFFT_HEFFTE -DFFT_HEFFTE_FFTW $(heffte_include) FFT_PATH = FFT_LIB = $(heffte_link) $(heffte_libs) The heFFTe install path will contain The KISS FFT library is included in the LAMMPS distribution. It is portable across all platforms. Depending on the size of the FFTs and the number of processors used, the other libraries listed here can be faster. However, note that long-range Coulombics are only a portion of the per-timestep CPU cost, FFTs are only a portion of long-range Coulombics, and 1d FFTs are only a portion of the FFT cost (parallel communication can be costly). A breakdown of these timings is printed to the screen at the end of a run when using the kspace_style pppm command. The Screen and logfile output page gives more details. A more detailed (and time consuming) report of the FFT performance is generated with the kspace_modify fftbench yes command. FFTW is a fast, portable FFT library that should also work on any platform and can be faster than the KISS FFT library. You can download it from www.fftw.org. LAMMPS requires version 3.X; the legacy version 2.1.X is no longer supported. Building FFTW for your box should be as simple as The Intel MKL math library is part of the Intel compiler suite. It
can be used with the Intel or GNU compiler (see the The NVIDIA Performance Libraries (NVPL) FFT library is optimized for NVIDIA Grace Armv9.0 architecture. You can download it from https://docs.nvidia.com/nvpl/ 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 GPU-resident (i.e., HIP or CUDA). Similarly, GPU offload of FFTs on Intel GPUs with oneMKL currently requires the Kokkos acceleration package to be enabled with the SYCL back end. Performing 3d FFTs in parallel can be time-consuming due to data access
and required communication. This cost can be reduced by performing
single-precision FFTs instead of double precision. Single precision
means the real and imaginary parts of a complex datum are 4-byte floats.
Double precision means they are 8-byte doubles. Note that Fourier
transform and related PPPM operations are somewhat less sensitive to
floating point truncation errors, and thus the resulting error is
generally less than the difference in precision. Using the
When using When compiling FFTW3 from source, you can do the following, which should
produce the additional libraries make clean ./configure --enable-single; make; make install Performing 3d FFTs requires communication to transpose the 3d FFT
grid. The data packing/unpacking for this can be done in one of 3
modes (ARRAY, POINTER, MEMCPY) as set by the When using 3.6.2. Size of LAMMPS integer types and size limitsLAMMPS uses a few custom integer data types, which can be defined as either 4-byte (= 32-bit) or 8-byte (= 64-bit) integers at compile time. This has an impact on the size of a system that can be simulated, or how large counters can become before “rolling over”. The default setting of “smallbig” is almost always adequate. With CMake the choice of integer types is made via setting a variable during configuration. -D LAMMPS_SIZES=value # smallbig (default) or bigbig If the variable is not set explicitly, “smallbig” is used. If you want a setting different from the default, you need to edit the
LMP_INC = -DLAMMPS_SMALLBIG # or -DLAMMPS_BIGBIG The default setting is LAMMPS system size restrictions
The “bigbig” setting increases the size of image flags and atom IDs over the default “smallbig” setting. These are limits for the core of the LAMMPS code, specific features or some styles may impose additional limits. Also, there are limitations when using the library interface where some functions with known issues have been replaced by dummy calls printing a corresponding error message rather than crashing randomly or corrupting data. Atom IDs are not required for atomic systems which do not store bond topology information, though IDs are enabled by default. The atom_modify id no command will turn them off. Atom IDs are required for molecular systems with bond topology (bonds, angles, dihedrals, etc). Similarly, some force or compute or fix styles require atom IDs. Thus, if you model a molecular system or use one of those styles with more than 2 billion atoms, you need the “bigbig” setting. Regardless of the total system size limits, the maximum number of atoms per MPI rank (local + ghost atoms) is limited to 2 billion for atomic systems and 500 million for systems with bonds (the additional restriction is due to using the 2 upper bits of the local atom index in neighbor lists for storing special bonds info). Image flags store 3 values per atom in a single integer, which count the number of times an atom has moved through the periodic box in each dimension. See the dump manual page for a discussion. If an atom moves through the periodic box more than this limit, the value will “roll over”, e.g. from 511 to -512, which can cause diagnostics like the mean-squared displacement, as calculated by the compute msd command, to be faulty. Also note that the GPU package requires its lib/gpu library to be
compiled with the same size setting, or the link will fail. A CMake
build does this automatically. When building with make, the setting
in whichever 3.6.3. Read or write compressed filesChanged in version 11Feb2026: Added support for Changed in version 13Nov2026. Support for compressed files no longer needs to be enabled at compile
time; the CMake option Large files can be read or written with compression by This feature requires that your operating system fully supports the
“popen()” function in the standard runtime library and that a Note On clusters with high-speed networks, using the “fork()” library call (required by “popen()”) can interfere with the fast communication library and lead to simulations using compressed output or input to hang or crash. For selected operations, compressed file I/O is also available using a compression library instead, which is what the COMPRESS package provides. 3.6.4. Support for downloading files from the inputAdded in version 29Aug2024. The geturl command command uses the the libcurl library to download files. This requires that LAMMPS is compiled accordingly which needs the following settings: -D WITH_CURL=value # on or off # default = yes if CMake finds CURL development files, else no Usually these settings are all that is needed. If CMake cannot find the graphics header, library, executable files, you can set these variables: -D CURL_INCLUDE_DIR=path # path to folder which contains curl.h header file -D CURL_LIBRARY=path # path to libcurls.a (.so) file LMP_INC = -DLAMMPS_CURL <other LMP_INC settings> CURL_INC = -I/usr/local/include # path to curl folder with curl.h CURL_PATH = -L/usr/lib # paths to libcurl.a(.so) if make cannot find it CURL_LIB = -lcurl # library names As with CMake, you do not need to set 3.6.5. Prevent download of large potential filesAdded in version 8Feb2023. LAMMPS bundles a selection of potential files in the 3.6.6. Memory allocation alignmentThis setting enables the use of the -D LAMMPS_MEMALIGN=value # 0, 8, 16, 32, 64 (default) Use a LMP_INC = -DLAMMPS_MEMALIGN=value # 8, 16, 32, 64 Do not set 3.6.7. Workaround for long long integersIf your system or MPI version does not recognize “long long” data types, the following setting will be needed. It converts “long long” to a “long” data type, which should be the desired 8-byte integer on those systems: -D LAMMPS_LONGLONG_TO_LONG=value # on or off (default) LMP_INC = -DLAMMPS_LONGLONG_TO_LONG <other LMP_INC settings> Exception handling when using LAMMPS as a library Exception handling when using LAMMPS as a library to capture errors ——————————————————————- LAMMPS errors do not kill the calling code, but throw an exception. In
the C-library interface, the call stack is unwound and control returns
to the caller, e.g. to Python or a code that is coupled to LAMMPS. The
error status can then be queried. When using C++ directly, the calling
code must be set up to catch exceptions thrown from within
LAMMPS. This is particularly necessary when running in parallel, since
a Note When LAMMPS is running in parallel, it is not always possible to cleanly recover from an exception since not all parallel ranks may throw an exception and thus other MPI ranks may get stuck waiting for messages from the ones with errors. | |||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |