From a8d745839b1122ca1354ce7d73285983d06bd20e Mon Sep 17 00:00:00 2001 From: armborst_f Date: Sat, 13 Jul 2024 13:28:04 +0200 Subject: [PATCH] Cafe 1.21 setup script done --- each_matlab_1clean.sh | 32 ----------- each_matlab_2make.sh | 38 ------------- each_matlab_3test.sh | 38 ------------- each_matlab_4install.sh | 38 ------------- each_matlab_5deploy.sh | 32 ----------- each_matlab_6modulefiles.sh | 32 ----------- modulefile_template | 20 +++++++ setup.sh | 36 ------------- setup_each_matlab.sh | 104 ++++++++++++++++++++++++++++++++++++ 9 files changed, 124 insertions(+), 246 deletions(-) delete mode 100644 each_matlab_1clean.sh delete mode 100644 each_matlab_2make.sh delete mode 100644 each_matlab_3test.sh delete mode 100644 each_matlab_4install.sh delete mode 100644 each_matlab_5deploy.sh delete mode 100644 each_matlab_6modulefiles.sh create mode 100644 modulefile_template delete mode 100755 setup.sh create mode 100644 setup_each_matlab.sh diff --git a/each_matlab_1clean.sh b/each_matlab_1clean.sh deleted file mode 100644 index 8b7ec0a..0000000 --- a/each_matlab_1clean.sh +++ /dev/null @@ -1,32 +0,0 @@ -ca office network -counter=0 - -vgcc=10.4.0 -for vmat in 2024a 2023b 2023a 2022b 2022a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - make -f makefile_rel_1.21-gcc-$vgcc clean -done - -vgcc=7.3.0 -for vmat in 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - make -f makefile_rel_1.21-gcc-$vgcc clean -done diff --git a/each_matlab_2make.sh b/each_matlab_2make.sh deleted file mode 100644 index 4ccbe0c..0000000 --- a/each_matlab_2make.sh +++ /dev/null @@ -1,38 +0,0 @@ -ca office network -counter=0 - -vgcc=10.4.0 -for vmat in 2024a 2023b 2023a 2022b 2022a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - make -f makefile_rel_1.21-gcc-$vgcc - #matlab -batch "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example" -done - -vgcc=7.3.0 -for vmat in 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - make -f makefile_rel_1.21-gcc-$vgcc - #if [[ "$vmat" =~ ^(2019a|2019b|2020a|2020b|2021a|2021b)$ ]]; then - # matlab -batch "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example" - #else - # matlab -nodisplay -nosplash -nodesktop -r "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example;exit" - #fi -done diff --git a/each_matlab_3test.sh b/each_matlab_3test.sh deleted file mode 100644 index 6c662bf..0000000 --- a/each_matlab_3test.sh +++ /dev/null @@ -1,38 +0,0 @@ -ca office network -counter=0 - -vgcc=10.4.0 -for vmat in 2024a 2023b 2023a 2022b 2022a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - #make -f makefile_rel_1.21-gcc-$vgcc - matlab -batch "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example" -done - -vgcc=7.3.0 -for vmat in 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - #make -f makefile_rel_1.21-gcc-$vgcc - if [[ "$vmat" =~ ^(2019a|2019b|2020a|2020b|2021a|2021b)$ ]]; then - matlab -batch "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example" - else - matlab -nodisplay -nosplash -nodesktop -r "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example;exit" - fi -done diff --git a/each_matlab_4install.sh b/each_matlab_4install.sh deleted file mode 100644 index 0f20a52..0000000 --- a/each_matlab_4install.sh +++ /dev/null @@ -1,38 +0,0 @@ -ca office network -counter=0 - -vgcc=10.4.0 -for vmat in 2024a 2023b 2023a 2022b 2022a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - make -f makefile_rel_1.21-gcc-$vgcc install - #matlab -batch "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example" -done - -vgcc=7.3.0 -for vmat in 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - make -f makefile_rel_1.21-gcc-$vgcc install - #if [[ "$vmat" =~ ^(2019a|2019b|2020a|2020b|2021a|2021b)$ ]]; then - # matlab -batch "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example" - #else - # matlab -nodisplay -nosplash -nodesktop -r "cd RHEL8-x86_64/$vmat;disp(mocha('version'));example;exit" - #fi -done diff --git a/each_matlab_5deploy.sh b/each_matlab_5deploy.sh deleted file mode 100644 index fab5042..0000000 --- a/each_matlab_5deploy.sh +++ /dev/null @@ -1,32 +0,0 @@ -ca office network -counter=0 -vcaf=1.21.0 -vgcc=10.4.0 -for vmat in 2024a 2023b 2023a 2022b 2022a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - source /opt/psi/Cafe/cafe-matlab/setup.sh $vmat $vgcc $vcaf -done - -vgcc=7.3.0 -for vmat in 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - source /opt/psi/Cafe/cafe-matlab/setup.sh $vmat $vgcc $vcaf -done diff --git a/each_matlab_6modulefiles.sh b/each_matlab_6modulefiles.sh deleted file mode 100644 index fab5042..0000000 --- a/each_matlab_6modulefiles.sh +++ /dev/null @@ -1,32 +0,0 @@ -ca office network -counter=0 -vcaf=1.21.0 -vgcc=10.4.0 -for vmat in 2024a 2023b 2023a 2022b 2022a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - source /opt/psi/Cafe/cafe-matlab/setup.sh $vmat $vgcc $vcaf -done - -vgcc=7.3.0 -for vmat in 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a -do - printf "\n\n\n=======================================================================\n" - let counter++ - echo Step $counter - printf "=======================================================================\n" - module unload matlab - module load matlab/$vmat - module unload gcc - module load gcc/$vgcc - module list - source /opt/psi/Cafe/cafe-matlab/setup.sh $vmat $vgcc $vcaf -done diff --git a/modulefile_template b/modulefile_template new file mode 100644 index 0000000..a7cf626 --- /dev/null +++ b/modulefile_template @@ -0,0 +1,20 @@ +#%Module1.0 + +module-whatis "mocha matlab executable" +module-url "https://cafe.psi.ch" +module-license "GPL V3" +module-maintainer "Felix Armborst " + +module-help " +Versions + RHEL vrhel + EPICS vepics + GCC vgcc + CAFE vcafe + +Further details under https://cafe.psi.ch/mocha.html +" + +module load matlab/vmatlab + +prepend-path MATLABPATH "PREFIX/libexec" diff --git a/setup.sh b/setup.sh deleted file mode 100755 index fc04611..0000000 --- a/setup.sh +++ /dev/null @@ -1,36 +0,0 @@ -echo "$0 $1 $2 $#" - -if [ "$#" -ne 3 ];then - echo "Wrong number of arguments" - echo "arg1 is matlab version, e.g., 2024a" - echo "arg2 is gcc version, e.g., 10.4.0" - echo "arg3 is cafe-mocha version, e.g., 1.20.1" - return -fi - -vmatlab=$1 - -if [ "${#vmatlab}" -ne 5 ];then - echo "Your input matlab version $vmatlab is invalid; a valid example is 2024a" - return -fi - -vgcc=$2 -vmocha=$3 -vrhel=${RHREL} - - -new_dir="/opt/psi/Cafe/cafe-matlab/$vmatlab-$vrhel-gcc-$vgcc-cafe-$vmocha/libexec" -src_dir="/opt/gfa/cafe/mocha/mocha-$vmocha-gcc-$vgcc/lib/$vrhel-x86_64/$vmatlab" - -echo "new Dir: $new_dir" -echo "src Dir: $src_dir" - -mkdir -p $new_dir -# cp mocha mex file -cp $src_dir/* $new_dir -# cp mca/ca scripts -cp /afs/psi.ch/project/cafe/gitlab/CAFE/mocha/scripts/* $new_dir -ls -la $new_dir -rm -f /opt/psi/Cafe/cafe-matlab/$vmatlab -ln -s $vmatlab-$vrhel-gcc-$vgcc-cafe-$vmocha /opt/psi/Cafe/cafe-matlab/$vmatlab diff --git a/setup_each_matlab.sh b/setup_each_matlab.sh new file mode 100644 index 0000000..86c9d62 --- /dev/null +++ b/setup_each_matlab.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +# user prompt for setup step +while [[ ! $step =~ ^(0|1|2|3|4|5|6)$ ]] +do + echo "Which setup step should be run?" + echo " 0 - cleanup (make clean)" + echo " 1 - local build (make)" + echo " 2 - test local build (matlab -batch ...)" + echo " 3 - install build to /opt/gfa/cafe/mocha/ (make install)" + echo " 4 - deploy build to pmodules" + echo " 5 - update pmodule info files" + echo " 6 - test module (module load && matlab -batch ...)" + read -p "choose step (0-6): " step +done + +#ca office network +vrhel=${RHREL} +vcafe=1.21.0 +vepics=7.0.8 + +for vmatlab in 2024a 2023b 2023a 2022b 2022a 2021b 2021a 2020b 2020a 2019b 2019a 2018b 2018a +do + if [[ "$vmatlab" =~ ^(2018a|2018b|2019a|2019b|2020a|2020b|2021a|2021b)$ ]]; then + vgcc=7.3.0 + elif [[ "$vmatlab" =~ ^(2022a|2022b|2023a|2023b|2024a)$ ]]; then + vgcc=10.4.0 + fi + printf "\n\n\n=======================================================================\n" + printf "=======================================================================\n" + echo "Versions" + echo " Matlab: $vmatlab" + echo " RHEL: $vrhel" + echo " gcc: $vgcc" + echo " Cafe: $vcafe" + echo " EPICS: $vepics" + printf "=======================================================================\n" + printf "=======================================================================\n" + module unload matlab + module load matlab/$vmatlab + module unload gcc + module load gcc/$vgcc + module list + + if [ $step -eq 0 ]; then + echo "0 - cleanup (make clean)" + make -f makefile_rel_1.21-gcc-$vgcc clean + + elif [ $step -eq 1 ]; then + echo "1 - local build (make)" + make -f makefile_rel_1.21-gcc-$vgcc + + elif [ $step -eq 2 ]; then + echo "2 - test local build (matlab -batch ...)" + if [[ "$vmatlab" =~ ^(2019a|2019b|2020a|2020b|2021a|2021b|2022a|2022b|2023a|2023b|2024a)$ ]]; then + matlab -batch "cd RHEL8-x86_64/$vmatlab;disp(mocha('version'));example" + else + matlab -nodisplay -nosplash -nodesktop -r "cd RHEL8-x86_64/$vmatlab;disp(mocha('version'));example;exit" + fi + + elif [ $step -eq 3 ]; then + echo "3 - install build to /opt/gfa/cafe/mocha/ (make install)" + make -f makefile_rel_1.21-gcc-$vgcc install + + elif [ $step -eq 4 ]; then + echo "4 - deploy build to pmodules" + new_dir="/opt/psi/Cafe/cafe-matlab/$vmatlab-$vrhel-gcc-$vgcc-cafe-$vcafe/libexec" + src_dir="/opt/gfa/cafe/mocha/mocha-$vcafe-gcc-$vgcc/lib/$vrhel-x86_64/$vmatlab" + + echo " new Dir: $new_dir" + echo " src Dir: $src_dir" + + mkdir -p $new_dir + # cp mocha mex file + cp $src_dir/* $new_dir + # cp mca/ca scripts + cp /afs/psi.ch/project/cafe/gitlab/CAFE/mocha/scripts/* $new_dir + ls -la $new_dir + rm -f /opt/psi/Cafe/cafe-matlab/$vmatlab + ln -s $vmatlab-$vrhel-gcc-$vgcc-cafe-$vcafe /opt/psi/Cafe/cafe-matlab/$vmatlab + elif [ $step -eq 5 ]; then + echo "5 - update pmodule info files" + cp modulefile_template $vmatlab + sed -i -e "s/vmatlab/$vmatlab/g" $vmatlab + sed -i -e "s/vrhel/$vrhel/g" $vmatlab + sed -i -e "s/vepics/$vepics/g" $vmatlab + sed -i -e "s/vgcc/$vgcc/g" $vmatlab + sed -i -e "s/vcafe/$vcafe/g" $vmatlab + + cp $vmatlab /opt/psi/Cafe/modulefiles/cafe-matlab/$vmatlab + rm $vmatlab + + elif [ $step -eq 6 ]; then + echo "6 - test module (module load && matlab -batch ...)" + + module unload matlab + module load cafe-matlab/$vmatlab + if [[ "$vmatlab" =~ ^(2019a|2019b|2020a|2020b|2021a|2021b|2022a|2022b|2023a|2023b|2024a)$ ]]; then + matlab -batch "cd RHEL8-x86_64/$vmatlab;disp(mocha('version'));example" + else + matlab -nodisplay -nosplash -nodesktop -r "cd RHEL8-x86_64/$vmatlab;disp(mocha('version'));example;exit" + fi + fi +done