|
1 |
| -#!/usr/bin/env bash |
| 1 | +#!/usr/bin/env sh |
2 | 2 | set -eu
|
3 | 3 |
|
4 | 4 | __INSTALL_SH_DIR=$(
|
5 | 5 | cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd
|
6 | 6 | )
|
7 | 7 |
|
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 | +) |
15 | 21 |
|
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} |
18 | 23 | 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} |
21 | 43 | done
|
22 | 44 |
|
| 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" |
0 commit comments