forked from QMCPACK/qmcpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_alcf_sunspot_icpx.sh
executable file
·98 lines (78 loc) · 2.67 KB
/
build_alcf_sunspot_icpx.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# This recipe is intended for ALCF Sunspot https://www.alcf.anl.gov/support-center/aurora-sunspot
# last revision: June 11th 2024
#
# How to invoke this script?
# build_alcf_sunspot_icpx.sh # build all the variants assuming the current directory is the source directory.
# build_alcf_sunspot_icpx.sh <source_dir> # build all the variants with a given source directory <source_dir>
# build_alcf_sunspot_icpx.sh <source_dir> <install_dir> # build all the variants with a given source directory <source_dir> and install to <install_dir>
for module_name in oneapi/release oneapi/eng-compiler
do
if module is-loaded $module_name ; then module unload $module_name; fi
done
module load spack-pe-gcc cmake
module load oneapi/eng-compiler/2024.04.15.002
module load hdf5/1.14.3 boost/1.84.0
module list >& module_list.txt
echo "**********************************"
echo '$ icpx -v'
icpx -v
echo "**********************************"
TYPE=Release
Machine=sunspot
Compiler=icpx20240227
if [[ $# -eq 0 ]]; then
source_folder=`pwd`
elif [[ $# -eq 1 ]]; then
source_folder=$1
else
source_folder=$1
install_folder=$2
fi
if [[ -f $source_folder/CMakeLists.txt ]]; then
echo Using QMCPACK source directory $source_folder
else
echo "Source directory $source_folder doesn't contain CMakeLists.txt. Pass QMCPACK source directory as the first argument."
exit
fi
for name in offload_sycl_real_MP offload_sycl_real offload_sycl_cplx_MP offload_sycl_cplx \
cpu_real_MP cpu_real cpu_cplx_MP cpu_cplx
do
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$TYPE -DMPIEXEC_PREFLAGS='--cpu-bind;depth;-d;8'"
unset CMAKE_CXX_FLAGS
if [[ $name == *"cplx"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DQMC_COMPLEX=ON"
fi
if [[ $name == *"_MP"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DQMC_MIXED_PRECISION=ON"
fi
if [[ $name == *"offload"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_OFFLOAD=ON -DQMC_GPU_ARCHS=pvc"
CMAKE_CXX_FLAGS="-mllvm -vpo-paropt-atomic-free-reduction-slm=true"
fi
if [[ $name == *"sycl"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_SYCL=ON"
fi
folder=build_${Machine}_${Compiler}_${name}
if [[ -v install_folder ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DCMAKE_INSTALL_PREFIX=$install_folder/$folder"
fi
echo "**********************************"
echo "folder $folder"
echo "CMAKE_FLAGS: $CMAKE_FLAGS"
echo "CMAKE_CXX_FLAGS: $CMAKE_CXX_FLAGS"
echo "**********************************"
mkdir $folder
cd $folder
if [ ! -f CMakeCache.txt ] ; then
cmake $CMAKE_FLAGS -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \
-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx $source_folder
fi
if [[ -v install_folder ]]; then
make -j16 install && chmod -R -w $install_folder/$folder
else
make -j16
fi
cd ..
echo
done