Skip to content

Commit

Permalink
Merge pull request #189 from vincentcasseau/main
Browse files Browse the repository at this point in the history
Envs: install prod visung
  • Loading branch information
benoit128 authored Sep 19, 2024
2 parents a73df77 + 4e6cea5 commit 678d356
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 95 deletions.
36 changes: 18 additions & 18 deletions Cassiopee/Envs/sh_Cassiopee_local
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if echo "$KC" | grep -q 'ubuntu'; then export MAC="ubuntu"; fi
if echo "$KC" | grep -q 'visio'; then export MAC="visio"; fi
if echo "$KC" | grep -q 'austri'; then export MAC="austri"; fi
if echo "$KC" | grep -q 'celeste'; then export MAC="visio"; fi
if echo "$KC" | grep -q 'visung'; then export MAC="juno"; fi
if echo "$KC" | grep -q 'visung'; then export MAC="visung"; fi
if echo "$KC" | grep -q 'giulia'; then export MAC="giulia"; fi
if echo "$KC" | grep -q 'sator'; then export MAC="sator_cas"; fi
if echo "$KC" | grep -q 'jean-zay'; then export MAC="jean-zay"; fi
Expand Down Expand Up @@ -198,38 +198,38 @@ elif [ "$MAC" = "spiro_gcc" ]; then
export OMP_PLACES=cores
unset $(env | grep SLURM | cut -d'=' -f 1)

elif [ "$MAC" = "visung" ]; then
#----------------------------- visung -----------------------------------------
export ELSAPROD=visung_r8
elif [ "$MAC" = "visung_gcc" ]; then
#----------------------------- visung_gcc -------------------------------------
export ELSAPROD=visung_gcc
export ELSAPROD=$ELSAPROD$EXT
# Nbre de threads
export OMP_NUM_THREADS=72
. /etc/profile.d/modules-onera.sh
module purge
module load subversion
module load occt/7.6.1-gnu831
module load python/3.8.14-gnu831
#module load intel/21.2.0
module load gcc/10.2.0
module load hdf5/1.10.5-gnu831-ompi405
module load lapack/3.9.1-gnu831
export PRODMODE=1
module load occt/7.6.1-gnu831
module load socle-cfd/7.0-gnu850-ompi502
module load subversion/1.14.1-gnu831
module load emacs/27.2-gnu831
export PYTHONEXE=python3
export OMP_NUM_THREADS=72
#export PRODMODE=1

elif [ "$MAC" = "visung_el8" ]; then
elif [ "$MAC" = "visung" ]; then
#----------------------------- visung -----------------------------------------
export ELSAPROD=visung_el8
export ELSAPROD=visung
export ELSAPROD=$ELSAPROD$EXT
#. /etc/profile.d/modules-dri.sh
module purge
module load subversion
module load python/3.7.4-intel2120
module load intel/21.2.0
module load hdf5/1.10.5-intel2120-impi
module load occt/7.6.1-gnu831
module load emacs/27.2-gnu831
module load subversion/1.14.1-gnu831
module load socle-cfd/6.0-intel2220-impi
export PYTHONEXE=python3
export OMP_NUM_THREADS=72
#export PRODMODE=1
unset I_MPI_FABRICS_LIST
unset I_MPI_FABRICS
unset I_MPI_TCP_NETMASK
unset I_MPI_PMI_LIBRARY

elif [ "$MAC" = "austri" ]; then
Expand Down
223 changes: 146 additions & 77 deletions tools/moveDist
Original file line number Diff line number Diff line change
@@ -1,92 +1,161 @@
#! /bin/sh
# moveDist <dir>
# moveDist <module> <dir>
# recopie le module dans un nouveau directory d'installation
# ex: moveDist Transform /home/benoit/Cassiopee/Dist/bin/x86_r8
# Copy a CASSIOPEE distribution into a destination path with a new prod. name

