Commit 1776ade7 authored by Richard Berger's avatar Richard Berger
Browse files

Update CMake README.md

parent 3bb8fefb
Loading
Loading
Loading
Loading
+99 −21
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ should get you started.
git clone https://github.com/lammps/lammps.git
mkdir lammps/build
cd lammps/build
cmake ../cmake [-DOPTION_A=VALUE_A -DOPTION_B=VALUE_B ...]
cmake [-D OPTION_A=VALUE_A -D OPTION_B=VALUE_B ...] ../cmake
make
```

@@ -174,7 +174,7 @@ presets can be found in the `cmake/presets` folder.
# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package
mkdir build
cd build
cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake
```

# Reference
@@ -265,6 +265,16 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
  </dl>
  </td>
</tr>
<tr>
  <td><code>BUILD_LIB</code></td>
  <td>control whether to build LAMMPS as a library</td>
  <td>
  <dl>
    <dt><code>off</code> (default)</dt>
    <dt><code>on</code></dt>
  </dl>
  </td>
</tr>
<tr>
  <td><code>BUILD_SHARED_LIBS</code></td>
  <td>control whether to build LAMMPS as a shared-library</td>
@@ -315,8 +325,8 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
  `mpicxx` in your path and use this MPI implementation.</td>
  <td>
  <dl>
    <dt><code>off</code> (default)</dt>
    <dt><code>on</code></dt>
    <dt><code>on</code> (default, if found)</dt>
    <dt><code>off</code></dt>
  </dl>
  </td>
</tr>
@@ -325,8 +335,8 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on
  <td>control whether to build LAMMPS with OpenMP support.</td>
  <td>
  <dl>
    <dt><code>off</code> (default)</dt>
    <dt><code>on</code></dt>
    <dt><code>on</code> (default, if found)</dt>
    <dt><code>off</code></dt>
  </dl>
  </td>
</tr>
@@ -1271,7 +1281,7 @@ providing the identical features and USER interface.</strong></p>
  </td>
  <td>
  <dl>
    <dt><code>KISSFFT</code></dt>
    <dt><code>KISS</code></dt>
    <dt><code>FFTW3</code></dt>
    <dt><code>FFTW2</code></dt>
    <dt><code>MKL</code></dt>
@@ -1279,13 +1289,13 @@ providing the identical features and USER interface.</strong></p>
  </td>
</tr>
<tr>
  <td><code>PACK_ARRAY</code></td>
  <td><code>FFT_PACK</code></td>
  <td>Optimization for FFT</td>
  <td>
  <dl>
    <dt><code>PACK_ARRAY</code></dt>
    <dt><code>PACK_POINTER</code></dt>
    <dt><code>PACK_MEMCPY</code></dt>
    <dt><code>array (default)</code></dt>
    <dt><code>pointer</code></dt>
    <dt><code>memcpy</code></dt>
  </dl>
  </td>
</tr>
@@ -1377,6 +1387,29 @@ TODO

### PYTHON Package

### USER-INTEL Package

<table>
<thead>
<tr>
  <th>Option</th>
  <th>Description</th>
  <th>Values</th>
</tr>
</thead>
<tbody>
<tr>
  <td><code>INTEL_ARCH</code></td>
  <td>Target architecture for USER-INTEL package</td>
  <td>
  <dl>
    <dt><code>cpu</code> (default)</dt>
    <dt><code>knl</code></dt>
  </dl>
  </td>
</tr>
</tbody>
</table>

### GPU Package
The GPU package builds a support library which can either use OpenCL or CUDA as
@@ -1396,8 +1429,8 @@ target API.
  <td>API used by GPU package</td>
  <td>
  <dl>
    <dt><code>OpenCL</code> (default)</dt>
    <dt><code>CUDA</code></dt>
    <dt><code>opencl</code> (default)</dt>
    <dt><code>cuda</code></dt>
  </dl>
  </td>
