Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| technical:recipes:lammps [2025-11-03 17:23] – created frey | technical:recipes:lammps [2025-11-04 11:49] (current) – frey | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ====== Where to install ====== | ====== Where to install ====== | ||
| + | |||
| + | As a first step, the appropriate file system location to hold builds of LAMMPS must be chosen. | ||
| ===== For the individual ===== | ===== For the individual ===== | ||
| Line 33: | Line 35: | ||
| <code bash> | <code bash> | ||
| - | [«workgroup»: | + | [PROMPT]$ echo $WORKDIR_SW |
| / | / | ||
| </ | </ | ||
| Line 39: | Line 41: | ||
| For workgroup software, VALET package definitions should be created in the '' | For workgroup software, VALET package definitions should be created in the '' | ||
| + | ====== Setup the package directory ====== | ||
| + | |||
| + | Whichever location was chosen, the LAMMPS software will be located in a subdirectory named '' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ LAMMPS_BASEDIR=" | ||
| + | [PROMPT]$ mkdir -p " | ||
| + | </ | ||
| + | |||
| + | Since the goal is to manage distinct versions and variants of LAMMPS, it's best to download source packages from the program' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ ( cd " | ||
| + | curl --remote-name --location \ | ||
| + | ' | ||
| + | ) | ||
| + | [PROMPT]$ ls -l " | ||
| + | total 219083 | ||
| + | -rw-r--r-- 1 user everyone 226349672 Nov 4 10:08 lammps-src-22Jul2025_update1.tar.gz | ||
| + | </ | ||
| + | |||
| + | This means we will use a version identifier of '' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ LAMMPS_VERSION=" | ||
| + | [PROMPT]$ LAMMPS_PREFIX=" | ||
| + | [PROMPT]$ mkdir -p " | ||
| + | </ | ||
| + | |||
| + | Finally, unpack the source code in the version' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ cd " | ||
| + | [PROMPT]$ tar -xf " | ||
| + | [PROMPT]$ls | ||
| + | lammps-22Jul2025 | ||
| + | [PROMPT]$ mv lammps-22Jul2025 src | ||
| + | </ | ||
| + | |||
| + | ====== Build the program ====== | ||
| + | |||
| + | To build LAMMPS, at the very least a C++ compiler toolchain must be selected. | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ vpkg_require --context=development openmpi/ | ||
| + | Adding dependency `libfabric/ | ||
| + | Adding dependency `binutils/ | ||
| + | Adding dependency `gcc/ | ||
| + | Adding dependency `intel-oneapi/ | ||
| + | Adding package `openmpi/ | ||
| + | </ | ||
| + | |||
| + | ===== Makefile fragment ===== | ||
| + | |||
| + | LAMMPS customizes the build environment by means of a Makefile fragment that gets included by the top-level Makefile. | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ cd " | ||
| + | [PROMPT]$ ls -l src/MAKE | ||
| + | total 72 | ||
| + | drwxr-xr-x 2 user everyone | ||
| + | -rw-r--r-- 1 user everyone 3616 Sep 1 19:29 Makefile.mpi | ||
| + | -rw-r--r-- 1 user everyone 3605 Sep 1 19:29 Makefile.serial | ||
| + | drwxr-xr-x 2 user everyone | ||
| + | drwxr-xr-x 2 user everyone | ||
| + | -rw-r--r-- 1 user everyone 4765 Sep 1 19:29 README | ||
| + | </ | ||
| + | |||
| + | Each subdirectory has a purpose: | ||
| + | |||
| + | * **MACHINES**: | ||
| + | * **MINE**: Makefile fragments created by the user/ | ||
| + | * **OPTIONS**: | ||
| + | |||
| + | The Intel + OpenMPI fragment at '' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ cp src/ | ||
| + | [PROMPT]$ head -1 src/ | ||
| + | # icc_openmpi = OpenMPI with compiler set to Intel icc | ||
| + | </ | ||
| + | |||
| + | The first line of the copy should be modified to match the suffix chosen on the filename ('' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ head -1 src/ | ||
| + | # caviness = Open MPI compiler atop Intel oneAPI 2023 | ||
| + | |||
| + | [PROMPT]$ cd src | ||
| + | [PROMPT]$ make | ||
| + | : | ||
| + | ... or one of these from src/ | ||
| + | |||
| + | # caviness = Open MPI compiler atop Intel oneAPI 2023 | ||
| + | |||
| + | </ | ||
| + | |||
| + | As it stands the program will build its own BLAS/ | ||
| + | |||
| + | < | ||
| + | : | ||
| + | #export OMPI_CXX = icc | ||
| + | CC = mpicxx | ||
| + | OPTFLAGS = -xHost -O2 -freciprocal-math | ||
| + | CCFLAGS = | ||
| + | -DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG $(OPTFLAGS) \ | ||
| + | -I$(MKLROOT)/ | ||
| + | : | ||
| + | LINKFLAGS = | ||
| + | LIB = | ||
| + | : | ||
| + | FFT_INC = | ||
| + | FFT_PATH = | ||
| + | FFT_LIB = | ||
| + | : | ||
| + | </ | ||
| + | |||
| + | The environment is now ready for the program to be built. | ||
| + | |||
| + | ===== Building the program ===== | ||
| + | |||
| + | With the environment configured, a copy of LAMMPS with default functionality can be build with the '' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ cd " | ||
| + | [PROMPT]$ make caviness | ||
| + | Gathering installed package information (may take a little while) | ||
| + | : | ||
| + | mpicxx -qopenmp-simd -qopenmp -xHost -O2 -ffast-math -freciprocal-math -L/ | ||
| + | size ../ | ||
| + | | ||
| + | 7162653 | ||
| + | make[1]: Leaving directory `/ | ||
| + | </ | ||
| + | |||
| + | If successful, the finished executable will be named '' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ ls -ld " | ||
| + | -rwxr-xr-x 1 user everyone 84486960 Nov 4 10:52 / | ||
| + | </ | ||
| + | |||
| + | ===== Installing the program ===== | ||
| + | |||
| + | The finished executable should be copied to a '' | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ mkdir " | ||
| + | [PROMPT]$ install -C lmp_caviness " | ||
| + | </ | ||
| + | |||
| + | The machine suffix is not retained and the program is renamed as '' | ||
| + | |||
| + | If, in the future, modifications must be made to this version/ | ||
| + | |||
| + | <note tip>Once a version/ | ||
| + | |||
| + | ===== Activating LAMMPS packages ===== | ||
| + | |||
| + | Additional LAMMPS functionality exists in // | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ cd " | ||
| + | [PROMPT]$ make ps | ||
| + | Installed | ||
| + | Installed | ||
| + | Installed | ||
| + | Installed | ||
| + | : | ||
| + | Installed | ||
| + | Installed | ||
| + | Installed | ||
| + | </ | ||
| + | |||
| + | One helpful package is the [[https:// | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT$ $ make yes-INTEL | ||
| + | Installing package INTEL | ||
| + | |||
| + | [PROMPT]$ make caviness | ||
| + | </ | ||
| + | |||
| + | Hybrid parallelism can be enabled by activating the [[https:// | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT$ $ make yes-OPENMP | ||
| + | Installing package OPENMP | ||
| + | |||
| + | [PROMPT]$ make caviness | ||
| + | </ | ||
| + | |||
| + | ====== VALET package definition ====== | ||
| + | |||
| + | By installing the finished executable in the '' | ||
| + | |||
| + | <note important> | ||
| + | |||
| + | Information to know before creating the package definition file: | ||
| + | |||
| + | * What was the '' | ||
| + | * What was the '' | ||
| + | * What VALET package(s) were loaded into the environment for the build? | ||
| + | |||
| + | In this instance the answers are: | ||
| + | |||
| + | * ''/ | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | The '' | ||
| + | |||
| + | The package definition file is written in YAML (YAML Ain't Markup Language): | ||
| + | |||
| + | <file yaml lammps.vpkg_yaml> | ||
| + | lammps: | ||
| + | prefix: / | ||
| + | description: | ||
| + | url: " | ||
| + | | ||
| + | default-version: | ||
| + | | ||
| + | versions: | ||
| + | " | ||
| + | description: | ||
| + | dependencies: | ||
| + | - openmpi/ | ||
| + | </ | ||
| + | |||
| + | With the VALET package definition created, it can be queried e.g. | ||
| + | |||
| + | <code bash> | ||
| + | [PROMPT]$ vpkg_versions lammps | ||
| + | |||
| + | Available versions in package (* = default version): | ||
| + | |||
| + | [/ | ||
| + | lammps | ||
| + | * 22Jul2025.1 | ||
| + | |||
| + | : | ||
| + | </ | ||
| + | |||
| + | ===== Using LAMMPS in jobs ===== | ||
| + | |||
| + | With the VALET package definition present, jobs can make use of LAMMPS by adding the appropriate version/ | ||
| + | |||
| + | <code bash> | ||
| + | vpkg_require lammps/ | ||
| + | </ | ||