diff --git a/ManufacturingSimulation/OpenLB-1.5-0/OpenLB-1.5-0.sh b/ManufacturingSimulation/OpenLB-1.5-0/OpenLB-1.5-0.sh new file mode 100644 index 0000000000000000000000000000000000000000..32c75a8a857443c9fe65000f981e13fb7f4f14a5 --- /dev/null +++ b/ManufacturingSimulation/OpenLB-1.5-0/OpenLB-1.5-0.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -e +if [[ $# -ne 2 ]]; then + echo "The format is as follows:" + echo "bash OpenLB-1.5-0.sh buildpath installpath" + echo ":param buildpath:请输入应用构建绝对路径" + echo ":param installpath: 应用安装绝对路径" + exit 1 +fi + +[[ ! "$1" =~ ^/.* || ! -d "$1" || "$1" = "/" ]] && echo "请输入正确的构建路径" && exit 1 +[[ ! "$2" =~ ^/.* || ! -d "$2" || "$2" = "/" ]] && echo "请输入正确的安装路径" && exit 1 + +buildpath=$1 +installpath=$2 +[[ "$buildpath" =~ .*/$ ]] && buildpath=${buildpath%/*} +[[ "$installpath" =~ .*/$ ]] && installpath=${installpath%/*} +if [[ "$buildpath" = "$installpath" ]]; then echo "构建路径和安装路径相同,请重新输入"; exit 1; fi + + +yum install -y cmake gcc gcc-c++ wget git + +cd $buildpath +wget -t 0 -c -P $buildpath https://www.openlb.net/wp-content/uploads/2022/04/olb-1.5r0.tgz +tar -xvf $buildpath/olb-1.5r0.tgz -C $buildpath && rm -rf $buildpath/olb-1.5r0.tgz +cd $buildpath/olb-1.5r0 + +sed -i "s/-march=native//g" config.mk +sed -i "s/g++/clang++/g" config.mk +sed -i "s/:= gcc/:= clang/g" config.mk + +cd $buildpath/olb-1.5r0/src/utilities +sed -i "s/for_each_n/for_each/g" benchmarkUtil.h + + +export CC=clang +export CXX=clang++ +export FC=flang + + +cd $buildpath/olb-1.5r0 +make + +cd $buildpath/olb-1.5r0/examples/thermal/rayleighBenard2d +make +./rayleighBenard2d + + +ls -d */ + +zip -r tmp.zip tmp +cp tmp.zip $installpath + + diff --git a/ManufacturingSimulation/OpenLB-1.5-0/build.sh b/ManufacturingSimulation/OpenLB-1.5-0/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..5fa09140765be4cbc6470ac123c5138726520b0b --- /dev/null +++ b/ManufacturingSimulation/OpenLB-1.5-0/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash +set -e +if [[ $# -ne 2 ]]; then + echo "The format is as follows:" + echo "bash build.sh buildpath installpath" + echo ":param buildpath: 应用构建绝对路径" + echo ":param installpath: 应用安装绝对路径" + exit 1 +fi + +if [[ ! "$1" =~ ^/.* || "$1" = "/" ]]; then echo "请输入正确的构建路径"; exit 1; fi +if [[ ! "$2" =~ ^/.* || "$2" = "/" ]]; then echo "请输入正确的安装路径"; exit 1; fi + +buildpath=$1 +installpath=$2 +if [[ "$1" =~ .*/$ ]]; then buildpath=${buildpath%/*}; fi +if [[ "$2" =~ .*/$ ]]; then installpath=${installpath%/*}; fi +if [ ! -d "$buildpath" ]; then mkdir -p $buildpath; else mv $buildpath $buildpath`date "+%y%m%d%H%M%S"` && mkdir -p $buildpath; fi +if [ ! -d "$installpath" ]; then mkdir -p $installpath; else mv $installpath $installpath`date "+%y%m%d%H%M%S"` && mkdir -p $installpath; fi + +yum install -y m4 environment-modules systemd-devel +source /etc/profile +module purge + +dep_dir="dependency" +bash $dep_dir/bisheng-compiler-2.1.0.sh $buildpath $installpath +module use $installpath/bisheng-compiler-2.1.0 +module load $installpath/bisheng-compiler-2.1.0/bisheng_modulefiles + + +bash OpenLB-1.5-0.sh $buildpath $installpath + +mkdir -p pkg/OpenLB-1.5-0-hpc && cp -r $installpath/* pkg/OpenLB-1.5-0-hpc/ +cat>"pkg/OpenLB-1.5-0-hpc/run.sh"< /dev/null +current_dir=\$(cd "\$(dirname "\${BASH_SOURCE[0]}")" &> /dev/null && pwd) +for d in \$(ls \$current_dir) +do + [[ ! \$d =~ "OpenLB" && ! -f "\$current_dir/\$d" ]] && cd \$current_dir/\$d && module use \$(pwd) && module load \$(pwd)/*modulefiles +done +cd \$current_dir +EOF + +cd pkg/ && tar zcvf OpenLB-1.5-0-hpc.tar.gz OpenLB-1.5-0-hpc + +rm -rf $buildpath $installpath + diff --git a/ManufacturingSimulation/OpenLB-1.5-0/dependency/bisheng-compiler-2.1.0.sh b/ManufacturingSimulation/OpenLB-1.5-0/dependency/bisheng-compiler-2.1.0.sh new file mode 100644 index 0000000000000000000000000000000000000000..4e56397ec44f00f937ec6d8202b6a6040a3248e3 --- /dev/null +++ b/ManufacturingSimulation/OpenLB-1.5-0/dependency/bisheng-compiler-2.1.0.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +if [[ $# -ne 2 ]]; then + echo "The format is as follows:" + echo "bash bisheng-compiler-2.1.0.sh buildpath installpath" + echo ":param buildpath: 应用构建绝对路径" + echo ":param installpath: 应用安装绝对路径" + exit 1 +fi + +[[ ! "$1" =~ ^/.* || ! -d "$1" || "$1" = "/" ]] && echo "请输入正确的构建路径" && exit 1 +[[ ! "$2" =~ ^/.* || ! -d "$2" || "$2" = "/" ]] && echo "请输入正确的安装路径" && exit 1 + +buildpath=$1 +installpath=$2 +[[ "$buildpath" =~ .*/$ ]] && buildpath=${buildpath%/*} +[[ "$installpath" =~ .*/$ ]] && installpath=${installpath%/*} +if [[ "$buildpath" = "$installpath" ]]; then echo "构建路径和安装路径相同,请重新输入"; exit 1; fi + +set -e +yum install -y wget tar environment-modules libatomic + +wget -t 0 -c -P $buildpath https://mirrors.huaweicloud.com/kunpeng/archive/compiler/bisheng_compiler/bisheng-compiler-2.1.0-aarch64-linux.tar.gz +tar xf $buildpath/bisheng-compiler-2.1.0-aarch64-linux.tar.gz -C $buildpath && rm -rf $buildpath/bisheng-compiler-2.1.0-aarch64-linux.tar.gz +mkdir -p $installpath/bisheng-compiler-2.1.0 && cp -r $buildpath/bisheng-compiler-2.1.0-aarch64-linux/* $installpath/bisheng-compiler-2.1.0/ + +cat>"$installpath/bisheng-compiler-2.1.0/bisheng_modulefiles"<