</tr>
@@ -1406,9 +1439,9 @@ target API.
  <td>Precision size used by GPU package kernels</td>
  <td>
  <dl>
    <dt><code>SINGLE_DOUBLE</code></dt>
    <dt><code>SINGLE_SINGLE</code></dt>
    <dt><code>DOUBLE_DOUBLE</code></dt>
    <dt><code>mixed</code> (default)</dt>
    <dt><code>single</code></dt>
    <dt><code>double</code></dt>
  </dl>
  </td>
</tr>
@@ -1517,6 +1550,16 @@ Requires a Eigen3 installation
</tr>
</thead>
<tbody>
<tr>
  <td><code>WITH_JPEG</code></td>
  <td>Enables/Disable JPEG support in LAMMPS</td>
  <td>
  <dl>
    <dt><code>yes</code> (default, if found)</dt>
    <dt><code>no</code></dt>
  </dl>
  </td>
</tr>
<tr>
  <td><code>JPEG_INCLUDE_DIR</code></td>
  <td></td>
@@ -1544,6 +1587,16 @@ Requires a Eigen3 installation
</tr>
</thead>
<tbody>
<tr>
  <td><code>WITH_PNG</code></td>
  <td>Enables/Disable PNG support in LAMMPS</td>
  <td>
  <dl>
    <dt><code>yes</code> (default, if found)</dt>
    <dt><code>no</code></dt>
  </dl>
  </td>
</tr>
<tr>
  <td><code>PNG_INCLUDE_DIR</code></td>
  <td></td>
@@ -1572,6 +1625,16 @@ requires `gzip` to be in your `PATH`
</tr>
</thead>
<tbody>
<tr>
  <td><code>WITH_GZIP</code></td>
  <td>Enables/Disable GZIP support in LAMMPS</td>
  <td>
  <dl>
    <dt><code>yes</code> (default, if found)</dt>
    <dt><code>no</code></dt>
  </dl>
  </td>
</tr>
<tr>
  <td><code>GZIP_EXECUTABLE</code></td>
  <td></td>
@@ -1594,6 +1657,16 @@ requires `ffmpeg` to be in your `PATH`
</tr>
</thead>
<tbody>
<tr>
  <td><code>WITH_FFMPEG</code></td>
  <td>Enables/Disable FFMPEG support in LAMMPS</td>
  <td>
  <dl>
    <dt><code>yes</code> (default, if found)</dt>
    <dt><code>no</code></dt>
  </dl>
  </td>
</tr>
<tr>
  <td><code>FFMPEG_EXECUTABLE</code></td>
  <td></td>
@@ -1606,8 +1679,13 @@ requires `ffmpeg` to be in your `PATH`

## Compilers

By default, `cmake` will use your environment C/C++/Fortran compilers for a build. It uses the `CC`, `CXX` and `FC` environment variables to detect which compilers should be used. However, these values
will be cached after the first run of `cmake`. Subsequent runs of `cmake` will ignore changes in these environment variables. To ensure the correct values are used you avoid the cache by setting the `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`, `CMAKE_Fortran_COMPILER` options directly.
By default, `cmake` will use your environment C/C++/Fortran compilers for a
build. It uses the `CC`, `CXX` and `FC` environment variables to detect which
compilers should be used. However, these values will be cached after the first
run of `cmake`. Subsequent runs of `cmake` will ignore changes in these
environment variables. To ensure the correct values are used you avoid the
cache by setting the `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`,
`CMAKE_Fortran_COMPILER` options directly.

<table>
<thead>
@@ -1643,20 +1721,20 @@ will be cached after the first run of `cmake`. Subsequent runs of `cmake` will i
### Building with GNU Compilers

```bash
cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran
cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -D CMAKE_Fortran_COMPILER=gfortran ../cmake
```

### Building with Intel Compilers

```bash
cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort
cmake -D CMAKE_C_COMPILER=icc -D CMAKE_CXX_COMPILER=icpc -D CMAKE_Fortran_COMPILER=ifort ../cmake
```


### Building with LLVM/Clang Compilers

```bash
cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang
cmake -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_Fortran_COMPILER=flang ../cmake
```