Install and build¶
What gets built¶
A cpmdc build produces one shared library, libcpmdc.so, and a few helpers
around it.
The build has two modes, selected by the Meson option with_cpmd:
Mode |
Option |
Evaluator behind the C ABI |
|
|---|---|---|---|
Default |
|
deterministic reference evaluator, no OpenCPMD |
0 |
OpenCPMD |
|
OpenCPMD linked from |
1 |
Both modes export the same symbols.
A third target, libcpmdc_stub.a, is a link-only placeholder: every call
fails and cpmdc_available() returns 0.
The tests use it to check the ABI without a working evaluator.
Artifact |
Installed as |
Purpose |
|---|---|---|
|
|
the C ABI from |
public headers |
|
declarations for hosts |
|
|
reader and writer for CPMD |
|
|
command-line front end to |
pkg-config files |
|
compiler and linker flags |
CMake package |
|
imported target |
MAJOR is the soversion, the first field of version.txt.
Requirements¶
The checked-in Pixi manifest pins every build dependency. Without Pixi, install the same set from your package manager:
Dependency |
Version in |
Needed for |
|---|---|---|
Meson, Ninja |
Meson 1.5.2 or newer, Ninja 1.11 or newer |
every build |
Cap’n Proto ( |
1.0.2 or newer, below 2 |
generating the schema readers, encoding messages |
C and Fortran compilers |
any recent GCC and gfortran |
every build |
pkg-config |
2.5.1 or newer |
dependency lookup |
Python 3 |
3.10 or newer |
build helpers and tests |
cmocka |
1.1.7 or newer |
|
MPI with Fortran bindings, BLAS and LAPACK |
OpenMPI 4.1 to 5, OpenBLAS 0.3 |
|
FFTW3 |
optional |
linked when OpenCPMD was configured with FFTW3 |
Meson fetches three subprojects on the first meson setup: the C Cap’n Proto
runtime (c-capnproto), the shared schema (potentials-schema, pinned in
subprojects/potentials-schema.wrap), and capnp-fortran.
On a machine without network access, download them first where the network is
available:
meson subprojects download
Build the default library¶
Clone the repository and run the default suite:
git clone https://github.com/OmniPotentRPC/cpmdc.git
cd cpmdc
pixi run test-stub
test-stub configures build/ with tests on, compiles, and runs the Meson
suite.
A healthy run ends with every test reported OK and Fail: 0.
The same steps without Pixi:
meson setup build -Dwith_tests=true
meson compile -C build
meson test -C build --print-errorlogs
Meson options¶
Option |
Type |
Default |
Effect |
|---|---|---|---|
|
boolean |
|
build the cmocka suites, contract checks, and |
|
boolean |
|
link OpenCPMD instead of the reference evaluator |
|
string |
empty |
OpenCPMD build tree holding |
with_cpmd=true only takes effect together with a non-empty cpmd_root.
Configuration stops when DIR/lib/libcpmd.a or DIR/obj/timetag.o is missing.
OpenCPMD keeps timetag outside the archive, and header calls it.
Build against OpenCPMD¶
The OpenCPMD archive needs the patches in tools/ and position-independent
code; the archive how-to covers that build.
With the archive in place:
export CPMD_ROOT=/path/to/opencpmd-build
meson setup build-cpmd \
-Dwith_cpmd=true \
-Dcpmd_root="$CPMD_ROOT" \
-Dwith_tests=true
meson compile -C build-cpmd
meson test -C build-cpmd --print-errorlogs
The link uses the MPI Fortran dependency, OpenBLAS (or LAPACK and BLAS when
OpenBLAS is absent), FFTW3 when found, libgfortran, and libquadmath.
When OpenCPMD was built with MPI compiler wrappers, configure with the same
wrappers so both sides agree on one MPI:
CC=mpicc FC=mpif90 meson setup build-cpmd \
-Dwith_cpmd=true -Dcpmd_root="$CPMD_ROOT"
Install¶
meson setup build-install --prefix "$HOME/.local" -Dwith_tests=false
meson install -C build-install
pkg-config --modversion cpmdc
The last command prints the project version, which Meson reads from
version.txt.
Hosts that load the library at run time, such as rgpot, look for it through
CPMDC_LIBRARY; see the environment
reference.
Pixi tasks¶
Task |
Environment |
Runs |
|---|---|---|
|
default |
configure |
|
default |
the |
|
default |
the |
|
default |
full suite in |
|
default |
|
|
default |
pre-commit hooks from |
|
default |
link check over README, |
|
default |
release metadata checks, and |
|
|
export |
|
|
Doxygen XML and Doxyrest pages for the public headers |
|
|
|
Run a docs task with pixi run -e docs docbld.
The published site is cpmdc.rgoswami.me.