Scripts for Champ

This commit is contained in:
Anthony Scemama 2024-04-11 11:23:49 +02:00
parent 15162c435b
commit 97d2789951
10 changed files with 353 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.sif
*/*/

131
Champ/champ.def Normal file
View File

@ -0,0 +1,131 @@
BootStrap: docker
From: ubuntu:22.04
%labels
Author scemama@irsamc.ups-tlse.fr
%help
Container for running CHAMP.
%environment
export LANG="C"
export LANGUAGE=$LANG
export LC_ALL=$LANG
%files
champ.def /opt/install/champ.def
../lib/install_champ.sh /opt/install/install_champ.sh
../lib/install_qmckl.sh /opt/install/install_qmckl.sh
../lib/install_trexio.sh /opt/install/install_trexio.sh
../lib/install_trexio_python.sh /opt/install/install_trexio_python.sh
../lib/install_oneapi.sh /opt/install/install_oneapi.sh
%setup
# mkdir -p ${APPTAINER_ROOTFS}/opt/install
# cp champ.def ${APPTAINER_ROOTFS}/opt/install/champ.def
%post
cd /opt/install
./setup_image.sh
./install_oneapi.sh
# Install dependencies
# --------------------
apt install -y cmake python3 python3-pip git \
make m4 mlocate autotools-dev pkg-config \
libhdf5-dev \
bash vim emacs-nox
ln -s /usr/bin/python3 /usr/bin/python
# Install TREXIO
# --------------
cd /opt
wget https://github.com/TREX-CoE/trexio/releases/download/v2.4.2/trexio-2.4.2.tar.gz
tar -zxvf trexio-2.4.2.tar.gz
cd trexio-2.4.2
./configure --prefix=/usr
make -j 8
make -j 8 check
make install
cd ..
rm -rf trexio-2.4.2 trexio-2.4.2.tar.gz
pip install trexio
# Install QMCkl
# -------------
cflags="-Ofast -g -qmkl=sequential -ftz -fma -march=core-avx2"
fcflags="-Ofast -g -qmkl=sequential -ftz -fma -march=core-avx2 -ip"
wget https://github.com/TREX-CoE/qmckl/releases/download/v1.0.0/qmckl-1.0.0.tar.gz
tar -zxvf qmckl-1.0.0.tar.gz
cd qmckl-1.0.0
mkdir _build_sequential
cd _build_sequential
../configure --prefix=/usr --disable-python --disable-doc --enable-hpc --without-openmp \
CFLAGS="$cflags" FCFLAGS="$fcflags"
make -j 8
make -j 8 check
# make install
/usr/bin/install -c src/.libs/libqmckl.so.0.0.0 /usr/lib/libqmckl-sequential.so.0.0.0
(cd /usr/lib \
&& { ln -s -f libqmckl-sequential.so.0.0.0 libqmckl-sequential.so.0 \
|| { rm -f libqmckl-sequential.so.0 \
&& ln -s libqmckl-sequential.so.0.0.0 libqmckl-sequential.so.0; }; })
(cd /usr/lib \
&& { ln -s -f libqmckl-sequential.so.0.0.0 libqmckl-sequential.so \
|| { rm -f libqmckl-sequential.so \
&& ln -s libqmckl-sequential.so.0.0.0 libqmckl-sequential.so; }; })
/usr/bin/install -c src/.libs/libqmckl.lai /usr/lib/libqmckl-sequential.la
sed -i "s/libqmckl/libqmckl-sequential/g" /usr/lib/libqmckl-sequential.la
/usr/bin/install -c src/.libs/libqmckl.a /usr/lib/libqmckl-sequential.a
chmod 644 /usr/lib/libqmckl-sequential.a
ranlib /usr/lib/libqmckl-sequential.a
cd ..
mkdir _build_parallel
cd _build_parallel
../configure --prefix=/usr --disable-python --disable-doc --enable-hpc --with-openmp \
CFLAGS="$cflags" FCFLAGS="$fcflags"
make -j 8
make -j 8 check
make install
cd ..
cd ..
rm -rf qmckl-1.0.0 qmckl-1.0.0.tar.gz
# CHAMP
# -----
git clone --depth=1 https://github.com/filippi-claudia/champ.git
cd champ
cmake -S. -Bbuild \
-DCMAKE_Fortran_COMPILER="mpiifort" \
-DENABLE_TREXIO=ON \
-DENABLE_QMCKL=ON
cmake --build build -j 8
# Clean up
# --------
rm -rf compile-* docs tests build lib
apt remove -y intel-oneapi-compiler-dpcpp-cpp \
intel-oneapi-compiler-fortran \
intel-oneapi-mpi-devel \
wget git gcc gfortran
apt autoremove -y
apt purge -y --auto-remove
rm -rf /var/lib/apt/lists/*

10
Champ/environment.sh Executable file
View File

@ -0,0 +1,10 @@
export LANG="C"
export LANGUAGE=$LANG
export LC_ALL=$LANG
export DEBIAN_FRONTEND=noninteractive
source /opt/intel/oneapi/setvars.sh
export FC=ifort
export CC=icx

37
lib/install_champ.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
source environment.sh
cd /opt
# Install dependencies
# --------------------
apt install -y cmake python3 git \
make m4 mlocate autotools-dev pkg-config \
vim emacs-nox
ln -s /usr/bin/python3 /usr/bin/python
git clone --depth=1 https://github.com/filippi-claudia/champ.git
cd champ
cmake -S. -Bbuild \
-DCMAKE_Fortran_COMPILER="mpiifort" \
-DENABLE_TREXIO=ON \
-DENABLE_QMCKL=ON
cmake --build build -j 8
# Clean up
# --------
rm -rf compile-* docs tests build lib
apt remove -y intel-oneapi-compiler-dpcpp-cpp \
intel-oneapi-compiler-fortran \
intel-oneapi-mpi-devel \
wget git gcc gfortran
apt autoremove -y
apt purge -y --auto-remove
rm -rf /var/lib/apt/lists/*

31
lib/install_oneapi.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
source environment.sh
cd /opt
apt install -y wget pgpgpg
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor \
| tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
| tee /etc/apt/sources.list.d/oneAPI.list
apt update
#apt install -y libmkl-rt
apt install -y intel-oneapi-compiler-fortran \
intel-oneapi-compiler-fortran-runtime \
intel-oneapi-compiler-dpcpp-cpp \
intel-oneapi-compiler-dpcpp-cpp-runtime \
intel-oneapi-openmp \
intel-oneapi-mpi \
intel-oneapi-mpi-devel \
intel-oneapi-mkl-classic
ln -s /opt/intel/oneapi/compiler/latest/bin/ifort.cfg /opt/ifort.cfg
ln -s /opt/intel/oneapi/compiler/latest/bin/icx.cfg /opt/icx.cfg
echo "-diag-disable=10448" > /opt/ifort.cfg

64
lib/install_qmckl.sh Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
source environment.sh
cd /opt
apt install -y wget make pkg-config
which icx \
&& export CC=icx \
|| (apt install -y gcc libmkl-rt ; \
cp /lib/x86_64-linux-gnu/libblas.so.3 /lib/x86_64-linux-gnu/libblas.so; \
cp /lib/x86_64-linux-gnu/liblapack.so.3 /lib/x86_64-linux-gnu/liblapack.so)
which ifort \
&& export FC=ifort \
|| apt install -y gfortran
if [ $CC = icx ] ; then
export CFLAGS="-Ofast -g -qmkl=sequential -ftz -fma -march=core-avx2"
export FCFLAGS="-Ofast -g -qmkl=sequential -ftz -fma -march=core-avx2 -ip"
else
export CFLAGS="-Ofast -g -march=core-avx2"
export FCFLAGS="-Ofast -g -march=core-avx2"
fi
wget https://github.com/TREX-CoE/qmckl/releases/download/v1.0.0/qmckl-1.0.0.tar.gz
tar -zxvf qmckl-1.0.0.tar.gz
cd qmckl-1.0.0
mkdir _build_sequential
cd _build_sequential
../configure --prefix=/usr --disable-python --disable-doc --enable-hpc --without-openmp
make -j 8
make -j 8 check
# make install
/usr/bin/install -c src/.libs/libqmckl.so.0.0.0 /usr/lib/libqmckl-sequential.so.0.0.0
(cd /usr/lib \
&& { ln -s -f libqmckl-sequential.so.0.0.0 libqmckl-sequential.so.0 \
|| { rm -f libqmckl-sequential.so.0 \
&& ln -s libqmckl-sequential.so.0.0.0 libqmckl-sequential.so.0; }; })
(cd /usr/lib \
&& { ln -s -f libqmckl-sequential.so.0.0.0 libqmckl-sequential.so \
|| { rm -f libqmckl-sequential.so \
&& ln -s libqmckl-sequential.so.0.0.0 libqmckl-sequential.so; }; })
/usr/bin/install -c src/.libs/libqmckl.lai /usr/lib/libqmckl-sequential.la
sed -i "s/libqmckl/libqmckl-sequential/g" /usr/lib/libqmckl-sequential.la
/usr/bin/install -c src/.libs/libqmckl.a /usr/lib/libqmckl-sequential.a
chmod 644 /usr/lib/libqmckl-sequential.a
ranlib /usr/lib/libqmckl-sequential.a
cd ..
mkdir _build_parallel
cd _build_parallel
../configure --prefix=/usr --disable-python --disable-doc --enable-hpc --with-openmp
make -j 8
make -j 8 check
make install
cd ..
cd ..
rm -rf qmckl-1.0.0 qmckl-1.0.0.tar.gz

21
lib/install_trexio.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
source environment.sh
cd /opt
apt install -y wget libhdf5-dev make
[ -z $CC ] && apt install -y gcc
[ -z $FC ] && apt install -y gfortran
wget https://github.com/TREX-CoE/trexio/releases/download/v2.4.2/trexio-2.4.2.tar.gz
tar -zxvf trexio-2.4.2.tar.gz
cd trexio-2.4.2
./configure --prefix=/usr
make -j 8
make -j 8 check
make install
cd ..
rm -rf trexio-2.4.2 trexio-2.4.2.tar.gz

12
lib/install_trexio_python.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
source environment.sh
cd /opt
apt install -y python3 python3-pip git
pip install trexio
git clone --depth=1 https://github.com/TREX-CoE/trexio_tools.git
cd trexio_tools
pip install .

11
lib/setup_image.sh Executable file
View File

@ -0,0 +1,11 @@
# Setup
# -----
ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime
export LANG="C"
export LANGUAGE=$LANG
export LC_ALL=$LANG
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y bash

33
oneapi.def Normal file
View File

@ -0,0 +1,33 @@
BootStrap: docker
From: ubuntu:22.04
%post
#!/bin/bash
# Setup
# -----
apt_args="-y"
ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime
export LANG="C"
export LANGUAGE=$LANG
export LC_ALL=$LANG
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y wget pgpgpg
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor \
| tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
| tee /etc/apt/sources.list.d/oneAPI.list
apt update
apt install -y libmkl-rt
apt install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp
apt install -y bash vim