AlmaLinux 9@WSL2 インストールメモ

Makefile

makefile.include 
  arch/makefile.include.oneapi_omp 
    Fortran:ifx 
    C/C++:icx / icpx 
    MPI:Intel MPI 
    数値ライブラリ:oneMKL 
    並列化:MPI+OpenMP

# ?=なので、bash変数MKLROOT が優先される。修正しなくてもOKだが、うまくいかない場合は修正
MKLROOT ?= /path/to/your/mkl/installation

  1. cd ~/VASP-6.6.1/vasp.6.6.1

    source /opt/intel/oneapi/setvars.sh

    cp arch/makefile.include.oneapi_omp makefile.include
  2. command -v ifx
    command -v mpiifx
    command -v icx
    command -v icpx
    echo "$MKLROOT"
  3. make veryclean
    make DEPS=1 -j"$(nproc)" all 2>&1 | tee build.log

微調整する場合

https://qiita.com/youkihashimoto3110/items/a5c728d246d9ed4c96c4
にしたがってCPU coreのL1キャッシュを設定。
cpuidで調べて、命令キャッシュは32kB、データキャッシュは48kBということなので、とりあえず
  -DMPI__BLOCK=32000   (多分、49152が最適)
  -DCACHE_SIZE=16000   (多分、24576が最適)
に変更


HDF5 (ifx) 版

wget https://github.com/HDFGroup/hdf5/releases/download/hdf5_1.14.6/hdf5-1.14.6.tar.gz

tar xf hdf5-1.14.6.tar.gz
cd hdf5-1.14.6

source /opt/intel/oneapi/setvars.sh
# mkdir -p /home/share/hdf5-ifx-1.14.6

./configure \
 
--prefix=/home/share/hdf5-ifx-1.14.6 \
 
CC=icx \
 
FC=ifx \
 
--enable-fortran \
 
--enable-hl \
 
--enable-shared

make -j"$(nproc)"
make check
sudo make install
#sudo make install prefix=/home/share/hdf5-ifx-1.14.6

/home/share/hdf5-ifx-1.14.6/bin/h5fc -show
/home/share/hdf5-ifx-1.14.6/bin/h5fc -showconfig |
grep -E 'Fortran Compiler|Fortran:|Parallel HDF5'

 

VASPのコンパイル

makefile.include:

CPP_OPTIONS += -DVASP_HDF5

HDF5_ROOT ?= /home/share/hdf5-ifx-1.14.6
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include

make veryclean
make DEPS=1 -j4 all 2>&1 | tee build-hdf5.log


WANNIER90のコンパイル

wget https://github.com/wannier-developers/wannier90/archive/refs/tags/v3.1.0.tar.gz -O wannier90-3.1.0.tar.gz

tar xf wannier90-3.1.0.tar.gz
cd wannier90-3.1.0

source /opt/intel/oneapi/setvars.sh

cp config/make.inc.ifort make.inc
vi make.inc

F90 = ifx
編集:
  ifort → ifx
  mpiifort → mpiifx

  COMMS = mpi
  MPIF90 = mpiifx

  FCOPTS = -O2
  LDOPTS = -O2

  LIBDIR = $(MKLROOT)/lib/intel64
  LIBS = -qmkl

grep -E '^(default|wannier|post|lib|libs|install):' Makefile

make clean
make -j"$(nproc)"
make lib

テスト:
./wannier90.x
./postw90.x
make test

Deploy:
mkdir -p /home/share/wannier90-3.1.0-ifx/bin
mkdir -p /home/share/wannier90-3.1.0-ifx/lib

cp -p wannier90.x postw90.x \
/home/share/wannier90-3.1.0-ifx/bin/

cp -p libwannier.a \
/home/share/wannier90-3.1.0-ifx/lib/

.bashrc:
export WANNIER90_ROOT=/home/share/wannier90-3.1.0-ifx
export PATH="$WANNIER90_ROOT/bin:$PATH"

VASPのコンパイル

makefile.include
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /home/share/wannier90-3.1.0-ifx
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier

cd /path/to/vasp.6.6.1

source /opt/intel/oneapi/setvars.sh

make veryclean
make DEPS=1 -j4 all 2>&1 | tee build-hdf5-wannier90.log


小さいモデルではMPIのみで実行:

export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1

KPARをcore数の約数に設定

mpirun -np 8 ./bin/vasp_std


大きいモデルではOpenMP+MPIで実行:

export OMP_NUM_THREADS=4
export MKL_NUM_THREADS=1

KPARをcore数の因数に設定

mpirun -np 4 ./bin/vasp_std