Bootstrap

CP2K-2024.1离线安装(Centos7.9)

按目前网上的安装教程始终安装不了elpa-2023。换成2021的版本或者--with-elpa=no之后,尽管toolchain可以顺利安装,后面cp2k编译也会报错。推测自带的gcc-9.3版本不适用。改成--with-gcc=install。

1,source MKL数学库。

source /opt/intel/oneapi/mkl/[实际版本号]/env/vars.sh

2,把前面安装过的install文件夹清空。

rm -rf /opt/cp2k-2024.1/tools/toolchain/install/

3,通过toolchain重新安装CP2K依赖的库。

./install_cp2k_toolchain.sh --with-sirius=no --with-openmpi=install --with-plumed=install --with-gcc=install --with-intel=no

4,结果

WARNING: (./install_cp2k_toolchain.sh, line 339) No MPI installation detected (ignore this message in Cray Linux Environment or when MPI installation was requested).
You have chosen to install the GCC compiler, therefore MPI libraries have to be installed too
and the use of the Intel compiler and Intel MPI will be disabled.
Compiling with 128 processes for target native.
==================== Installing GCC ====================
gcc-13.2.0.tar.gz is found
Installing GCC from scratch into /opt/cp2k-2024.1/tools/toolchain/install/gcc-13.2.0
gcc is installed as /opt/cp2k-2024.1/tools/toolchain/install/gcc-13.2.0/bin/gcc
g++ is installed as /opt/cp2k-2024.1/tools/toolchain/install/gcc-13.2.0/bin/g++
gfortran is installed as /opt/cp2k-2024.1/tools/toolchain/install/gcc-13.2.0/bin/gfortran
Step gcc took 814.00 seconds.
Step intel took 0.00 seconds.
==================== Getting proc arch info using OpenBLAS tools ====================
OpenBLAS detected LIBCORE = skylakex
OpenBLAS detected ARCH    = x86_64
==================== Installing CMake ====================
cmake-3.28.1-linux-x86_64.sh is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/cmake-3.28.1
Step cmake took 218.00 seconds.
==================== Installing OpenMPI ====================
openmpi-4.1.5.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5
Found directory /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/bin
Found directory /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/lib
Found directory /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/include
mpiexec is installed as /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/bin/mpiexec
mpicc is installed as /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/bin/mpicc
mpicxx is installed as /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/bin/mpicxx
mpifort is installed as /opt/cp2k-2024.1/tools/toolchain/install/openmpi-4.1.5/bin/mpifort
Step openmpi took 640.00 seconds.
==================== Finding MKL from system paths ====================
MKLROOT is found to be /opt/intel/oneapi/mkl/2023.1.0
libm is found in ld search path
libdl is found in ld search path
Step mkl took 0.00 seconds.
Step fftw took 0.00 seconds.
==================== Installing LIBINT ====================
libint-v2.6.0-cp2k-lmax-5.tgz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-5
Step libint took 236.00 seconds.
==================== Installing LIBXC ====================
libxc-6.2.2.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/libxc-6.2.2
Step libxc took 78.00 seconds.
==================== Installing LIBGRPP ====================
libgrpp-main-20231215.zip is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/libgrpp-main-20231215
Step libgrpp took 22.00 seconds.
==================== Installing Libxsmm ====================
libxsmm-1.17.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/libxsmm-1.17
Step libxsmm took 24.00 seconds.
Step scalapack took 0.00 seconds.
==================== Installing COSMA ====================
COSMA-v2.6.6.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/COSMA-2.6.6
Step cosma took 39.00 seconds.
==================== Installing ELPA ====================
elpa-2023.05.001.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/elpa-2023.05.001/cpu
Step elpa took 143.00 seconds.
Step ptscotch took 0.00 seconds.
Step superlu took 0.00 seconds.
Step pexsi took 0.00 seconds.
Step quip took 0.00 seconds.
==================== Installing gsl ====================
gsl-2.7.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/gsl-2.7
Step gsl took 86.00 seconds.
==================== Installing PLUMED ====================
plumed-src-2.9.0.tgz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/plumed-2.9.0
Step plumed took 212.00 seconds.
Step hdf5 took 0.00 seconds.
Step libvdwxc took 0.00 seconds.
==================== Installing spglib ====================
spglib-1.16.2.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/spglib-1.16.2
Step spglib took 10.00 seconds.
==================== Installing libvori ====================
libvori-220621.tar.gz is found
Installing from scratch into /opt/cp2k-2024.1/tools/toolchain/install/libvori-220621
Step libvori took 30.00 seconds.
Step libtorch took 0.00 seconds.
Step spfft took 0.00 seconds.
Step spla took 0.00 seconds.
Step sirius took 0.00 seconds.
==================== generating arch files ====================
arch files can be found in the /opt/cp2k-2024.1/tools/toolchain/install/arch subdirectory
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local.ssmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_static.ssmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local.sdbg
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_asan.ssmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_coverage.sdbg
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local.psmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local.pdbg
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_asan.psmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_static.psmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_warn.psmp
Wrote /opt/cp2k-2024.1/tools/toolchain/install/arch/local_coverage.pdbg
========================== usage =========================
Done!
Now copy:
  cp /opt/cp2k-2024.1/tools/toolchain/install/arch/* to the cp2k/arch/ directory
To use the installed tools and libraries and cp2k version
compiled with it you will first need to execute at the prompt:
  source /opt/cp2k-2024.1/tools/toolchain/install/setup
To build CP2K you should change directory:
  cd cp2k/
  make -j 128 ARCH=local VERSION="ssmp sdbg psmp pdbg"

arch files for GPU enabled CUDA versions are named "local_cuda.*"
arch files for GPU enabled HIP versions are named "local_hip.*"
arch files for OpenCL (GPU) versions are named "local_opencl.*"
arch files for coverage versions are named "local_coverage.*"

Note that these pre-built arch files are for the GNU compiler, users have to adapt them for other compilers.
It is possible to use the provided CP2K arch files as guidance.

5,编译cp2k报错

/opt/cp2k-2024.1/exts/dbcsr/src/core/dbcsr_config.F:12:8:

   12 |    USE dbcsr_acc_device, ONLY: dbcsr_acc_get_ndevices
      |        1
致命错误: Cannot read module file ‘dbcsr_acc_device.mod’ opened at (1), because it was created                       by a different version of GNU Fortran
编译中断。
make[4]: *** [dbcsr_config.o] 错误 1
make[3]: *** [libdbcsr] 错误 2
make[2]: *** [dbcsr] 错误 2
make[2]: *** 正在等待未完成的任务....

6,删除install和build中文件夹,将scirtp/install_gcc.sh中gcc的版本改为14.1,重新执行步骤3。编译cp2k同样报错。

7,如果同样报错,将cp2k整个安装包删了重新解压,修改~scirtp/install_gcc.sh中gcc的版本为14.1重新执行步骤3。编译cp2k没报错。(这个比步骤6妥当)

8,配置环境,在~/.bashrc中加入export PATH=$PATH:/opt/cp2k-2024.1/exe/local

9,执行:

source /opt/cp2k-2024.1/tools/toolchain/install/setup
mpirun -np 32 cp2k.popt XX.inp |tee XX.out

;