forked from m-a-d-n-e-s-s/madness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
62 lines (49 loc) · 2.03 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# check if conda is there
if ! command -v conda &> /dev/null
then
echo "conda is not installed"
exit 1
fi
set -e
# install compilers (linux only: others need to install manually)
echo building on $(uname -a)
os=$(uname -a | cut -d ' ' -f 1)
if [ "$os" = "Linux" ]; then
echo "This is a Linux system, we can install compilers with conda"
conda install gxx_linux-64 -y
conda install mkl-devel
else
echo "please check and install compilers g++ >8 and mpich manually"
fi
# define your target directories
# to override: just call the script like e.g. "CC=whatever bash build.sh"
CC=${CC-mpicc}
MPI_CC=${MPI_CC-mpicc}
CXX=${CXX-mpicxx}
MPI_CXX=${MPI_CXX-mpicxx}
MAD_SRC_DIR=${MAD_SRC_DIR-madness_src}
MAD_ROOT_DIR=${MAD_ROOT_DIR-madness}
NUMCPP_SRC_DIR=${NUMCPP_SRC_DIR-numcpp}
mkdir ${MAD_ROOT_DIR}
export MAD_SRC_DIR=${MAD_SRC_DIR} # add path to directory where you want the source code
export MAD_ROOT_DIR=${MAD_ROOT_DIR} # add path to directory where you want the compiled code
export NUMCPP_SRC_DIR=${NUMCPP_SRC_DIR} # add path to directory where you want the numcpp dependency
# make sure that tequila will find it later
echo "added by madness install script" >> ~/.bashrc
echo "export MAD_ROOT_DIR=${MAD_ROOT_DIR}" >> ~/.bashrc
# get the sources
git clone https://github.com/kottmanj/madness.git $MAD_SRC_DIR
git clone https://github.com/dpilger26/numcpp $NUMCPP_SRC_DIR
# install dependencies
conda install cmake boost -y
# export paths to dependencies
export CPLUS_INCLUDE_PATH=$(realpath $NUMCPP_SRC_DIR/include):$CPLUS_INCLUDE_PATH
# make sure that the right boost and mkl are found and used
export CPLUS_INCLUDE_PATH=$(realpath $CONDA_PREFIX/include):$CPLUS_INCLUDE_PATH
cmake -D ENABLE_MKL=ON -D ENABLE_MPI=OFF -D CMAKE_CXX_FLAGS='-O3 -DNDEBUG -march=native' -S $MAD_SRC_DIR -B $MAD_ROOT_DIR
# compile
make -j -C $MAD_ROOT_DIR
make -j -C $MAD_ROOT_DIR/src/apps/pno pno_integrals
# add MAD_ROOT_DIR to conda env
conda env config vars set MAD_ROOT_DIR=$(realpath ${MAD_ROOT_DIR})
~