# Print help message
usage() {
echo "moveDist --destination=<destination_path> # Copy all modules of a CASSIOPEE distribution into a destination path with the same prod. name"
echo "moveDist --destination=<destination_path> --new-prod-name=<new_prod> # Copy all modules of a CASSIOPEE distribution into a destination path with a new prod. name"
echo "moveDist --destination=<destination_path> --module=<module> # Copy a single module of a CASSIOPEE distribution into a destination path with the same prod. name"
exit 1
}

# Parse command-line arguments
DEST_PROD_PATH=""
NEW_ELSAPROD=""
while [[ "$1" != "" ]]; do
case "$1" in
--destination=*)
DEST_PROD_PATH="${1#*=}"
;;
-d)
shift
DEST_PROD_PATH="${1#*=}"
;;
--module=*)
MODULE="${1#*=}"
;;
-m)
shift
MODULE="${1#*=}"
;;
--new-prod-name=*)
NEW_ELSAPROD="${1#*=}"
;;
--help | -h)
usage
;;
*)
echo "Invalid argument: $1"
usage
;;
esac
shift
done

# Sanitise arguments
if [ -z $MODULE ]; then
MODULE="all"
fi

if [ -z $NEW_ELSAPROD ]; then
NEW_ELSAPROD=$ELSAPROD
fi

if [ -z $DEST_PROD_PATH ]; then
echo ">>> Please set a destination path using --destination=<destination_path>"
usage
exit 1
fi

if [ "$CASSIOPEE" = "" ]; then
echo "You must specify a CASSIOPEE variable in your environment."
echo "This variable specifies the installation path of *Cassiopee*."
exit
echo "You must set a CASSIOPEE variable in your environment."
echo "This variable specifies the installation path of *Cassiopee*."
exit 1
fi
if [ "$ELSAPROD" = "" ]; then
echo "You must specify a ELSAPROD in your environment."
echo "This variable identifies the processor type."
exit
echo "You must set a ELSAPROD in your environment."
echo "This variable identifies the processor type."
exit 1
fi

# Setting vars
CWD=$(pwd)
CASSIOPEE=${CASSIOPEE%/}
mkdir -p $DEST_PROD_PATH
DEST_CAS_PATH=$(dirname $(dirname $(dirname $DEST_PROD_PATH)))

if [ "$PYTHONEXE" = "python3" ]; then
pyversion="python"`python3 -c "import sys; print('.'.join(str(n) for n in sys.version_info[:2]))"`
alias python=python3
pyversion="python"`python3 -c "import sys; print('.'.join(str(n) for n in sys.version_info[:2]))"`
alias python=python3
else
pyversion="python"`python -c "import sys; print('.'.join(str(n) for n in sys.version_info[:2]))"`
pyversion="python"`python -c "import sys; print('.'.join(str(n) for n in sys.version_info[:2]))"`
fi
pylib="lib"
case $ELSAPROD in
ubuntu*)
pylib="local/"$pylib
pysite="dist-packages"
;;
*)
pysite="site-packages"
;;
esac
pylvs="$pylib/$pyversion/$pysite"

if ([ $# -eq 0 ]); then
echo "moveDist <dir>"
echo "moveDist /tmp/Cassiopee/Dist/bin/x86_r8"
echo "Recopie le Dist dans <dir>"
echo "moveDist <module> <dir>"
echo "ex: moveDist Transform /tmp/Cassiopee/Dist/bin/x86_r8"
echo "Recopie le Dist du module dans <dir>/lib/$pyversion/site-packages"
fi
new_pylib="lib"
case $NEW_ELSAPROD in
ubuntu*)
new_pylib="local/"$new_pylib
pysite="dist-packages"
;;
*)
pysite="site-packages"
;;
esac
new_pylvs="$new_pylib/$pyversion/$pysite"

