From 6abcf0b2aa5aa97b3b88de2e07d0dcca2bddd3b1 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil <miroslav.kratochvil@uni.lu> Date: Tue, 7 Jun 2022 15:54:09 +0200 Subject: [PATCH] updates --- .../slides/bootstrap.md | 12 ------ .../slides/distributed.md | 37 ++++++++++++++++++- .../slides/language.md | 20 ++++++++++ .../slides/overview.md | 4 +- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/2022/2022-06-08_JuliaForNewcomers/slides/bootstrap.md b/2022/2022-06-08_JuliaForNewcomers/slides/bootstrap.md index 0e59d80b..a2f774b8 100644 --- a/2022/2022-06-08_JuliaForNewcomers/slides/bootstrap.md +++ b/2022/2022-06-08_JuliaForNewcomers/slides/bootstrap.md @@ -139,15 +139,3 @@ $ julia --project=path/to/project script.jl ``` (Project data is stored in `Project.toml`, `Manifest.toml`.) - - - - -<div class=leader> -☕🧋🧃<br> -PAUSE -</div> - -Let's have *10 minutes* for a coffee or something. - -(Questions?) diff --git a/2022/2022-06-08_JuliaForNewcomers/slides/distributed.md b/2022/2022-06-08_JuliaForNewcomers/slides/distributed.md index 28081c21..919d3afd 100644 --- a/2022/2022-06-08_JuliaForNewcomers/slides/distributed.md +++ b/2022/2022-06-08_JuliaForNewcomers/slides/distributed.md @@ -81,6 +81,11 @@ datafiles = ["file$i.csv" for i=1:20] # ... do something ... end +pmap(process_file, datafiles) +``` + +💡💡 Doing it manually: +```julia @sync for f in datafiles @async @spawnat :any process_file(f) end @@ -145,7 +150,7 @@ Utilizing ULHPC 💡 -# What does ULHPC look like? +# What does the cluster look like? (Iris) <center> <img src="slides/img/iris.png" width="30%"> @@ -155,6 +160,34 @@ Utilizing ULHPC 💡 +# Running Julia on the computing nodes + +Start an allocation and connect to it: +```sh +0 [mkratochvil@access1 ~]$ srun -p interactive -t 30 --pty bash -i +``` + +(You can also use `si`.) + +After some brief time, you should get a shell on a compute node. There you can install and start Julia as usual: + +``` +0 [mkratochvil@iris-131 ~](2696005 1N/T/1CN)$ module add lang/Julia +0 [mkratochvil@iris-131 ~](2696005 1N/T/1CN)$ julia + _ + _ _ _(_)_ | Documentation: https://docs.julialang.org + (_) | (_) (_) | + _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. + | | | | | | |/ _` | | + | | |_| | | | (_| | | Version 1.6.2 (2021-07-14) + _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release +|__/ | + +julia> +``` + + + # Making a HPC-compatible Julia script Main challenges: @@ -171,7 +204,7 @@ addprocs_slurm(parse(Int, ENV["SLURM_NTASKS"])) -# Scheduling the script +# Scheduling an analysis script Normally, you write a "batch script" and add it to a queue using `sbatch`. diff --git a/2022/2022-06-08_JuliaForNewcomers/slides/language.md b/2022/2022-06-08_JuliaForNewcomers/slides/language.md index 6c7777fe..7639902f 100644 --- a/2022/2022-06-08_JuliaForNewcomers/slides/language.md +++ b/2022/2022-06-08_JuliaForNewcomers/slides/language.md @@ -181,6 +181,24 @@ Example: +<div class=leader> +☕🧋🧃<br> +PAUSE +</div> + +Let's have *10 minutes* for a coffee or something. + +(Questions?) + + + +<div class=leader> +🔵 🔴 🟢 🟣<br> +Julia language primer (part 2) +</div> + + + # 💡 Structured cycles! Using functional-style loops is *much less error-prone* to indexing @@ -201,6 +219,8 @@ reduce((a,b) -> "$b $a", ["Use", "the Force", "Luke"]) reduce(*, [1 2 3; 4 5 6], dims=1) ``` +**Tricky question (💡💡💡):** What is the overhead of the "nice" loops? + # Making new arrays with loops diff --git a/2022/2022-06-08_JuliaForNewcomers/slides/overview.md b/2022/2022-06-08_JuliaForNewcomers/slides/overview.md index 048431c6..c5394bd1 100644 --- a/2022/2022-06-08_JuliaForNewcomers/slides/overview.md +++ b/2022/2022-06-08_JuliaForNewcomers/slides/overview.md @@ -1,8 +1,8 @@ # Overview today 0. Why would you learn another programming language again? -1. Bootstrapping, working with packages, writing a script (45m), pause (10m) -2. Language and syntax primer (20m) +1. Bootstrapping, working with packages, writing a script (30m) +2. Language and syntax primer (35m) with a pause (10m) in the middle 3. Getting the data in and out (15m) 4. Running programs on ULHPC (15m) 5. Questions, hands-on, time buffer (15m) -- GitLab