Skip to content

Commit 7c2f6ef

Browse files
committed
implement pack-run function
1 parent 0ec187d commit 7c2f6ef

23 files changed

+125
-64
lines changed

toolchain/install_abacus_toolchain.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ OPTIONS:
115115
--target-cpu Compile for the specified target CPU (e.g. haswell or generic), i.e.
116116
do not optimize for the actual host system which is the default (native)
117117
--dry-run Write only config files, but don't actually build packages.
118+
--pack-run Only check and install required packages without actually unpack and build packages
118119
119120
The --enable-FEATURE options follow the rules:
120121
--enable-FEATURE=yes Enable this particular feature
121122
--enable-FEATURE=no Disable this particular feature
122123
--enable-FEATURE The option keyword alone is equivalent to
123124
--enable-FEATURE=yes
124-
===== NOTICE: THESE FEATURE AER NOT INCLUDED IN ABACUS =====
125+
===== NOTICE: THESE GPU FEATURE IS ON TESTING =====
125126
--enable-cuda Turn on GPU (CUDA) support (can be combined
126127
with --enable-opencl).
127128
Default = no
@@ -329,6 +330,7 @@ export intel_classic="no"
329330
# but icx is recommended by intel compiler
330331
# option: --with-intel-classic can change it to yes/no
331332
# QuantumMisaka by 2023.08
333+
export pack_run="__FALSE__"
332334
export intelmpi_classic="no"
333335
export with_ifx="yes" # whether ifx is used in oneapi
334336
export with_flang="no" # whether flang is used in aocc
@@ -461,6 +463,9 @@ while [ $# -ge 1 ]; do
461463
--dry-run)
462464
dry_run="__TRUE__"
463465
;;
466+
--pack-run)
467+
pack_run="__TRUE__"
468+
;;
464469
--enable-tsan*)
465470
enable_tsan=$(read_enable $1)
466471
if [ "${enable_tsan}" = "__INVALID__" ]; then
@@ -835,12 +840,12 @@ if [ "${dry_run}" = "__TRUE__" ]; then
835840
echo "Wrote only configuration files (--dry-run)."
836841
else
837842
echo "# Leak suppressions" > ${INSTALLDIR}/lsan.supp
843+
echo "pack_run: ${pack_run}"
838844
./scripts/stage0/install_stage0.sh
839845
./scripts/stage1/install_stage1.sh
840846
./scripts/stage2/install_stage2.sh
841847
./scripts/stage3/install_stage3.sh
842848
./scripts/stage4/install_stage4.sh
843-
fi
844849

