Skip to content

Commit 7161dd5

Browse files
author
Johannes Blaschke
committed
add psc jupyter
1 parent 9b99803 commit 7161dd5

File tree

13 files changed

+2252
-13
lines changed

13 files changed

+2252
-13
lines changed

activate.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
ml use /global/common/software/nersc9/julia/modules/
1+
if [[ ${HOSTNAME} =~ ^.*bridges2.psc.edu$ ]]
2+
then
3+
echo "I'm on PSC Bridges2 => Activating pre-production modules"
4+
ml use /opt/packages/julia/modules
5+
else
6+
echo "I'm on NERSC Perlmutter => Activating pre-production modules"
7+
ml use /global/common/software/nersc9/julia/modules
8+
fi

install.sh

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,62 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22
set -eu
33

44
__INSTALL_SH_DIR=$(
55
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd
66
)
77

8-
source ${__INSTALL_SH_DIR}/activate.sh
9-
10-
mkdir -p ~/.local/share/jupyter/kernels
11-
pushd ~/.local/share/jupyter/kernels
12-
# cp -r /global/common/software/nersc9/julia/kernels/rendered/*-beta .
13-
cp -r /global/common/software/nersc/julia_hpc_24/kernels/* .
14-
popd
8+
JUPYTER_KERNEL_DIR=${__INSTALL_SH_DIR}/psc
9+
declare -a JUPYTER_KERNELS=(
10+
"julia-tutorial-single-threaded"
11+
"julia-tutorial-multi-threaded"
12+
)
13+
declare -a JUPYTER_THREADS_CT=(
14+
"1"
15+
"16"
16+
)
17+
declare -a JUPYTER_THREADS_NAME=(
18+
"Single"
19+
"Multi"
20+
)
1521

16-
julia_versions=("julia/1.8.5" "julia/1.9.4" "julia/1.10.8" "julia/1.11.3")
17-
for jv in "${julia_versions[@]}"
22+
for kernel in {0..1}
1823
do
19-
ml load $jv
20-
julia /global/common/software/nersc9/julia/kernels/bootstrap.jl
24+
kernel_dir=${HOME}/.local/share/jupyter/kernels/${JUPYTER_KERNELS[$kernel]}
25+
mkdir -p ${kernel_dir}
26+
echo "Creating Kernel at: ${kernel_dir}"
27+
28+
THREADS_NAME=${JUPYTER_THREADS_NAME[$kernel]} \
29+
${__INSTALL_SH_DIR}/lib/mo \
30+
${__INSTALL_SH_DIR}/psc/jupyter/template/kernel.json \
31+
> ${kernel_dir}/kernel.json
32+
33+
THREADS_CT=${JUPYTER_THREADS_CT[$kernel]} \
34+
NERSC_RESOURCE_DIR=${__INSTALL_SH_DIR}/psc/ \
35+
TUTORIAL_REPO_DIR=${__INSTALL_SH_DIR} \
36+
${__INSTALL_SH_DIR}/lib/mo \
37+
${__INSTALL_SH_DIR}/psc/jupyter/template/kernel-helper.sh \
38+
> ${kernel_dir}/kernel-helper.sh
39+
40+
chmod u+x ${kernel_dir}/kernel-helper.sh
41+
cp ${__INSTALL_SH_DIR}/psc/jupyter/template/logo-32x32.png ${kernel_dir}
42+
cp ${__INSTALL_SH_DIR}/psc/jupyter/template/logo-64x64.png ${kernel_dir}
2143
done
2244

45+
# echo "Generating 'activate.sh' and 'deactivate.sh' in: ${__INSTALL_SH_DIR}"
46+
#
47+
# TUTORIAL_REPO_DIR=${__INSTALL_SH_DIR} \
48+
# ${__INSTALL_SH_DIR}/lib/mo \
49+
# ${__INSTALL_SH_DIR}/psc/template/activate.sh \
50+
# > ${__INSTALL_SH_DIR}/activate.sh
51+
#
52+
# TUTORIAL_REPO_DIR=${__INSTALL_SH_DIR} \
53+
# ${__INSTALL_SH_DIR}/lib/mo \
54+
# ${__INSTALL_SH_DIR}/psc/template/deactivate.sh \
55+
# > ${__INSTALL_SH_DIR}/deactivate.sh
56+
#
57+
# echo "Instatiating Julia environment at: ${__INSTALL_SH_DIR}"
58+
#
59+
# source ${__INSTALL_SH_DIR}/activate.sh
60+
# julia -e "import Pkg; Pkg.instantiate()"
61+
62+
echo "Done"

lib/get_ext.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
__GET_EXT_SH_DIR=$(
5+
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd
6+
)
7+
8+
pushd $__GET_EXT_SH_DIR
9+
10+
# Download
11+
curl -sSL \
12+
https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
13+
14+
# Make executable
15+
chmod +x mo
16+
17+
# Test
18+
echo "works" | ./mo
19+
20+
popd

0 commit comments

Comments
 (0)