From 80844f7ad2a6f9bd1c91bf208d4a3c9faefa2ac8 Mon Sep 17 00:00:00 2001 From: Ovidiu MIRCESCU Date: Tue, 6 Jul 2021 11:12:38 +0200 Subject: [PATCH] Don't source the environment for srun containers. Salome environment is already loaded when launching srun containers. Loading it a second time creates very long PYTHONPATH & LD_LIBRARY_PATH with bad consequences for performance. --- bin/appliskel/runRemote.sh | 9 ++++++++- bin/appliskel/runRemoteSSL.sh | 8 +++++++- src/Container/SALOME_ContainerManager.cxx | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/appliskel/runRemote.sh b/bin/appliskel/runRemote.sh index a5a2db155..a2b1d91cd 100755 --- a/bin/appliskel/runRemote.sh +++ b/bin/appliskel/runRemote.sh @@ -35,11 +35,13 @@ # ssh cli76ce ${APPLI}/runRemote.sh cli76cd 2810 SALOME_Container myContainerName # --- local arguments # $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable +# --noenvd : optional argument. If present, the envd file is NOT sourced. # $1 : computer name for CORBA name service (where SALOME was launched) # $2 : port for CORBA name service # $3 : WORKINGDIR (if $3 == WORKINDIR a working dir is given in $4. If not the working dir is $HOME) # $4 : if $3 == WORKINGDIR, the path to the workingdir # $5 (or $3 if no workingdir given) and following : local command to execute, with args + # --- retrieve APPLI path, relative to $HOME, set ${APPLI} APPLI_HOME=$(dirname "$0") @@ -49,7 +51,12 @@ export APPLI=$("${APPLI_HOME}/getAppliPath.py") # Sourcing files with parameters works with bash, not with dash. This is why # we must use bash for this script. -. "${HOME}/${APPLI}/envd" "${HOME}/${APPLI}" +if [ "$1" == "--noenvd" ] +then + shift +else + . "${HOME}/${APPLI}/envd" "${HOME}/${APPLI}" +fi # --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME export NSHOST=$1 diff --git a/bin/appliskel/runRemoteSSL.sh b/bin/appliskel/runRemoteSSL.sh index ff81b9e66..374fae90b 100755 --- a/bin/appliskel/runRemoteSSL.sh +++ b/bin/appliskel/runRemoteSSL.sh @@ -32,6 +32,7 @@ # ssh cli76ce ${APPLI}/runRemoteSSL.sh IOR_OF_CURSTOM_NS SALOME_Container myContainerName # --- local arguments # $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable +# --noenvd : optional argument. If present, the envd file is NOT sourced. # $1 : IOR_OF_CURSTOM_NS of reference to Engines::EmbeddedNamingService servant # $2 : WORKINGDIR (if $2 == WORKINDIR a working dir is given in $3. If not the working dir is $HOME) # $3 : if $2 == WORKINGDIR, the path to the workingdir @@ -45,7 +46,12 @@ export APPLI=$("${APPLI_HOME}/getAppliPath.py") # Sourcing files with parameters works with bash, not with dash. This is why # we must use bash for this script. -. "${HOME}/${APPLI}/envd" "${HOME}/${APPLI}" +if "$1" == "--noenvd" +then + shift +else + . "${HOME}/${APPLI}/envd" "${HOME}/${APPLI}" +fi # --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME export CUSTOM_NS_IOR=$1 diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index ff7d9518c..6039bd28a 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -1249,6 +1249,7 @@ std::string SALOME_ContainerManager::getCommandToRunRemoteProcess(AccessProtocol const std::string & workdir) const { std::ostringstream command; + bool envd = true; // source the environment switch (protocol) { case rsh: @@ -1271,6 +1272,7 @@ std::string SALOME_ContainerManager::getCommandToRunRemoteProcess(AccessProtocol // no need to redefine the user with srun, the job user is taken by default // (note: for srun, user id can be specified with " --uid=") command << "srun -n 1 -N 1 -s --mem-per-cpu=0 --cpu-bind=none --nodelist=" << hostname << " "; + envd = false; break; case pbsdsh: command << "pbsdsh -o -h " << hostname << " "; @@ -1313,6 +1315,8 @@ std::string SALOME_ContainerManager::getCommandToRunRemoteProcess(AccessProtocol // generate a command with runRemote.sh command << remoteapplipath; command << "/" << this->GetRunRemoteExecutableScript() << " "; + if (!envd) + command << "--noenvd "; if(this->_isSSL) { -- 2.39.2