845850
cat << EOF
846851
========================== usage =========================
@@ -858,5 +863,6 @@ or you can modify the builder scripts to suit your needs.
858863
"""
859864
EOF
860865

866+
fi
861867

862868
#EOF

toolchain/scripts/stage0/install_amd.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ case "${with_amd}" in
2727
__INSTALL__)
2828
echo "==================== Installing the AMD compiler ======================"
2929
echo "__INSTALL__ is not supported; please install the AMD compiler manually"
30-
exit 1
30+
if [ "${pack_run}" != "__TRUE__" ]; then
31+
exit 1
32+
fi
3133
;;
3234
__SYSTEM__)
3335
echo "==================== Finding AMD compiler from system paths ===================="

toolchain/scripts/stage0/install_cmake.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ case "${with_cmake}" in
4545
else
4646
download_pkg_from_ABACUS_org "${cmake_sha256}" "$cmake_pkg"
4747
fi
48-
echo "Installing from scratch into ${pkg_install_dir}"
49-
mkdir -p ${pkg_install_dir}
50-
/bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log
51-
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
48+
if [ "${pack_run}" = "__TRUE__" ]; then
49+
echo "--pack-run mode specified, skip installation"
50+
else
51+
echo "Installing from scratch into ${pkg_install_dir}"
52+
mkdir -p ${pkg_install_dir}
53+
/bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log
54+
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
55+
fi
5256
fi
5357
;;
5458
__SYSTEM__)

toolchain/scripts/stage0/install_gcc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ case "${with_gcc}" in
4242
else
4343
download_pkg_from_ABACUS_org "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz"
4444
fi
45+
if [ "${pack_run}" = "__TRUE__" ]; then
46+
echo "--pack-run mode specified, skip installation"
47+
else
4548
[ -d gcc-${gcc_ver} ] && rm -rf gcc-${gcc_ver}
4649
tar -xzf gcc-${gcc_ver}.tar.gz
4750

@@ -115,6 +118,7 @@ case "${with_gcc}" in
115118
cd ../..
116119
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
117120
fi
121+
fi
118122
check_install ${pkg_install_dir}/bin/gcc "gcc" && CC="${pkg_install_dir}/bin/gcc" || exit 1
119123
check_install ${pkg_install_dir}/bin/g++ "gcc" && CXX="${pkg_install_dir}/bin/g++" || exit 1
120124
check_install ${pkg_install_dir}/bin/gfortran "gcc" && FC="${pkg_install_dir}/bin/gfortran" || exit 1

toolchain/scripts/stage0/install_intel.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ case "${with_intel}" in
2626
__INSTALL__)
2727
echo "==================== Installing the Intel compiler ===================="
2828
echo "__INSTALL__ is not supported; please install the Intel compiler manually"
29+
if [ "${pack_run}" != "__TRUE__" ]; then
30+
exit 1
31+
fi
2932
exit 1
3033
;;
3134
__SYSTEM__)

toolchain/scripts/stage1/install_intelmpi.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ case "${with_intelmpi}" in
2727
__INSTALL__)
2828
echo "==================== Installing Intel MPI ===================="
2929
echo '__INSTALL__ is not supported; please manually install Intel MPI'
30-
exit 1
30+
if [ "${pack_run}" != "__TRUE__" ]; then
31+
exit 1
32+
fi
3133
;;
3234
__SYSTEM__)
3335
echo "==================== Finding Intel MPI from system paths ===================="

toolchain/scripts/stage1/install_mpich.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ case "${with_mpich}" in
4747
#download_pkg_from_ABACUS_org "${mpich_sha256}" "${mpich_pkg}"
4848
download_pkg_from_url "${mpich_sha256}" "${mpich_pkg}" "${url}"
4949
fi
50+
if [ "${pack_run}" = "__TRUE__" ]; then
51+
echo "--pack-run mode specified, skip installation"
52+
else
5053
echo "Installing from scratch into ${pkg_install_dir} for MPICH device ${MPICH_DEVICE}"
5154
[ -d mpich-${mpich_ver} ] && rm -rf mpich-${mpich_ver}
5255
tar -xzf ${mpich_pkg}
@@ -72,6 +75,10 @@ case "${with_mpich}" in
7275
cd ..
7376
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
7477
fi
78+
fi
79+
if [ "${pack_run}" = "__TRUE__" ]; then
80+
echo "--pack-run mode specified, skip system check"
81+
else
7582
check_dir "${pkg_install_dir}/bin"
7683
check_dir "${pkg_install_dir}/lib"
7784
check_dir "${pkg_install_dir}/include"
@@ -83,6 +90,7 @@ case "${with_mpich}" in
8390
MPIF77="${MPIFC}"
8491
MPICH_CFLAGS="-I'${pkg_install_dir}/include'"
8592
MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'"
93+
fi
8694
;;
8795
__SYSTEM__)
8896
echo "==================== Finding MPICH from system paths ===================="

toolchain/scripts/stage1/install_openmpi.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ case "${with_openmpi}" in
4949
else
5050
download_pkg_from_url "${openmpi_sha256}" "${openmpi_pkg}" "${url}"
5151
fi
52+
if [ "${pack_run}" = "__TRUE__" ]; then
53+
echo "--pack-run mode specified, skip installation"
54+
else
5255
echo "Installing from scratch into ${pkg_install_dir}"
5356
[ -d openmpi-${openmpi_ver} ] && rm -rf openmpi-${openmpi_ver}
5457
tar -xjf ${openmpi_pkg}
@@ -87,6 +90,10 @@ case "${with_openmpi}" in
8790
cd ..
8891
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
8992
fi
93+
fi
94+
if [ "${pack_run}" = "__TRUE__" ]; then
95+
echo "--pack-run mode specified, skip system check"
96+
else
9097
check_dir "${pkg_install_dir}/bin"
9198
check_dir "${pkg_install_dir}/lib"
9299
check_dir "${pkg_install_dir}/include"
@@ -98,6 +105,7 @@ case "${with_openmpi}" in
98105
MPIF77="${MPIFC}"
99106
OPENMPI_CFLAGS="-I'${pkg_install_dir}/include'"
100107
OPENMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'"
108+
fi
101109
;;
102110
__SYSTEM__)
103111
echo "==================== Finding OpenMPI from system paths ===================="

toolchain/scripts/stage2/install_aocl.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,23 @@ case "${with_aocl}" in
2727
__INSTALL__)
2828
echo "==================== Installing AOCL ===================="
2929
report_error ${LINENO} "To install AOCL, please contact your system administrator."
30-
exit 1
30+
if [ "${pack_run}" != "__TRUE__" ]; then
31+
exit 1
32+
fi
3133
;;
3234
__SYSTEM__)
3335
echo "==================== Finding AOCL from system paths ===================="
34-
check_lib -lblis "AOCL"
35-
check_lib -lflame "AOCL"
36-
AOCL_LIBS="-lblis -lflame"
37-
add_include_from_paths AOCL_CFLAGS "blis.h" $INCLUDE_PATHS
38-
add_lib_from_paths AOCL_LDFLAGS "libblis.*" $LIB_PATHS
39-
add_include_from_paths AOCL_CFLAGS "lapack.h" $INCLUDE_PATHS
40-
add_lib_from_paths AOCL_LDFLAGS "libflame.*" $LIB_PATHS
36+
if [ "${pack_run}" = "__TRUE__" ]; then
37+
echo "--pack-run mode specified, skip system check"
38+
else
39+
check_lib -lblis "AOCL"
40+
check_lib -lflame "AOCL"
41+
AOCL_LIBS="-lblis -lflame"
42+
add_include_from_paths AOCL_CFLAGS "blis.h" $INCLUDE_PATHS
43+
add_lib_from_paths AOCL_LDFLAGS "libblis.*" $LIB_PATHS
44+
add_include_from_paths AOCL_CFLAGS "lapack.h" $INCLUDE_PATHS
45+
add_lib_from_paths AOCL_LDFLAGS "libflame.*" $LIB_PATHS
46+
fi
4147
;;
4248
__DONTUSE__) ;;
4349

toolchain/scripts/stage2/install_mkl.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,21 @@ case "${with_mkl}" in
2828
__INSTALL__)
2929
echo "==================== Installing MKL ===================="
3030
report_error ${LINENO} "To install MKL, please contact your system administrator."
31-
exit 1
31+
if [ "${pack_run}" != "__TRUE__" ]; then
32+
exit 1
33+
fi
3234
;;
3335
__SYSTEM__)
3436
echo "==================== Finding MKL from system paths ===================="
35-
if ! [ -z "${MKLROOT}" ]; then
36-
echo "MKLROOT is found to be ${MKLROOT}"
37+
if [ "${pack_run}" = "__TRUE__" ]; then
38+
echo "--pack-run mode specified, skip system check"
3739
else
38-
report_error ${LINENO} "Cannot find env variable MKLROOT, the script relies on it being set. Please check in MKL installation and use --with-mkl=<location> to pass the path to MKL root directory to this script."
39-
exit 1
40+
if ! [ -z "${MKLROOT}" ]; then
41+
echo "MKLROOT is found to be ${MKLROOT}"
42+
else
43+
report_error ${LINENO} "Cannot find env variable MKLROOT, the script relies on it being set. Please check in MKL installation and use --with-mkl=<location> to pass the path to MKL root directory to this script."
44+
exit 1
45+
fi
4046
fi
4147
check_lib -lm
4248
check_lib -ldl

0 commit comments

Comments
 (0)