# push module a la position dir
if [ $# -eq 2 ]; then
module=$1
path=$2
mkdir -p $path

here=`pwd`
cd "$CASSIOPEE/Dist/bin/$ELSAPROD/lib/$pyversion/site-packages"
tar cvf $module.tar $module
mv $module.tar $path
cd $path
mkdir -p lib/$pyversion/site-packages
if [ -L lib64 ]; then
rm lib64
ln -s lib lib64
else
ln -s lib lib64
fi
mv $module.tar lib/$pyversion/site-packages
cd lib/$pyversion/site-packages
tar xvf $module.tar
rm $module.tar
cd $here
fi

# push all modules a la position dir
if [ $# -eq 1 ]; then
path=$1
mkdir -p $path
here=`pwd`
cd "$CASSIOPEE/Dist/bin/$ELSAPROD"
tar cvf all.tar .
mv all.tar $path
cd $path
tar xvf all.tar
rm all.tar
if [ -L lib64 ]; then
rm lib64
ln -s lib lib64
else
ln -s lib lib64
fi
# Change installPath
cd lib/$pyversion/site-packages
cd KCore
cp "$CASSIOPEE/Dist/bin/$ELSAPROD/lib/$pyversion/site-packages/KCore/installPath.py" .

cp installPath.py installPath_old.py
dirname=$(dirname $(dirname $(dirname $path)))
s1=$(sed 's/[\/&]/\\&/g' <<< $CASSIOPEE)
s2=$(sed 's/[\/&]/\\&/g' <<< $dirname)
# Remplace $CASSIOPEE par $dirname
if [ $MODULE = "all" ]; then
# Copy all modules to their destination
cd "$CASSIOPEE/Dist/bin/$ELSAPROD"
tar cvf all.tar .
mv all.tar $DEST_PROD_PATH
cd $DEST_PROD_PATH
tar xvf all.tar
rm all.tar
if [ -L lib64 ]; then
rm lib64
ln -s lib lib64
else
ln -s lib lib64
fi

# Edit installPath (replace $CASSIOPEE by $DEST_CAS_PATH and edit prod. name)
cd "$pylvs/KCore"
cp "$CASSIOPEE/Dist/bin/$ELSAPROD/$pylvs/KCore/installPath.py" .
s1=$(sed 's/[\/&]/\\&/g' <<< "$CASSIOPEE")
s2=$(sed 's/[\/&]/\\&/g' <<< "$DEST_CAS_PATH")
sed -i "s/$s1/$s2/g" installPath.py
if [ "$ELSAPROD" != "$NEW_ELSAPROD" ]; then
s1=$(sed 's/[\/&]/\\&/g' <<< "$ELSAPROD/$pylvs")
s2=$(sed 's/[\/&]/\\&/g' <<< "$NEW_ELSAPROD/$new_pylvs")
sed -i "s/$s1/$s2/g" installPath.py
more installPath.py
cd $here
# Copie les fichiers d'environnement
cp "$CASSIOPEE"/Dist/env_* $path/../..
cp "$CASSIOPEE"/Dist/sh_* $path/../..
s1=$(sed 's/[\/&]/\\&/g' <<< "$ELSAPROD/$pylib")
s2=$(sed 's/[\/&]/\\&/g' <<< "$NEW_ELSAPROD/$new_pylib")
sed -i "s/$s1/$s2/g" installPath.py
fi
more installPath.py

# Copy environment files
cp "$CASSIOPEE"/Dist/env_* "$DEST_PROD_PATH"/../..
cp "$CASSIOPEE"/Dist/sh_* "$DEST_PROD_PATH"/../..
cd $CWD
else
# Copy a single module to its destination
cd "$CASSIOPEE/Dist/bin/$ELSAPROD/$pylvs"
tar cvf $MODULE.tar $MODULE
mv $MODULE.tar $DEST_PROD_PATH
cd $DEST_PROD_PATH
mkdir -p $pylvs
if [ -L lib64 ]; then
rm lib64
ln -s lib lib64
else
ln -s lib lib64
fi
mv $MODULE.tar $pylvs
cd $pylvs
tar xvf $MODULE.tar
rm $MODULE.tar
cd $CWD
fi

0 comments on commit 678d356

Please sign in to comment.