#!/bin/bash
CUR_PATH=$(pwd)
chmod -R +x ./benchmark
chmod -R +x ./package
chmod -R +x ./test
chmod +x ./*.sh
chmod +x jarvis
mkdir -p tmp
export JARVIS_ROOT=${CUR_PATH}
export JARVIS_COMPILER=${CUR_PATH}/software/compiler
export JARVIS_MPI=${CUR_PATH}/software/mpi
export JARVIS_LIBS=${CUR_PATH}/software/libs
export JARVIS_UTILS=${CUR_PATH}/software/utils
export JARVIS_DOWNLOAD=${CUR_PATH}/downloads
export JARVIS_MODULES=${CUR_PATH}/software/modulefiles
export JARVIS_MODULEDEPS=${CUR_PATH}/software/moduledeps
export JARVIS_TMP=/tmp
export JARVIS_TMP_DOWNLOAD=${CUR_PATH}/tmp
export JARVIS_EXE=${CUR_PATH}/exe
export JARVIS_PROXY=https://github.com
export UseGitee=1
export UseLatest=0
export DOWNLOAD_TOOL=${CUR_PATH}/package/common/download.sh
export CHECK_DEPS=${CUR_PATH}/package/common/check_deps.sh
export CHECK_ROOT=${CUR_PATH}/package/common/check_root.sh
export kp=neon
ifsme=`lscpu|grep sme`
ifsve=`lscpu|grep sve`
ifneon=`lscpu|grep asimd`
if [ -n "$ifsme" ]; then
export kp=sme
elif [ -n "$ifsve" ]; then
export kp=sve
elif [ -n "$ifneon" ]; then
export kp=neon
else
echo "not in kunpeng architecture"
fi
if [ ${UseLatest} -eq 0 ];then
export HPCKIT_VERSION=25.1.0
export BISHENG_VERSION=4.2.0.2
export HMPI_VERSION=25.1.0
elif [ ${UseLatest} -eq 1 ];then
export HPCKIT_VERSION=latest
else
echo "[ERROR] UseLatest=${UseLatest}, unsupported value."
exit 1
fi
file_path="${JARVIS_ROOT}/software/utils/hpckit/${HPCKIT_VERSION}/HPCKit/${HPCKIT_VERSION}/modulefiles/bisheng"
if [ -e "$file_path" ]; then
echo -e "你正在使用 $HPCKIT_VERSION 版本的 HPCKit"
export BISHENG_VERSION=`ls $file_path|grep compiler|awk -F "compiler" '{print $2}'`
export HMPI_VERSION=`ls $file_path|grep hmpi|awk -F "hmpi" '{print $2}'`
else
echo -e "INFO: 检测到未安装 $HPCKIT_VERSION 版本的 HPCKit,请依次执行以下命令安装:"
echo -e "./jarvis -use templates/basic_env/data.hpckit.config\n./jarvis -dp"
fi
if ! type module >/dev/null 2>&1;then
echo "Install environment-modules"
. $CHECK_ROOT && yum install -y environment-modules || apt install -y environment-modules
source /etc/profile
fi