Theoretical and Structural Chemistry Group of Anápolis
Prof. Dr. Ademir Camargo
Compiling cpmd 4.3
1. Compiling cpmd 4.3 on WSL-Oracle_Linux_8.5 with gcc-gfortran, openmpi 4.1.1, and lapack-devel
2. Compiling cpmd 4.3 on WSL-Oracle_Linux_8.7 with ifx, openmpi 4.1.1, and mkl
3. Compiling cpmd-4.3 on Oracle Linux 9.5 on wsl (book 2 pro)
1. Compiling cpmd 4.3 on WSL-Oracle_Linux_8.5 with gcc-gfortran, openmpi 4.1.1, and lapack-devel
Install WSL (Windows Subsystem for Linux)
Open PowerShell or Command Prompt as an administrator and run:
PS C:\~> wsl --install
View available distributions
PS C:\~> wsl --list --online
PS C:\~> wsl --install -d OracleLinux_8_7
Now, use the following commands to compile the cmd 4.3 on Oracle Linux running on Windows Subsystem for Linux (WSL). This compilation was done on Galaxy Book 2 Pro with gcc-gfortran, lapack-devel, and openmpi 4.1.1.
​
>> sudo dnf upgrade
>> sudo dnf groupinstall "Development Tools"
>> sudo dnf install git (to get cpmd latest version)
>> sudo dnf install gcc
>> sudo dnf install gcc-c++
>> sudo dnf install gcc-gfortran
>> ldconfig -p | grep libgfortran
>> sudo dnf install make
>> cp /mnt/c/Users/ajc/Downloads/openmpi-4.1.7.tar.gz ./
>> tar -xzvf openmpi-4.1.7.tar.gz
>> cd openmpi-4.1.7
>> sudo dnf install -y hwloc.x86_64 hwloc-libs.x86_64
>> ./configure --prefix=/usr/local
>> make -j$(4) (compilation with 4 process)
>> su
# make install
>> mpirun --version
>> sudo vi /etc/ld.so.conf.d/openmpi.conf
write inside openmpi.conf file: /usr/local/lib
>> sudo ldconfig
Now, install lapack-devel
>> sudo dnf config-manager --enable ol8_codeready_builder
>> sudo dnf clean all
>> sudo dnf makecache
>> sudo dnf search lapack-devel
lapack-devel.i686 : LAPACK development libraries
lapack-devel.x86_64 : LAPACK development libraries
>> sudo dnf install lapack-devel.x86_64
>> sudo dnf install subversion
This command is used in the build process to retrieve the version of the source code.
>> git clone https://github.com/OpenCPMD/CPMD.git
>> ./configure.sh LINUX-X86_64-GFORTRAN-MPI
>> vi Makefile
Replace LFLAGS = /home/manish/lapack-3.5.0/liblapack.a /home/manish/OPENBLAS/0.2.18/lib/libopenblas.a
by LFLAGS = -L/usr/lib64/ -llapack -lblas
>> make
>> echo 'export PATH=/home/ajc/CPMD/bin/:$PATH' >> .bashrc
>> source .bashrc
​
2. Compiling cpmd 4.3 on WSL-Oracle_Linux_8.7 with ifx, openmpi 4.1.1, and mkl
The following commands will guide you compiling cmd 4.3 on Oracle Linux 8.7 (wsl) . This compilation was done on Galaxy Book 2 Pro with ifx (the new intel fortran compile), openmpi 4.1.1, and mkl library.
​
>> sudo dnf upgrade
>> sudo dnf upgrade (execute it again to complete the upgrade system)
>> sudo dnf install git
>> sudo dnf install gcc.x86_64
>> sudo dnf install gcc-c++.x86_64
Download intel fortran compiler and mkl library from:
>> cp /mnt/c/Users/ajc/Downloads/intel-fortran-compiler-2025.0.1.41_offline.sh ./
>> cp /mnt/c/Users/ajc/Downloads/intel-onemkl-2025.0.1.16_offline.sh ./
>> sudo ./intel-onemkl-2025.0.1.16_offline.sh
>> sudo ./intel-fortran-compiler-2025.0.1.41_offline.sh
>> sudo rm -rf /opt/intel/oneapi/mpi/ (To avoid conflict w/ openmpi)
>> echo 'source /opt/intel/oneapi/setvars.sh' >> .bashrc
>> source .bashrc (To setting the environment variable)
>> echo $MKLROOT
Answer: /opt/intel/oneapi/mkl/2025.0
>> cp /mnt/c/Users/ajc/Downloads/openmpi-4.1.7.tar.gz ./
>> tar xzvf openmpi-4.1.7.tar.gz
>> sudo dnf install make.x86_64
>> sudo dnf install subversion
>> ./configure --prefix=/usr/local FC=ifx F77=ifx
>> make
>> sudo make install
>> mpirun --version
mpirun (Open MPI) 4.1.7
Report bugs to http://www.open-mpi.org/community/help/
>> sudo vi /etc/ld.so.conf.d/openmpi.conf
write inside openmpi.conf file: /usr/local/lib
>> sudo ldconfig
>> git clone https://github.com/OpenCPMD/CPMD.git
>> cd CPMD
>> ./configure.sh LINUX-AMD64-INTEL-MPI
>> vi Makefile
Replace LFLAGS = -static-intel -mkl=sequential
by LFLAGS = -static-intel -qmkl=sequential
-mkl works but it is deprecated.
If you wish, you can remove the option -traditional in the flag CPP = fpp -P -traditional. This is a bad option for the ifx compiler.
>> make
>> echo 'export PATH=/home/ajc/CPMD/bin/:$PATH' >> .bashrc
>> source .bashrc
​​​​
3. Compiling cpmd-4.3 on Oracle Linux 9.5 on wsl (book 2 pro)
Install the Oracle Linux 9.5 on your laptop (e.g., galaxy book 2 pro) on wsl version 2.5.7 (Windows Subsystem for Linux):
>> vim .bashrc
# User specific aliases and functions
PS1='\u@ol9.5\w >> ' (I like this prompt!!!:))
After installing, execute the following commands to update the oracle linux 9.5:
>> source .bashrc
>> sudo dnf upgrade
>> sudo dnf install git (to get later the cpmd program latest version)
>> sudo dnf groupinstall "Development Tools"
>> sudo dnf install gcc
>> sudo dnf install gcc-c++
>> sudo dnf install gcc-gfortran
>> ldconfig -p | grep libgfortran
libgfortran.so.5 (libc6,x86-64) => /lib64/libgfortran.so.5
>> sudo dnf install make
>> cp /mnt/c/Users/ajc/Downloads/openmpi-5.0.7.tar.gz ./
>> tar -xzvf openmpi-5.0.7.tar.gz
>> cd openmpi-5.0.7
>> sudo dnf install -y hwloc.x86_64 hwloc-libs.x86_64
>> ./configure --prefix=/usr/local
>> make -j$(4) (Here, I'm using four processes for compilation)
>> su (To install as superuser)
# make install
>> mpirun –version
mpirun (Open MPI) 5.0.7
Report bugs to https://www.open-mpi.org/community/help/
This message shows that openmpi is working fine.
>> sudo vi /etc/ld.so.conf.d/openmpi.conf
write inside openmpi.conf file: /usr/local/lib
>> sudo ldconfig
Now, install lapack-devel
>> sudo dnf search lapack-devel
Last metadata expiration check: 0:32:25 ago on Sun 01 Jun 2025 10:29:15 AM -03.
No matches found
So, we need to compile it manualy:
>> sudo dnf groupinstall "Development Tools" (if not installed)
>> sudo dnf install cmake gcc-gfortran (if not installed)
>> mkdir ~/src && cd ~/src
>> wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz
>> tar -xzvf v3.10.1.tar.gz && cd lapack-3.10.1
>> mkdir build && cd build
>> cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON ..
>> make -j$(4) (We are using 4 process to compile)
>> sudo make install (This will place LAPACK in /usr/local/lib64)
>> sudo dnf install subversion
Now, we are ready to compile and install cpmd
>> git clone https://github.com/OpenCPMD/CPMD.git
>> cd CPMD
>> ./configure.sh LINUX-X86_64-GFORTRAN-MPI
>> vi Makefile
Change FFLAGS and LFLAGS options to
FFLAGS = -std=legacy -O2 -Wall -I${SRCDIR} -I${OBJDIR}
LFLAGS = -L/usr/local/lib64 -llapack -lblas
Here, I put the -llapack -lblas libraries into /usr/local/lib64 folder
>> make
This procedure was succefull to compile cmpd on Oracle Linux 9.5
​
​