Skip to content

Conversation

adodin
Copy link

@adodin adodin commented Feb 14, 2025

Overview

This pull request contains a full CMake build system for n2p2. It can optionally download and build LAMMPS with the USER_NNP package if desired. (NB: LAMMPS build still uses the LAMMPS Makefile build system and not their CMake build system). This is designed to mirror the existing Makefile system as closely as possible.

The primary benefit of this CMake system is that it automatically finds and builds all dependencies, i.e., MPI, GSL & Eigen and adapts automatically to the preferred distributions of this library on each system. This is particularly useful, e.g., when building n2p2 on more complicated clusters such as NERSC Perlmutter where different MPI distributions etc. are used based on the desired optimization settings.

Quickstart Build Instructions

To build all n2p2 applications (no LAMMPS), simply run the following commands from the n2p2 home directory:

mkdir build; cd build                                 # CMake requires a separate build directory
cmake  [-DOPTION=ON/OFF] ../src                       # CMake detects all settings and creates makefiles
make [-j N]                                           # Runs the autogenerated makefiles [Optionally in parallel]
make install                                          # Installs executables and headers in bin & lib directories respectively.

If downloading & building LAMMPS is desired, use the options -DDOWNLOAD_LAMMPS=ON -DBUILD_LAMMPS=ON and LAMMPS will build during the system. The download occurs in the cmake stage while the build happens during the make stage.

Build Options

The build options are documented below. Nearly all of the build options are identically ported over from the Makefile build system. To set the binary flags use the syntax -DOPTION_NAME=ON/OFF. Defaults are indicated in [].

If desired, these options can also be listed from command line by replacing the cmake command above (inside the build directory) with cmake -LAH ../src.

Basic Build Settings

  • BUILD_SHARED_LIBS: Build using shared libraries [OFF]
  • NDEBUG: Disable all C++ asserts (also Eigen debugging) [OFF]

N2P2 Compile Options

  • N2P2_NO_SF_GROUPS: Disable Symmetry function groups (NOT RECOMMENDED)" OFF)
  • N2P2_FULL_SFD_MEMORY: Store zero symmetry function derivatives [OFF]
  • N2P2_NO_SF_CACHE: Do not use symmetry function cache [OFF]
  • N2P2_NO_ASYM_POLY: Disable asymmetric polynomial symmetry functions [OFF]
  • N2P2_NO_TIME: Build with dummy Stopwatch class [OFF]
  • N2P2_NO_NEIGH_CHECK: Disable check for low number of neighbors [OFF]
  • N2P2_NO_MPI: Compile without MPI support [OFF]

Which interfaces to build in libnnpif

  • N2P2_IF_LAMMPS: Build LAMMPS interface into libnnpif [ON]
  • N2P2_IF_CABANA: Build CabanaMD interface into libnnpif [ON]

Eigen Optimization Options

  • EIGEN_DONT_PARALLELIZE: Disable Eigen multi threading. [ON]
  • EIGEN_USE_BLAS: Use BLAS together with Eigen. [ON]
  • EIGEN_USE_MKL_ALL: Use Intel MKL together with Eigen. [OFF]

LAMMPS Build Options

  • LAMMPS_INTERNAL: Build as internal package. Uses name nnp vs. hdnnp to avoid conflict with release version. [OFF]
  • BUILD_LAMMPS: Build minimal LAMMPS executable. (Either Specify DOWNLOAD_LAMMPS=ON or LAMMPS_PATH) [OFF]
  • DOWNLOAD_LAMMPS: Download LAMMPS. This supersedes LAMMPS_PATH variable. [OFF]
  • LAMMPS_VERSION: Which LAMMPS version to download [lammps-29Oct2020]
  • LAMMPS_PATH: Path where pre-downloaded LAMMPS code is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant