From 1aa0e77157397374670de40462cf116e49e21693 Mon Sep 17 00:00:00 2001 From: Pedro Martinez Date: Fri, 26 Feb 2021 09:10:26 +0100 Subject: [PATCH] creams: avoid race condition Ensure only one Slurm process performs environment operations --- garlic/exp/creams/gran+node1.nix | 7 +++++-- garlic/exp/creams/gran+node16.nix | 7 +++++-- garlic/exp/creams/ss+hybrid.nix | 7 +++++-- garlic/exp/creams/ss+pure.nix | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/garlic/exp/creams/gran+node1.nix b/garlic/exp/creams/gran+node1.nix index f874f36..075d631 100644 --- a/garlic/exp/creams/gran+node1.nix +++ b/garlic/exp/creams/gran+node1.nix @@ -81,8 +81,11 @@ let stages.exec { inherit nextStage; env = '' - cp -r ${input}/SodTubeBenchmark/* . - chmod +w -R . + # Only the MPI rank 0 will copy the files + if [ $SLURM_PROCID == 0 ]; then + cp -fr ${input}/SodTubeBenchmark/* . + chmod +w -R . + fi ''; }; diff --git a/garlic/exp/creams/gran+node16.nix b/garlic/exp/creams/gran+node16.nix index a0b794c..942b474 100644 --- a/garlic/exp/creams/gran+node16.nix +++ b/garlic/exp/creams/gran+node16.nix @@ -79,8 +79,11 @@ let stages.exec { inherit nextStage; env = '' - cp -r ${input}/SodTubeBenchmark/* . - chmod +w -R . + # Only the MPI rank 0 will copy the files + if [ $SLURM_PROCID == 0 ]; then + cp -fr ${input}/SodTubeBenchmark/* . + chmod +w -R . + fi ''; }; diff --git a/garlic/exp/creams/ss+hybrid.nix b/garlic/exp/creams/ss+hybrid.nix index 15fdb72..0b39d36 100644 --- a/garlic/exp/creams/ss+hybrid.nix +++ b/garlic/exp/creams/ss+hybrid.nix @@ -75,8 +75,11 @@ let stages.exec { inherit nextStage; env = '' - cp -r ${input}/SodTubeBenchmark/* . - chmod +w -R . + # Only the MPI rank 0 will copy the files + if [ $SLURM_PROCID == 0 ]; then + cp -fr ${input}/SodTubeBenchmark/* . + chmod +w -R . + fi ''; }; diff --git a/garlic/exp/creams/ss+pure.nix b/garlic/exp/creams/ss+pure.nix index 75bcf5f..244ccd2 100644 --- a/garlic/exp/creams/ss+pure.nix +++ b/garlic/exp/creams/ss+pure.nix @@ -66,8 +66,11 @@ let stages.exec { inherit nextStage; env = '' - cp -r ${input}/SodTubeBenchmark/* . - chmod +w -R . + # Only the MPI rank 0 will copy the files + if [ $SLURM_PROCID == 0 ]; then + cp -fr ${input}/SodTubeBenchmark/* . + chmod +w -R . + fi ''; };