0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Fedora 44で第一原理計算GPAWを使う

0
Posted at

背景

ビルドオプションを用いた最適化等を行うためにはソースからインストールすべきだが,依存関係等が複雑であるため,整理しておく.

手順

依存関係のインストール

Nvidiaの場合,CUDAは先にセットアップ済みとする

sudo dnf install fftw* libxc libxc-devel openblas* \
    openblas-devel blas* openmpi openmpi
    -devel scalapack* \
    magma magma-devel
sudo dnf install rocm-hip* hip* # AMD GPUならば

インストールとビルド

libvdwxc

公式wikiとほぼ同様だが,autoreconfによって./configureを作成する必要がある.

mkdir ~/GPAW
cd ~/GPAW
sudo dnf install autoconf automake libtool*
git clone https://gitlab.com/libvdwxc/libvdwxc.git
cd libvdwxc
autoreconf -fi
mkdir my-build-with-gcc
cd my-build-with-gcc
../configure --prefix="$HOME/GPAW/libvdwxc" CC="mpicc" CXX="mpixcc" \
  FC="mpifort" CFLAGS="-O3 -march=native" FCFLAGS="-g -O2"
make -j4   # Run make using 4 processors
make check
make install

elpa

sudo dnf install lapack*
cd ~/GPAW
git clone -b new_release_2026_02_002 https://gitlab.mpcdf.mpg.de/elpa/elpa
cd elpa
./autogen.sh
autoreconf -fi
mkdir my-build-with-gcc
cd my-build-with-gcc
../configure --prefix="$HOME/GPAW/elpa" --disable-avx512 CC="mpicc" FC="mpifort" CXX="mpicxx" CFLAGS="-O3 -march=native" FCFLAGS="-g -O2" # コンシューマCPUの場合
make
make check
make install
cd ~/GPAW
ls ./elpa/include #ここでインストールされたパスを確認しておく

GPAW

cd ~/GPAW
git clone -b 26.7.0 https://gitlab.com/gpaw/gpaw.git
cd gpaw
cp siteconfig_example.py siteconfig.py
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

該当箇所を書き換える

siteconfig.py
# MPI:
mpi = True
if mpi:
    compiler = 'mpicxx'
    
# Use Elpa (requires ScaLAPACK and Elpa API 20171201):
elpa = True
if Elpa:
    elpadir = '/home/sapphire/GPAW/elpa'
    libraries += ['elpa']
    library_dirs += ['{}/lib'.format(elpadir)]
    runtime_library_dirs += ['{}/lib'.format(elpadir)]
    include_dirs += ['{}/include/elpa-2026.02.002'.format(elpadir)]
    # Search for your dir
    
# libvdwxc:
libvdwxc = True
if libvdwxc:
    path = '/home/sapphire/GPAW/libvdwxc'
    include_dirs += ['%s/include' % path]
    library_dirs += ['%s/lib' % path]
    runtime_library_dirs += ['%s/lib' % path]
    libraries += ['vdwxc']
    
# 以下追加


## AMD-GPUならば
# magma = True

# GPU and BLAS, etc.:
gpu = True
gpu_target = 'cuda'
gpu_compiler = 'nvcc'
#GCC V15
gpu_compile_args = ['-O3',
                    '-g',
                    '-ccbin', '/usr/bin/g++-15', 
                    '-gencode', 'arch=compute_89,code=sm_89']
libraries += ['cudart', 'cublas', 'blas']
library_dirs += ['/usr/local/cuda/lib64']
runtime_library_dirs += ['/usr/local/cuda/lib64']

ターミナルに戻る

python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -U cupy-cuda13x
pip install ase
rm -r ./build
pip install .
``
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?