Skip to content

Commit

Permalink
scripts: update tutorial scripts to work outside of a container (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgamblin committed Nov 9, 2020
1 parent a4146c3 commit c61b605
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
10 changes: 9 additions & 1 deletion outputs/defs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash

raw_outputs=/project/raw
# if in a container, put stuff in the bindmounted
# /project directory (see Makefile). Otherwise use ${PWD}
if [ -d /project ]; then
PROJECT=/project
else
PROJECT="${PWD}"
fi

raw_outputs="${PROJECT}/raw"

example() {
if [[ "$1" == "-tee" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions outputs/modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module load netlib-lapack openblas
example -tee modules/lmod-intro-conflict "module list"


cp /project/module-configs/lmod.1.yaml ~/.spack/modules.yaml
cp ${PROJECT}/module-configs/lmod.1.yaml ~/.spack/modules.yaml
example modules/lmod-refresh-1 "spack module lmod refresh --delete-tree -y"
module purge
module unuse $HOME/spack/share/spack/modules/linux-ubuntu18.04-x86_64
Expand Down Expand Up @@ -138,7 +138,7 @@ module load netlib-scalapack/2.1.0-netlib-lapack
example -tee modules/lapack-conflict "module list"


cp /project/module-configs/lmod.2.yaml ~/.spack/modules.yaml
cp ${PROJECT}/module-configs/lmod.2.yaml ~/.spack/modules.yaml
example -tee modules/lmod-refresh-2 "module purge"
example -tee modules/lmod-refresh-2 "spack module lmod refresh --delete-tree -y"

Expand Down
8 changes: 4 additions & 4 deletions outputs/packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ example packaging/create "spack create https://github.com/LLNL/mpileaks/rele

example packaging/install-mpileaks-1 "spack install mpileaks"

cp /project/package-py-files/1.package.py $mpileaks_package_py
cp ${PROJECT}/package-py-files/1.package.py $mpileaks_package_py
example packaging/info-mpileaks "spack info mpileaks"

spack uninstall -ay mpileaks
cp /project/package-py-files/2.package.py $mpileaks_package_py
cp ${PROJECT}/package-py-files/2.package.py $mpileaks_package_py
example packaging/install-mpileaks-2 "spack install mpileaks"

stage_dir=$(spack location -s mpileaks)
Expand All @@ -31,10 +31,10 @@ example packaging/build-output "cat $stage_dir/spack-build-out.txt"
#spack cd mpileaks
#echo "configure --prefix=$prefix" | example packaging/build-env-configure "spack build-env mpileaks bash"

cp /project/package-py-files/3.package.py $mpileaks_package_py
cp ${PROJECT}/package-py-files/3.package.py $mpileaks_package_py
example packaging/install-mpileaks-3 "spack install mpileaks"

cp /project/package-py-files/4.package.py $mpileaks_package_py
cp ${PROJECT}/package-py-files/4.package.py $mpileaks_package_py
example packaging/install-mpileaks-4 "spack install --verbose mpileaks stackstart=4"

example packaging/cleanup "spack uninstall -ay mpileaks"
Expand Down
6 changes: 3 additions & 3 deletions outputs/scripting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "exit()

fake_example scripting/edit '$EDITOR find_exclude.py' "/bin/true"

cat <<EOF | tee /project/raw/0.find_exclude.py.example find_exclude.py
cat <<EOF | tee ${PROJECT}/raw/0.find_exclude.py.example find_exclude.py
from spack.spec import Spec
import spack.store
import spack.cmd
Expand All @@ -41,11 +41,11 @@ EOF

example scripting/find-exclude-1 "spack python find_exclude.py %gcc ^mpich"

{ echo "#!/usr/bin/env spack python" & cat find_exclude.py; } | tee /project/raw/1.find_exclude.py.example find_exclude.py
{ echo "#!/usr/bin/env spack python" & cat find_exclude.py; } | tee ${PROJECT}/raw/1.find_exclude.py.example find_exclude.py

example scripting/find-exclude-2 "chmod u+x find_exclude.py"
example scripting/find-exclude-2 "./find_exclude.py %gcc ^mpich"

sed s'|spack python|spack-python|' find_exclude.py | tee /project/raw/2.find_exclude.py.example find_exclude.py
sed s'|spack python|spack-python|' find_exclude.py | tee ${PROJECT}/raw/2.find_exclude.py.example find_exclude.py

example scripting/find-exclude-3 "./find_exclude.py %gcc ^mpich"

0 comments on commit c61b605

Please sign in to comment.