mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-21 06:25:15 -04:00
Toolchain: Replace "scripts/generate_cmake_options.sh" with "build_cp2k.sh" (#5080)
Co-authored-by: HE Zilong <159878975+he-zilong@users.noreply.github.com>
This commit is contained in:
parent
c92e8381f7
commit
f577188f47
49 changed files with 407 additions and 395 deletions
13
INSTALL.md
13
INSTALL.md
|
|
@ -70,6 +70,19 @@ a range of devices). If you wish to build with GPU support, please see the
|
|||
--with-fftw=system --enable-hip
|
||||
```
|
||||
|
||||
- Build and install CP2K with prepared toolchain environment:
|
||||
|
||||
```shell
|
||||
./build_cp2k.sh
|
||||
```
|
||||
|
||||
It is also available to make installed program and dependencies outside the source tree:
|
||||
|
||||
```shell
|
||||
./install_cp2k_toolchain.sh --install-dir=/opt/cp2k/toolchain
|
||||
./build_cp2k.sh --prefix /opt/cp2k
|
||||
```
|
||||
|
||||
## 3. Compile
|
||||
|
||||
This section has been moved to the
|
||||
|
|
|
|||
|
|
@ -3,14 +3,23 @@
|
|||
CP2K uses the [CMake](https://cmake.org) build system, which detects dependencies and controls the
|
||||
compilation process. The dependencies have to be installed in advance.
|
||||
|
||||
Currently, CP2K offers two convenient ways for building CP2K from source with its dependencies. One
|
||||
is to use the classic toolchain scripts to customize and install the required dependencies in a
|
||||
single step, thereby preparing the environment for compiling CP2K.
|
||||
Currently, CP2K offers two convenient ways for building CP2K from source with its dependencies:
|
||||
|
||||
A more modern and automated approach is via the `make_cp2k.sh` script, which leverages
|
||||
[Spack](https://spack.readthedocs.io) to install the dependencies and subsequently build CP2K. The
|
||||
latter approach is only available for the current [CP2K master branch](https://github.com/cp2k/cp2k)
|
||||
and CP2K release versions `2026.02` and newer.
|
||||
- The toolchain scripts, which customize and install the required dependencies in a single step,
|
||||
thereby preparing the environment for compiling CP2K. Run `install_cp2k_toolchain.sh` under
|
||||
`cp2k/tools/toolchain` to perform the toolchain steps; for detailed information, see
|
||||
<https://github.com/cp2k/cp2k/blob/master/tools/toolchain/README.md>. After building toolchain,
|
||||
you can use `build_cp2k.sh` to build and install CP2K with prepared toolchain environment.
|
||||
- The `make_cp2k.sh` script, a more modern and automated approach which leverages
|
||||
[Spack](https://spack.readthedocs.io) to install the dependencies and subsequently build CP2K.
|
||||
|
||||
```{note}
|
||||
- The toolchain does not cover all optional dependencies due to their complicated dependencies
|
||||
requirements, such as DLA-Future. SIRIUS with complete support (including DFT-D4 and NLCG) is
|
||||
also unavailable via toolchain due to the same reason.
|
||||
- The latter approach with Spack is only available for the current
|
||||
[CP2K master branch](https://github.com/cp2k/cp2k) and CP2K release versions `2026.02` and newer.
|
||||
```
|
||||
|
||||
## make_cp2k.sh
|
||||
|
||||
|
|
@ -105,8 +114,8 @@ Features: cray_pm_accel_energy | cusolver_mp | dbm_gpu | elpa_gpu | grid_gpu | p
|
|||
|
||||
</details>
|
||||
|
||||
The first run will take longer as it will build all CP2K dependencies with Spack. The Spack
|
||||
installation is kept fully local in the subfolder `cp2k/spack` which corresponds to the
|
||||
The first run will take longer as it will build all requested CP2K dependencies with Spack. The
|
||||
Spack installation is kept fully local in the subfolder `cp2k/spack` which corresponds to the
|
||||
`tools/toolchain/install` folder created by the CP2K toolchain.
|
||||
|
||||
Subsequent runs of the `make_cp2k.sh` script will use the software stack from that `cp2k/spack`
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@
|
|||
|
||||
The easiest way to get started with CP2K is to install it from a distribution.
|
||||
|
||||
```{note}
|
||||
The pre-compiled package from distributions may not performs as well as package
|
||||
built from source, as it usually adopts a conservative compilation strategy to
|
||||
ensure broad compatibility.
|
||||
```
|
||||
|
||||
## Arch
|
||||
|
||||
```shell
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -46,8 +45,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--enable-hip=yes \
|
||||
--gpu-ver=Mi100 \
|
||||
--with-dbcsr \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -46,8 +45,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--enable-hip=yes \
|
||||
--gpu-ver=Mi50 \
|
||||
--with-dbcsr \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -28,8 +27,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-gcc=system \
|
||||
--with-libtorch=no \
|
||||
--with-deepmd=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -39,8 +38,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--enable-cuda=yes \
|
||||
--gpu-ver=A100 \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -39,8 +38,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--enable-cuda=yes \
|
||||
--gpu-ver=P100 \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -39,8 +38,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--enable-cuda=yes \
|
||||
--gpu-ver=V100 \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -67,8 +66,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -67,8 +66,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -27,8 +26,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--target-cpu=generic \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -29,8 +28,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libsmeagol \
|
||||
--with-libtorch=no \
|
||||
--with-deepmd=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -29,8 +28,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libsmeagol \
|
||||
--with-libtorch=no \
|
||||
--with-deepmd=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -29,8 +28,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libsmeagol \
|
||||
--with-libtorch=no \
|
||||
--with-deepmd=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -29,8 +28,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libsmeagol \
|
||||
--with-libtorch=no \
|
||||
--with-deepmd=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -63,8 +62,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxsmm=no \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=openmpi \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -39,8 +38,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--enable-cuda=yes \
|
||||
--gpu-ver=A100 \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -39,8 +38,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--enable-cuda=yes \
|
||||
--gpu-ver=P100 \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -39,8 +38,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--enable-cuda=yes \
|
||||
--gpu-ver=V100 \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=mpich \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
|
|
@ -26,8 +25,7 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-gcc=system \
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -654,13 +654,11 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
./tools/toolchain/scripts/common_vars.sh \
|
||||
./tools/toolchain/scripts/signal_trap.sh \
|
||||
./tools/toolchain/scripts/get_openblas_arch.sh \
|
||||
./tools/toolchain/scripts/generate_cmake_options.sh \
|
||||
./scripts/
|
||||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
{install_args_str}
|
||||
--dry-run \
|
||||
--list-cmake-options=no
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
# This breaks up the lengthy installation into smaller build steps.
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ this behavior using `-j N` option, where `N` specifies the number of processors
|
|||
|
||||
### The script failed at a tarball downloading stage
|
||||
|
||||
Try run again with `--no-check-certificate` option. See the help section for this option for
|
||||
details.
|
||||
Simply try run again. The toolchain scripts will delete the broken tarball and re-download.
|
||||
|
||||
### I've used `--with-XYZ=system` but the XYZ library cannot be found
|
||||
|
||||
|
|
|
|||
282
tools/toolchain/build_cp2k.sh
Executable file
282
tools/toolchain/build_cp2k.sh
Executable file
|
|
@ -0,0 +1,282 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# shellcheck disable=all
|
||||
|
||||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)"
|
||||
|
||||
TOOLCHAIN_ROOTDIR="${PWD}"
|
||||
# Exit this script if it is not called from the ./tools/toolchain directory
|
||||
if [ "${TOOLCHAIN_ROOTDIR}" != "${SCRIPT_DIR}" ]; then
|
||||
cat << EOF
|
||||
ERROR: Incorrect execution location.
|
||||
The absolute path of the build_cp2k.sh script is at:
|
||||
${SCRIPT_DIR}
|
||||
Actual working directory where it is currently called:
|
||||
${TOOLCHAIN_ROOTDIR}
|
||||
Please enter the absolute path above before executing the build_cp2k.sh script
|
||||
so that subsequent scripts can be found and files can be placed correctly.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
TOOLCHAIN_SCRIPTS_DIR="${TOOLCHAIN_ROOTDIR}/scripts"
|
||||
source "${TOOLCHAIN_ROOTDIR}/toolchain_settings"
|
||||
source "${TOOLCHAIN_SCRIPTS_DIR}/tool_kit.sh"
|
||||
|
||||
# ====================== Parameter parsing ======================
|
||||
CP2K_ROOT=$(cd "${TOOLCHAIN_ROOTDIR}/../.." && pwd)
|
||||
CMAKE_INSTALL_PREFIX=${CP2K_ROOT}/install
|
||||
CLEAN_BUILD="__FALSE__"
|
||||
BUILD_JOBS="$(get_nprocs)"
|
||||
BUILD_SHARED_LIBS="ON"
|
||||
DRY_RUN="__FALSE__"
|
||||
|
||||
show_help() {
|
||||
cat << EOF
|
||||
Usage: $(basename "$0") [OPTIONS]
|
||||
|
||||
Generate CMake options from the toolchain configuration and build CP2K.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit
|
||||
-j N, -jN Number of parallel build jobs
|
||||
--prefix Set CMAKE_INSTALL_PREFIX (default is ${CP2K_ROOT}/install)
|
||||
--dry-run Show generated CMake options only and then exit
|
||||
--clean Remove the build directory before configuring, which means
|
||||
rebuilding CP2K entirely
|
||||
--build-static Set -DBUILD_SHARED_LIBS=OFF (default is ON)
|
||||
EOF
|
||||
}
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
case "$1" in
|
||||
--dry-run)
|
||||
DRY_RUN="__TRUE__"
|
||||
;;
|
||||
--clean)
|
||||
CLEAN_BUILD="__TRUE__"
|
||||
;;
|
||||
-j)
|
||||
BUILD_JOBS="$2"
|
||||
shift
|
||||
;;
|
||||
-j[0-9]*)
|
||||
BUILD_JOBS="${1#-j}"
|
||||
;;
|
||||
--prefix)
|
||||
if [[ "${2}" != /* ]]; then
|
||||
report_error "The path for --prefix must be an absolute path."
|
||||
exit 1
|
||||
fi
|
||||
CMAKE_INSTALL_PREFIX="${2}"
|
||||
shift
|
||||
;;
|
||||
--build-static)
|
||||
BUILD_SHARED_LIBS="OFF"
|
||||
;;
|
||||
-h | --help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown option: $1"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# ====================== Pre-checks ======================
|
||||
# Require complete source tree
|
||||
# A minimum working environment for this script should be as follows (assuming out-of-tree build not required):
|
||||
# cp2k <- variable ${CP2K_ROOT}; CMake option -S
|
||||
# ├── CMakeLists.txt <- file to be parsed for generating cmake options
|
||||
# ├── cmake <- directory containing CMake files
|
||||
# ├── data <- CP2K data directory; CMake option -DCP2K_DATA_DIR\
|
||||
# ├── build <- to-be-created; CMake option -B
|
||||
# ├── install <- to-be-created; CMake option -DCMAKE_INSTALL_PREFIX
|
||||
# ├── src <- CP2K source code directory
|
||||
# └── tools
|
||||
# └── toolchain <- working directory; variable ${TOOLCHAIN_ROOTDIR}
|
||||
# ├── build_cp2k.sh <- this script
|
||||
# ├── install_cp2k_toolchain.sh <- script being executed before calling this script
|
||||
# ├── scripts <- directory with toolchain scripts; ${TOOLCHAIN_SCRIPTS_DIR}
|
||||
# │ └── tool_kit.sh
|
||||
# └── install <- directory with installed dependencies; ${TOOLCHAIN_INSTALL_DIR}
|
||||
# ├── setup <- * file to be used for building CP2K
|
||||
# ├── toolchain.conf <- * file to be parsed for generating cmake options
|
||||
# └── toolchain.env <- * file to be parsed for generating cmake options (MPI_F08)
|
||||
#
|
||||
if [ -d "${CP2K_ROOT}/src" ]; then
|
||||
echo "Root directory of CP2K with source code is found as ${CP2K_ROOT}"
|
||||
echo "(path is exported to variable \${CP2K_ROOT})."
|
||||
else
|
||||
report_error ${LINENO} "\${CP2K_ROOT} does not have subdirectory src."
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "${CP2K_ROOT}/CMakeLists.txt" ] && [ -r "${CP2K_ROOT}/CMakeLists.txt" ]; then
|
||||
echo "\${CP2K_ROOT}/CMakeLists.txt exists; will be parsed for CMake options."
|
||||
else
|
||||
report_error ${LINENO} "\${CP2K_ROOT}/CMakeLists.txt cannot be found or read."
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "${CP2K_ROOT}/data" ]; then
|
||||
echo "Data directory ${CP2K_ROOT}/data is found."
|
||||
else
|
||||
report_error ${LINENO} "Data directory \${CP2K_ROOT}/data cannot be found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Require finished toolchain
|
||||
if [ ! -f "${TOOLCHAIN_INSTALL_DIR}/setup" ]; then
|
||||
echo "Error: Toolchain is not installed. Please run ./install_cp2k_toolchain.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Disallow combination of installing toolchain outside the source tree and CP2K under the source tree
|
||||
if [ "${TOOLCHAIN_INSTALL_DIR}" != "${TOOLCHAIN_ROOTDIR}"/install ] &&
|
||||
[[ ${CMAKE_INSTALL_PREFIX} == ${CP2K_ROOT}/* ]]; then
|
||||
echo
|
||||
cat << EOF
|
||||
ERROR: You toolchain installation is outside the source tree but the install
|
||||
prefix of CP2K is under the source tree, which is disallowed by this script.
|
||||
The script will now abort; please manually set "--prefix" to a proper path.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load toolchain environment (required for with_xxx variables)
|
||||
source "${TOOLCHAIN_INSTALL_DIR}/setup"
|
||||
source "${TOOLCHAIN_INSTALL_DIR}/toolchain.conf"
|
||||
|
||||
printf "========================== %s =========================\n" \
|
||||
"Generating CMake options from toolchain"
|
||||
|
||||
# Generate cmake options for compiling cp2k
|
||||
CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}"
|
||||
if [[ ${CMAKE_INSTALL_PREFIX} == ${CP2K_ROOT}/* ]]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_DATA_DIR=${CP2K_ROOT}/data"
|
||||
fi
|
||||
if [ -n "$(grep -- "--install-all" "${TOOLCHAIN_INSTALL_DIR}/setup")" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_EVERYTHING=ON -DCP2K_USE_DLAF=OFF -DCP2K_USE_PEXSI=OFF"
|
||||
for toolchain_option in $(grep -i "dontuse" "${TOOLCHAIN_INSTALL_DIR}/toolchain.conf" |
|
||||
grep -Evi "gcc|amd|intel" | cut -d'_' -f2 | cut -d'=' -f1); do
|
||||
var_name="with_${toolchain_option}"
|
||||
if [ "${!var_name}" != "__DONTUSE__" ]; then
|
||||
ADDED_CMAKE_OPTION=$(sed -n '/option(/,/)/p' "${CP2K_ROOT}/CMakeLists.txt" |
|
||||
grep -i "${toolchain_option}" | awk '{print $1}' | cut -d'(' -f2 | head -n 1)
|
||||
# Use "if-then" below can avoid generating empty "-D=OFF" options
|
||||
if [ -n "${ADDED_CMAKE_OPTION}" ]; then
|
||||
CMAKE_OPTIONS+=" -D${ADDED_CMAKE_OPTION}=OFF"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
# If MPI is used, set "CP2K_USE_MPI" to "ON"
|
||||
if [ "${mpi_mode}" != "no" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_MPI=ON -DCP2K_USE_MPI_F08=ON"
|
||||
fi
|
||||
# Some options that should be specially considered:
|
||||
# Intel MKL includes FFTW
|
||||
if [ "${with_fftw}" != "__DONTUSE__" ] || [ "${MATH_MODE}" = "mkl" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_FFTW3=ON"
|
||||
fi
|
||||
# Mimic-MCL (MiMiC Communication Library)
|
||||
if [ "${with_mcl}" != "__DONTUSE__" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_MIMIC=ON"
|
||||
fi
|
||||
# Detect if any other dependencies is used and add the proper cmake option
|
||||
# Since "pugixml" and "gsl" are not mentioned in CMakeLists.txt, they will not be considered.
|
||||
for toolchain_option in $(grep "with" "${TOOLCHAIN_INSTALL_DIR}"/toolchain.conf |
|
||||
grep -Evi "dontuse|gcc|amd|intel|cmake|fftw|mkl|dbcsr" | cut -d'_' -f2 | cut -d'=' -f1); do
|
||||
var_name="with_${toolchain_option}"
|
||||
if [ "${!var_name}" != "__DONTUSE__" ]; then
|
||||
ADDED_CMAKE_OPTION=$(sed -n '/option(/,/)/p' "${CP2K_ROOT}/CMakeLists.txt" |
|
||||
grep -i "${toolchain_option}" | awk '{print $1}' | cut -d'(' -f2 | head -n 1)
|
||||
# Use "if-then" below can avoid generating empty "-D=ON" options
|
||||
if [ -n "${ADDED_CMAKE_OPTION}" ]; then
|
||||
CMAKE_OPTIONS+=" -D${ADDED_CMAKE_OPTION}=ON"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# If GPU acceleration is used, add the option about GPU acceleration
|
||||
if [ "${enable_cuda}" = "__TRUE__" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_ACCEL=CUDA -DCP2K_WITH_GPU=${gpu_ver}"
|
||||
elif [ "${enable_hip}" = "__TRUE__" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_ACCEL=HIP -DCP2K_WITH_GPU=${gpu_ver}"
|
||||
elif [ "${enable_opencl}" = "__TRUE__" ]; then
|
||||
CMAKE_OPTIONS+=" -DCP2K_USE_ACCEL=OPENCL"
|
||||
fi
|
||||
|
||||
# Set build directory
|
||||
BUILD_DIR="${CP2K_ROOT}/build"
|
||||
|
||||
# Show CMake options
|
||||
echo "Generated CMake flags:"
|
||||
for flag in ${CMAKE_OPTIONS}; do
|
||||
echo " ${flag}"
|
||||
done
|
||||
|
||||
if [ "${DRY_RUN}" != "__TRUE__" ]; then
|
||||
# ====================== Optional clean ======================
|
||||
if [ "${CLEAN_BUILD}" = "__TRUE__" ] && [ -d "${BUILD_DIR}" ]; then
|
||||
echo "Removing existing build directory: ${BUILD_DIR}"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
fi
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
|
||||
# ====================== Configure ======================
|
||||
echo "================== CMake configuration ==================="
|
||||
echo "Source dir : ${CP2K_ROOT}"
|
||||
echo "Build dir : ${BUILD_DIR}"
|
||||
echo "Install dir: ${CMAKE_INSTALL_PREFIX}"
|
||||
echo "Shared libs: ${BUILD_SHARED_LIBS}"
|
||||
|
||||
echo -n "Configuring ... "
|
||||
cmake -S "${CP2K_ROOT}" -B "${BUILD_DIR}" ${CMAKE_OPTIONS} > cmake.log 2>&1 || tail_excerpt cmake.log
|
||||
echo "done."
|
||||
echo "=========================================================="
|
||||
|
||||
# ====================== Build ======================
|
||||
echo "==================== Building CP2K ======================="
|
||||
echo "Parallel jobs: ${BUILD_JOBS}"
|
||||
|
||||
echo -n "Building CP2K ... "
|
||||
cmake --build "${BUILD_DIR}" --target install -j "${BUILD_JOBS}" > build.log 2>&1 || tail_excerpt build.log
|
||||
echo "done."
|
||||
echo "=========================================================="
|
||||
|
||||
# Export variable for CMake options to cp2k_env file
|
||||
cat << EOF > "${CMAKE_INSTALL_PREFIX}/cp2k_env"
|
||||
#!/bin/bash
|
||||
export CP2K_ROOT="${CP2K_ROOT}"
|
||||
source ${TOOLCHAIN_INSTALL_DIR}/setup
|
||||
prepend_path PATH "${CP2K_ROOT}/install/bin"
|
||||
prepend_path LD_LIBRARY_PATH "${CP2K_ROOT}/install/lib"
|
||||
prepend_path PKG_CONFIG_PATH "${CP2K_ROOT}/install/lib/pkgconfig"
|
||||
EOF
|
||||
cat << EOF
|
||||
Done! Installed binaries are now available in: ${CP2K_ROOT}/install/bin
|
||||
|
||||
It's suggested to run regtests after installation:
|
||||
${CP2K_ROOT}/tests/do_regtest.py ${CMAKE_INSTALL_PREFIX}/bin psmp
|
||||
Run \`${CP2K_ROOT}/tests/do_regtest.py --help\` for help message.
|
||||
|
||||
Please always source this script to load CP2K environment before running CP2K:
|
||||
source ${CMAKE_INSTALL_PREFIX}/cp2k_env
|
||||
|
||||
If you want to clean the build cache (except cached CMake files) after
|
||||
installation, run:
|
||||
cmake --build "${BUILD_DIR}" --target clean
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
Since you run this script with \"--dry-run\", it now exits.
|
||||
To build CP2K, drop off this flag and re-run this script.
|
||||
EOF
|
||||
fi
|
||||
|
||||
#EOF
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Disabled shellcheck items: SC1091 for external scripts, SC2034 for unused
|
||||
# variables, SC2124 for concatenating toolchain options with $@
|
||||
# shellcheck disable=SC1091,SC2034,SC2124
|
||||
# variables, SC2124 for concatenating toolchain options with $@, SC2129 for
|
||||
# individual redirects ">>".
|
||||
# shellcheck disable=SC1091,SC2034,SC2124,SC2129
|
||||
|
||||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)"
|
||||
|
|
@ -32,6 +33,7 @@ export SCRIPTDIR="${ROOTDIR}/scripts"
|
|||
export BUILDDIR="${ROOTDIR}/build"
|
||||
export INSTALLDIR="${ROOTDIR}/install"
|
||||
export SETUPFILE="${INSTALLDIR}/setup"
|
||||
export TOOLKIT_SCRIPT="${SCRIPTDIR}/tool_kit.sh"
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Make a copy of all options for $SETUPFILE
|
||||
|
|
@ -85,6 +87,9 @@ OPTIONS:
|
|||
If omitted, the script will automatically try to
|
||||
determine the number of available processors and use
|
||||
all of them by default.
|
||||
--install-dir Set the directory you want to installed toolchain
|
||||
dependencies to. Default is the "install" directory
|
||||
in current path.
|
||||
--no-check-certificate Bypass verification of server's certificate while
|
||||
downloading anything from internet via wget command.
|
||||
In case wget errors about "certificate verification"
|
||||
|
|
@ -553,7 +558,6 @@ else
|
|||
fi
|
||||
|
||||
# default enable options
|
||||
list_cmake_options="__TRUE__"
|
||||
dry_run="__FALSE__"
|
||||
enable_tsan="__FALSE__"
|
||||
enable_opencl="__FALSE__"
|
||||
|
|
@ -619,6 +623,16 @@ while [ $# -ge 1 ]; do
|
|||
-j[0-9]*)
|
||||
export NPROCS_OVERWRITE="${1#-j}"
|
||||
;;
|
||||
--install-dir=*)
|
||||
if [[ "${1#--install-dir=}" != /* ]]; then
|
||||
report_error "The path for --install-dir must be an absolute path."
|
||||
exit 1
|
||||
fi
|
||||
export INSTALLDIR="${1#--install-dir=}"
|
||||
export SETUPFILE="${INSTALLDIR}/setup"
|
||||
cp "${SCRIPTDIR}"/tool_kit.sh "${INSTALLDIR}"/
|
||||
export TOOLKIT_SCRIPT="${INSTALLDIR}/tool_kit.sh"
|
||||
;;
|
||||
--no-check-certificate)
|
||||
export DOWNLOADER_FLAGS="--no-check-certificate"
|
||||
;;
|
||||
|
|
@ -719,13 +733,6 @@ Otherwise use option no."
|
|||
--dry-run)
|
||||
dry_run="__TRUE__"
|
||||
;;
|
||||
--list-cmake-options*)
|
||||
list_cmake_options=$(read_enable "${1}")
|
||||
if [ "${list_cmake_options}" = "__INVALID__" ]; then
|
||||
report_error "invalid value for --list-cmake-options, please use yes or no"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--enable-tsan*)
|
||||
enable_tsan=$(read_enable "${1}")
|
||||
if [ "${enable_tsan}" = "__INVALID__" ]; then
|
||||
|
|
@ -1260,11 +1267,17 @@ fi
|
|||
# Installing tools required for building CP2K and associated libraries
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
# Write toolchain configurations
|
||||
cat << EOF > "${ROOTDIR}/toolchain_settings"
|
||||
#!/bin/bash
|
||||
export TOOLCHAIN_INSTALL_DIR="${INSTALLDIR}"
|
||||
export CP2K_TOOLCHAIN_OPTIONS="${TOOLCHAIN_OPTIONS}"
|
||||
EOF
|
||||
|
||||
# Write head of setup file
|
||||
cat << EOF > "$SETUPFILE"
|
||||
#!/bin/bash
|
||||
source "${SCRIPTDIR}/tool_kit.sh"
|
||||
export CP2K_TOOLCHAIN_OPTIONS="${TOOLCHAIN_OPTIONS}"
|
||||
source "${TOOLKIT_SCRIPT}"
|
||||
EOF
|
||||
|
||||
# Write toolchain environment
|
||||
|
|
@ -1272,7 +1285,13 @@ write_toolchain_env "${INSTALLDIR}"
|
|||
|
||||
# Write toolchain config
|
||||
echo "tool_list=\"${tool_list}\"" > "${INSTALLDIR}"/toolchain.conf
|
||||
echo "dry_run=\"${dry_run}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
echo "mpi_mode=\"${MPI_MODE}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
echo "enable_cuda=\"${ENABLE_CUDA}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
echo "enable_hip=\"${ENABLE_HIP}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
echo "enable_opencl=\"${ENABLE_OPENCL}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
if [ "${ENABLE_CUDA}" == "__TRUE__" ] || [ "${ENABLE_HIP}" == "__TRUE__" ]; then
|
||||
echo "gpu_ver=\"${GPUVER}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
fi
|
||||
for ii in ${package_list}; do
|
||||
install_mode=$(eval "echo \${with_${ii}}")
|
||||
echo "with_${ii}=\"${install_mode}\"" >> "${INSTALLDIR}"/toolchain.conf
|
||||
|
|
@ -1314,9 +1333,18 @@ else
|
|||
"${SCRIPTDIR}"/stage7/install_stage7.sh
|
||||
"${SCRIPTDIR}"/stage8/install_stage8.sh
|
||||
"${SCRIPTDIR}"/stage9/install_stage9.sh
|
||||
echo
|
||||
cat << EOF
|
||||
========================== Epilogue =========================
|
||||
Done! To build CP2K with dependencies you installed via toolchain, simply run
|
||||
this script:
|
||||
|
||||
./build_cp2k.sh -j $(get_nprocs)
|
||||
|
||||
It will source the file "install/setup", generate proper CMake flags based on
|
||||
toolchain options, and then build and install CP2K. For available options
|
||||
with the script, run "./build_cp2k.sh -h".
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Generate CMake options
|
||||
if [ "${list_cmake_options}" = "__TRUE__" ]; then
|
||||
"${SCRIPTDIR}"/generate_cmake_options.sh
|
||||
fi
|
||||
#EOF
|
||||
|
|
|
|||
|
|
@ -1,240 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# TODO: Review and if possible fix shellcheck errors.
|
||||
# shellcheck disable=all
|
||||
|
||||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)"
|
||||
|
||||
source "${SCRIPT_DIR}"/common_vars.sh
|
||||
source "${SCRIPT_DIR}"/tool_kit.sh
|
||||
source "${SCRIPT_DIR}"/signal_trap.sh
|
||||
source "${INSTALLDIR}"/toolchain.conf
|
||||
source "${INSTALLDIR}"/toolchain.env
|
||||
|
||||
# This script assumes a working environment as follows:
|
||||
# cp2k <- variable ${CP2K_ROOT}; CMake option -S
|
||||
# ├── CMakeLists.txt <- * file to be parsed in this script
|
||||
# ├── data <- CP2K data directory; CMake option -DCP2K_DATA_DIR
|
||||
# ├── build <- to-be-created; CMake option -B
|
||||
# ├── install <- to-be-created; CMake option -DCMAKE_INSTALL_PREFIX
|
||||
# ├── src <- CP2K source code directory
|
||||
# └── tools
|
||||
# └── toolchain <- working directory; variable ${ROOTDIR}
|
||||
# ├── install_cp2k_toolchain.sh <- script being executed calling this script
|
||||
# ├── scripts <- variable ${SCRIPT_DIR}
|
||||
# │ ├── common_vars.sh
|
||||
# │ ├── tool_kit.sh
|
||||
# │ └── generate_cmake_options.sh <- this script
|
||||
# └── install <- variable ${INSTALLDIR}
|
||||
# ├── setup <- * file to be parsed in this script
|
||||
# ├── toolchain.conf <- * file to be parsed in this script
|
||||
# └── toolchain.env <- * file to be parsed in this script
|
||||
#
|
||||
# First, validate completion of relevant upper-level directory and file
|
||||
printf "\n========================== %s =========================\n" \
|
||||
"Generating CMake options for building CP2K"
|
||||
CP2K_ROOT=$(cd "${ROOTDIR}/../.." && pwd)
|
||||
if [ -d "${CP2K_ROOT}/src" ]; then
|
||||
cat << EOF
|
||||
Root directory of CP2K with source code is found as ${CP2K_ROOT}
|
||||
(path is exported to variable \${CP2K_ROOT}).
|
||||
Build directory will be \${CP2K_ROOT}/build.
|
||||
Install directory will be \${CP2K_ROOT}/install.
|
||||
EOF
|
||||
CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=./install"
|
||||
else
|
||||
report_error ${LINENO} "\${CP2K_ROOT} does not have subdirectory src."
|
||||
return 1
|
||||
fi
|
||||
if [ -f "${CP2K_ROOT}/CMakeLists.txt" ] && [ -r "${CP2K_ROOT}/CMakeLists.txt" ]; then
|
||||
echo "\${CP2K_ROOT}/CMakeLists.txt exists; will be parsed for CMake options."
|
||||
else
|
||||
report_error ${LINENO} "\${CP2K_ROOT}/CMakeLists.txt cannot be found or read."
|
||||
return 1
|
||||
fi
|
||||
if [ -d "${CP2K_ROOT}/data" ]; then
|
||||
echo "Data directory ${CP2K_ROOT}/data is found and set as CP2K_DATA_DIR."
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_DATA_DIR=${CP2K_ROOT}/data"
|
||||
else
|
||||
report_error ${LINENO} "Data directory \${CP2K_ROOT}/data cannot be found."
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# generate cmake options for compiling cp2k
|
||||
# ------------------------------------------------------------------------
|
||||
# Build the program in source tree for convenience
|
||||
if [ -n "$(grep -- "--install-all" ${INSTALLDIR}/setup)" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_EVERYTHING=ON -DCP2K_USE_DLAF=OFF -DCP2K_USE_PEXSI=OFF"
|
||||
# Since "--install-all" can be used together with "--with-PKG=no", an extra safeguard is added here
|
||||
for toolchain_option in $(grep -i "dontuse" ${INSTALLDIR}/toolchain.conf | grep -vi "gcc" | cut -d'_' -f2 | cut -d'=' -f1); do
|
||||
if [ $(eval echo "$with_"'$toolchain_option') != "__DONTUSE__" ]; then
|
||||
ADDED_CMAKE_OPTION=$(sed -n '/option(/,/)/p' ${CP2K_ROOT}/CMakeLists.txt | grep -i $toolchain_option | awk '{print $1}' | cut -d'(' -f2 | head -n 1)
|
||||
# Use "if-then" below can avoid generating empty "-D=OFF" options
|
||||
if [ -n "${ADDED_CMAKE_OPTION}" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -D${ADDED_CMAKE_OPTION}=OFF"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
# If MPI is used, set "CP2K_USE_MPI" to "ON"
|
||||
if [ "${MPI_MODE}" != "no" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_MPI=ON"
|
||||
if [ -n "$(grep "MPI_F08" "${INSTALLDIR}"/toolchain.env)" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_MPI_F08=ON"
|
||||
fi
|
||||
fi
|
||||
# If GPU acceleration is used, add the option about GPU acceleration
|
||||
if [ "${ENABLE_CUDA}" = "__TRUE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_ACCEL=CUDA -DCP2K_WITH_GPU=${GPUVER}"
|
||||
elif [ "${ENABLE_HIP}" = "__TRUE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_ACCEL=HIP -DCP2K_WITH_GPU=${GPUVER}"
|
||||
elif [ "${ENABLE_OPENCL}" = "__TRUE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_ACCEL=OPENCL"
|
||||
fi
|
||||
# Some options that should be specially considered:
|
||||
# Intel MKL includes FFTW
|
||||
if [ "${with_fftw}" != "__DONTUSE__" ] || [ "${MATH_MODE}" = "mkl" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_FFTW3=ON"
|
||||
fi
|
||||
# There is only MCL (MiMiC Communication Library) and no MiMiC that can be installed via toolchain, but if one chooses to install MCL then MiMiC should have been installed?
|
||||
if [ "${with_mcl}" != "__DONTUSE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCP2K_USE_MIMIC=ON"
|
||||
fi
|
||||
# Detect if any other dependencies is used and add the proper cmake option. Since "pugixml" and "gsl" are not mentioned in CMakeLists.txt, they will not be considered.
|
||||
for toolchain_option in $(grep -vi "dry\|list\|dontuse\|gcc\|cmake\|fftw\|mkl\|dbcsr" ${INSTALLDIR}/toolchain.conf | cut -d'_' -f2 | cut -d'=' -f1); do
|
||||
if [ $(eval echo "$with_"'$toolchain_option') != "__DONTUSE__" ]; then
|
||||
ADDED_CMAKE_OPTION=$(sed -n '/option(/,/)/p' ${CP2K_ROOT}/CMakeLists.txt | grep -i $toolchain_option | awk '{print $1}' | cut -d'(' -f2 | head -n 1)
|
||||
# Use "if-then" below can avoid generating empty "-D=ON" options
|
||||
if [ -n "${ADDED_CMAKE_OPTION}" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -D${ADDED_CMAKE_OPTION}=ON"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Export variable for CMake options to setup file
|
||||
cat << EOF >> "${SETUPFILE}"
|
||||
# ==================== Setup for CP2K ==================== #
|
||||
export CP2K_ROOT="${CP2K_ROOT}"
|
||||
export CP2K_CMAKE_OPTIONS="${CMAKE_OPTIONS}"
|
||||
prepend_path PATH "${CP2K_ROOT}/install/bin"
|
||||
prepend_path LD_LIBRARY_PATH "${CP2K_ROOT}/install/lib"
|
||||
prepend_path PKG_CONFIG_PATH "${CP2K_ROOT}/install/lib/pkgconfig"
|
||||
EOF
|
||||
if [ "${dry_run}" = "__TRUE__" ]; then
|
||||
cat << EOF
|
||||
|
||||
Suggested cmake command if toolchain is built with your options:
|
||||
|
||||
cmake ${CMAKE_OPTIONS}
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
|
||||
Suggested CMake options are collected in the variable \${CP2K_CMAKE_OPTIONS} that is
|
||||
exported at the end of setup file ${SETUPFILE}.
|
||||
EOF
|
||||
fi
|
||||
|
||||
# -------------------------
|
||||
# print out user instructions
|
||||
# -------------------------
|
||||
if [ "${dry_run}" != "__TRUE__" ]; then
|
||||
echo
|
||||
cat << EOF
|
||||
========================== Epilogue =========================
|
||||
Toolchain is now ready for building CP2K!
|
||||
|
||||
To use the installed tools and libraries and cp2k version compiled with it you
|
||||
will first need to execute at the prompt:
|
||||
|
||||
source ${SETUPFILE}
|
||||
|
||||
Then it's recommended for you to build and install CP2K with following commands:
|
||||
|
||||
cd ${CP2K_ROOT}
|
||||
cmake -S . -B build ${CMAKE_OPTIONS}
|
||||
cmake --build build --target install -j $(get_nprocs)
|
||||
|
||||
For more information about available build options, see:
|
||||
https://manual.cp2k.org/trunk/getting-started/build-from-source.html
|
||||
|
||||
For detailed explanation of above steps of building CP2K, see:
|
||||
${INSTALLDIR}/cp2k_installation_guide.md
|
||||
|
||||
EOF
|
||||
cat << EOF > ${INSTALLDIR}/cp2k_installation_guide.md
|
||||
## Building CP2K with dependencies installed in toolchain
|
||||
|
||||
Here is a detailed instruction of building CP2K with dependencies installed via toolchain.
|
||||
|
||||
### Required - commands you must execute or the building fails
|
||||
|
||||
1. Source setup file to activate toolchain-configured dependencies:
|
||||
|
||||
\`\`\`bash
|
||||
source ${SETUPFILE}
|
||||
\`\`\`
|
||||
|
||||
This setup file **MUST** also be sourced whenever CP2K built with this toolchain is executed.
|
||||
If modules have been used to estabilish environment variables and paths, remember to load
|
||||
these modules prior to sourcing setup file.
|
||||
|
||||
2. Go to root directory of CP2K and configure CMake with corresponding options:
|
||||
|
||||
\`\`\`bash
|
||||
cd ${CP2K_ROOT}
|
||||
cmake -S . -B build ${CMAKE_OPTIONS}
|
||||
\`\`\`
|
||||
|
||||
Other commands from \`${CP2K_ROOT}/CMakeLists.txt\` can also be added. For more information
|
||||
about available build options, see documentation:
|
||||
<https://manual.cp2k.org/trunk/getting-started/build-from-source.html>.
|
||||
|
||||
Alternative to copy-paste long lines in terminal is to use a variable from setup file for
|
||||
CMake options, which is not to be quoted so that whitespace delimiters allow it to expand
|
||||
to command options in shell:
|
||||
|
||||
\`\`\`bash
|
||||
cmake -S . -B build \${CP2K_CMAKE_OPTIONS}
|
||||
\`\`\`
|
||||
|
||||
3. Build and install CP2K with command:
|
||||
|
||||
\`\`\`bash
|
||||
cmake --build build --target install -j $(get_nprocs)
|
||||
\`\`\`
|
||||
|
||||
It may be helpful to also save a copy of command line messages to log files:
|
||||
|
||||
\`\`\`bash
|
||||
cmake --build build --target install -j $(get_nprocs) 2>&1 | tee install.log
|
||||
\`\`\`
|
||||
|
||||
If you want another build of CP2K without changing toolchain configuration, simply change
|
||||
the building directory set by \`-B <dirname>\` in the cmake command above.
|
||||
|
||||
### Optional but recommended
|
||||
|
||||
At the ending of the output of step 3, CP2K will give you a command that can be used to
|
||||
do regtests, which can further ensure if you have built CP2K correctly. You can perform
|
||||
the regtests with that command. You can run
|
||||
\`${CP2K_ROOT}/tests/do_regtest.py --help\`
|
||||
to see available options. For a detailed instruction of how to run regtests (especially
|
||||
on HPC clusters), see:
|
||||
<https://www.cp2k.org/dev:regtesting>.
|
||||
|
||||
### Other optional behaviors
|
||||
|
||||
Both for toolchain buildings and CP2K building: once build is completed, the \`build\`
|
||||
directory can be safely deleted. However, you **MUST** keep the \`install\` directory
|
||||
as is.
|
||||
|
||||
Especially, if you want to save disk space but at the same time keep the cached CMake
|
||||
files, you can run \`cmake --build build --target clean\` alternatively after installing
|
||||
successfully.
|
||||
EOF
|
||||
fi
|
||||
|
||||
#EOF
|
||||
|
|
@ -44,10 +44,7 @@ case "${with_dbcsr}" in
|
|||
if [ "${MPI_MODE}" == "no" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_MPI=OFF"
|
||||
else
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_MPI=ON"
|
||||
if [ -n "$(grep "MPI_F08" "${INSTALLDIR}"/toolchain.env)" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_MPI_F08=ON"
|
||||
fi
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_MPI=ON -DUSE_MPI_F08=ON"
|
||||
fi
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue