Skip to content

Instantly share code, notes, and snippets.

@Chronum94
Last active July 18, 2020 11:43
Show Gist options
  • Save Chronum94/0b1644c86d590a9f227b94cd92e4afaf to your computer and use it in GitHub Desktop.
Save Chronum94/0b1644c86d590a9f227b94cd92e4afaf to your computer and use it in GitHub Desktop.
Hopefully helps people install their personal GPAW whenever and wherever they desire. Currently does not include Elpa help.
# openmpi/3.1.4, GCC 8.3.0
# I strongly recommend Openmpi 4/GCC 9+, especially GCC 9 has some arcane optimizations it does.
GPAW_INSTALL_ROOT=
OPENBLAS_INSTALL_DIR=
LIBXC_INSTALL_DIR=
FFTW_INSTALL_DIR=
SCALAPACK_INSTALL_DIR=
ELPA_INSTALL_DIR=
LIBVDWXC_INSTALL_DIR=
# At the time of this install, OpenBLAS was v0.39dev. Pick a stable release if you're not adventurous.
git clone https://github.com/xianyi/OpenBLAS
cd OpenBLAS
# Changes to Makefile.rule
# DYNAMIC_ARCH=1
# COMMON_OPT+=-O3 # This one is optional. The perf gains are almost noise...
make TARGET=HASWELL # This gets changed as you prefer
make PREFIX=$OPENBLAS_INSTALL_DIR install
# 4.3.x, I think 5 breaks GPAW.
git clone https://gitlab.com/libxc/libxc/
git tag
git checkout v$your choice here
# Follow instructions on Gitlab repo to the dot, I add a prefix since I do personal installs.
wget http://www.fftw.org/fftw-3.3.8.tar.gz
# The -ffast-math is VERY important here. Affects perf by ~300%.
CFLAGS="-O3 -fomit-frame-pointer -mtune=intel -malign-double -fstrict-aliasing -fno-schedule-insns -ffast-math" ./configure --enable-mpi --enable-openmp --enable-sse2 --enable
-avx --enable-avx2 --enable-avx512 --enable-threads --enable-shared --prefix=$FFTW_INSTALL_DIR CC=gcc
# Update the targz if Scalapack has updated. It doesn't often update...
wget https://github.com/Reference-ScaLAPACK/scalapack/archive/v2.1.0.tar.gz
mkdir build
cd build
CC=mpicc FC=mpif90 cmake .. -L -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SCALAPACK_INSTALL_DIR -DLAPACK_LIBRARIES="$OPENBLAS_INSTALL_DIR/lib/libopenblas.a" -DBLAS_LIBRARIES="$OPENBLAS_INSTALL_DIR/lib/libopenblas.a" -DUSE_OPTIMIZED_LAPACK_BLAS=ON
# If you're using GCC 10: add -DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch" to the above.
#!! Try both OPTIMIZED_LAPACK_BLAS=ON and OFF. I have seen inconsistent behaviour... just make sure it's using the OpenBLAS.
make -j
make test
make install
git clone https://gitlab.com/libvdwxc
# the CFLAGS optimizations can be changed as you prefer/your chip instruction set.
MPI_LIBS="-L/$MPILIBDIR -lmpi" CC=mpicc FC=mpif90 CFLAGS="-mavx -mtune=intel -O3 -ftree-vectorize" FFTW3_INCLUDES="-I$FFTW_INSTALL_DIR/include" FFTW3_LIBS="-L$FFTW_INSTALL_DIR/lib -lfftw3 -lfftw3_mpi" ../configure --prefix=$LIBVDWXC_INSTALL_DIR
#!! ALL $BLAHBLAH needs to be replaced by their actual values in the siteconfig.py file.
In siteconfig.py:
# This is to force GPAW to use our installed OpenBLAS.
# I know we don't officially use BLAS/Lapack outside scipy anymore, but it always errors out for me...
include_dirs += ['$OPENBLAS_INSTALL_DIR/include/']
extra_link_args +=['$OPENBLAS_INSTALL_DIR/lib/libopenblas.a']
# Because.
compiler = 'mpicc'
fftw = True
if fftw:
include_dirs += ['$FFTW_INSTALL_DIR/include']
library_dirs += ['$FFTW_INSTALL_DIR/lib']
extra_link_args += ['-Wl,-rpath=$FFTW_INSTALL_DIR/lib']
libraries += ['fftw3', 'fftw3_mpi']
scalapack = True
if scalapack:
libraries += ['scalapack']
library_dirs += ['$SCALAPACK_INSTALL_DIR/lib']
extra_link_args += ['-Wl,-rpath=$SCALAPACK_INSTALL_DIR/lib']
if 1:
xc = '$LIBXC_INSTALL_DIR/'
include_dirs += [xc + 'include']
extra_link_args += [xc + 'lib64/libxc.a']
if 'xc' in libraries:
libraries.remove('xc')
if 1:
libvdwxc = True
path = '$LIBVDWXC_INSTALL_DIR/'
extra_link_args += ['-Wl,-rpath=%s/lib' % path]
library_dirs += ['%s/lib' % path]
include_dirs += ['%s/include' % path]
libraries += ['vdwxc']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment