目的:
OS:
OSインストール:
Microsoft StoreからUbuntu 24.04 LTSをインストール
あるいは
> wsl --install --distribution Ubuntu-24.04
コンパイル方針:
GNU + OpenMPI + OpenBLAS + ScaLAPACK + FFTW
(標準パッケージ・apt・RPM)
OS別対応表
| AlmaLinux 9 | Ubuntu 24.04 LTS |
| dnf | apt |
| vim-minimal | vim-tiny / vim |
| gcc/gcc-gfortran | gcc/g++/gfortran |
| openmpi-devel | libopenmpi-dev |
| openblas-devel | libopenblas-dev |
| scalapack-openmpi-devel | libscalapack-openmpi-dev |
| fftw-devel | libfftw3-dev |
sudo apt update
sudo apt upgrade -y
sudo apt install -y vim
sudo apt install -y \
rsync \
make \
g++
sudo apt install -y \
build-essential \
gfortran \
openmpi-bin \
libopenmpi-dev \
libopenblas-dev \
libscalapack-openmpi-dev \
libfftw3-dev
確認:
gcc --version
gfortran --version
which mpirun
which mpif90
mpirun --version
mpif90 --showme
sudo apt install -y \
python3.12 \
python3.12-venv \
python3-pip \
python3-tk
確認:
python3.12 -m tkinter
venv環境作成:
cd /home/share
python3.12 -m venv 312
source ./312/bin/activate
source /home/share/312/bin/activate
export VASPRoot=/home/share/vasp.6.6.1
export PATH=$VASPRoot/bin:$PATH
export QE_ROOT=/home/share/qe-7.6
export PATH="$QE_ROOT/build/bin:/usr/bin:/bin:$PATH"
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
cd /home/share
tar xf vasp.6.6.1.tar.gz
cd vasp.6.6.1
cp arch/makefile.include.gnu_omp makefile.include
# scaLAPACK (mandatory)
#SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
SCALAPACK = -lscalapack-openmpi
# FFTW (mandatory)
#FFTW_ROOT ?= /path/to/your/fftw/installation
LLIBS += -lfftw3 -lfftw3_omp
INCS += -I/usr/include
make veryclean
make DEPS=1 -j8 all
実行:
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
mpirun -np 4 vasp_std
Quantum Espresso - Advancing quantum simulations of materials for everyone
sudo apt update -y
sudo apt install \
zip \
unzip \
rsync \
bc \
gawk \
sed \
grep \
coreutils \
findutils \
procps \
tar \
gzip
sudo apt install -y \
gcc \
g++ \
gfortran \
make \
m4 \
perl \
wget \
git \
pkg-config \
openmpi-bin \
libopenmpi-dev \
libopenblas-dev \
liblapack-dev \
libfftw3-dev \
libfftw3-mpi-dev \
libscalapack-openmpi-dev
確認:
which gcc
which gfortran
which mpif90
which mpirun
gcc --version
gfortran --version
mpif90 --version
mpirun --version
QEコンパイル:
cd /home/share
wget https://gitlab.com/QEF/q-e/-/archive/qe-7.6/q-e-qe-7.6.tar.gz
tar xzf q-e-qe-7.6.tar.gz
mv q-e-qe-7.6 qe-7.6
cd qe-7.6
mkdir build
cd build
../configure
確認:
grep -E "MPIF90|BLAS_LIBS|LAPACK_LIBS|FFT_LIBS|SCALAPACK_LIBS" make.inc
pw.xコンパイル:
make -j8 pw 2>&1 | tee make_pw.log
allコンパイル:
make -j8 all 2>&1 | tee make_all.log
実行:
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
mpirun -np 4 pw.x -in input.in > output.out 2>&1
sudo apt update
sudo apt install openssh-server
sudo systemctl enable --now ssh
sshdの動作確認:
sudo sshd -t
systemctl status ssh --no-pager
Windows PowerShellから接続を確認:
ssh tkamiya@localhost
sftp tkamiya@localhost
Winmostar:
ツール → リモートジョブ投入
Add Profile
| 項目 | 設定例 |
|---|
|
Test
Connectionをクリックします。
初回接続でStore key in cache? (y/n)と聞かれたら 'y'。
成功すると、
Connection test succeeded.
と表示されます。
WinmostarからWSL2のtemporary directoryへ転送された *.sh に実行権限がつかないことについて
回避策: /usr/bin/nohup が呼ばれる前に、wrapper を呼ばせる
sudo vi /usr/local/bin/nohup
#!/bin/bash
printf '%s user=%s cwd=%s args=%s\n' \
"$(date -Is)" "$(id -un)" "$PWD" "$*" \
>> "$HOME/winmostar-nohup.log"
chmod u+x -- ./*.sh 2>/dev/null || true
if [[ $# -gt 0 && "$1" == *.sh ]]; then
SCRIPT="$1"
shift
exec /usr/bin/nohup /bin/bash "$SCRIPT" "$@"
fi
exec /usr/bin/nohup "$@"
sudo chmod 755 /usr/local/bin/nohup
/usr/bin/nohup より先に、/usr/local/bin/nohup
が呼ばれることを確認:
command -v nohup