Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPC Episode #18

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
52b79be
future -> crew
multimeric Jun 15, 2023
a93a6f3
Fix typo
multimeric Jun 15, 2023
e3fee83
HPC draft
multimeric Jun 30, 2023
3af1a0d
Start worker section
multimeric Jun 30, 2023
f8928bc
Finished draft of heterogenous workers
multimeric Jul 7, 2023
0f8e054
Update dependencies to have crew, finish first draft of HPC
multimeric Jul 10, 2023
5255346
Update knit_exit comment
multimeric Jul 10, 2023
f246ac1
Merge branch 'main' of github.com:carpentries-incubator/targets-works…
multimeric Jul 10, 2023
9c054c4
Better wording when discussing HPC
multimeric Jul 10, 2023
46fc239
Don't assume learner expectations
multimeric Jul 10, 2023
589075b
Update episodes/hpc.Rmd
multimeric Jul 10, 2023
629c7aa
Update episodes/hpc.Rmd
multimeric Jul 10, 2023
5a67422
Update episodes/hpc.Rmd
multimeric Jul 10, 2023
180f290
Update episodes/hpc.Rmd
multimeric Jul 11, 2023
31353d6
Code review, and update dependencies
multimeric Jul 12, 2023
5cbd438
Merge branch 'hpc' of github.com:multimeric/targets-workshop into hpc
multimeric Jul 12, 2023
a482945
Minor improvements and rewording
multimeric Jul 12, 2023
540385e
Install crew.cluster
multimeric Jul 20, 2023
704759d
Elaborate on `sacct`
multimeric Jul 20, 2023
414a742
Tweaks to the HPC episode
multimeric Jul 24, 2023
4092364
Use crew_controller_group, and add memory example
multimeric Jul 25, 2023
06b2cb9
Update episodes/hpc.Rmd
multimeric Jul 25, 2023
141e774
Update episodes/hpc.Rmd
multimeric Jul 25, 2023
4622cbb
Merge branch 'main' of github.com:carpentries-incubator/targets-works…
multimeric Jul 9, 2024
9bf64e5
Merge branch 'hpc' of github.com:multimeric/targets-workshop into hpc
multimeric Jul 9, 2024
a9c04a5
Remove some superfluous files
multimeric Jul 9, 2024
3dd8238
Remove unused figures
multimeric Jul 9, 2024
6cc5c25
I guess these files should be tracked?
multimeric Jul 9, 2024
4723369
Add missing activate file
multimeric Jul 10, 2024
d872dfb
Add missing .gitignore
multimeric Jul 10, 2024
24aa767
Fix execution typo
multimeric Jul 10, 2024
5e40be1
Start slurm for build
multimeric Jul 10, 2024
4eb5f06
Force dep on {htmlwidgets}
joelnitta Jul 10, 2024
9489bea
Update renv and packages
joelnitta Jul 10, 2024
e012aaf
Update renv.lock
joelnitta Jul 10, 2024
7548c49
Reduce memory requirement
multimeric Jul 10, 2024
66c3e5b
Merge branch 'hpc' of github.com:multimeric/targets-workshop into hpc
multimeric Jul 10, 2024
2c9a19a
Re-run CI
multimeric Dec 13, 2024
905a3b7
Merge branch 'main' of github.com:carpentries-incubator/targets-works…
multimeric Dec 13, 2024
0ca5b00
Revert .github and renv changes
multimeric Dec 13, 2024
54e1b53
Merge branch 'main' of github.com:carpentries-incubator/targets-works…
multimeric Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions FIXME.Rproj

This file was deleted.

1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ episodes:
- branch.Rmd
- parallel.Rmd
- quarto.Rmd
- hpc.Rmd

# Information for Learners
learners:
Expand Down
49 changes: 49 additions & 0 deletions episodes/files/plans/plan_slurm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
library(crew.cluster)
library(targets)
library(tarchetypes)
library(palmerpenguins)
library(broom)
suppressPackageStartupMessages(library(tidyverse))

source("R/packages.R")
source("R/functions.R")

tar_option_set(
controller = crew_controller_slurm(
workers = 3,
script_lines = "module load R",
slurm_memory_gigabytes_per_cpu = 1
)
)

tar_plan(
# Load raw data
tar_file_read(
penguins_data_raw,
path_to_file("penguins_raw.csv"),
read_csv(!!.x, show_col_types = FALSE)
),
# Clean data
penguins_data = clean_penguin_data(penguins_data_raw),
# Build models
models = list(
combined_model = lm(
bill_depth_mm ~ bill_length_mm, data = penguins_data),
species_model = lm(
bill_depth_mm ~ bill_length_mm + species, data = penguins_data),
interaction_model = lm(
bill_depth_mm ~ bill_length_mm * species, data = penguins_data)
),
# Get model summaries
tar_target(
model_summaries,
glance_with_mod_name_slow(models),
pattern = map(models)
),
# Get model predictions
tar_target(
model_predictions,
augment_with_mod_name_slow(models),
pattern = map(models)
)
)
52 changes: 52 additions & 0 deletions episodes/files/plans/plan_slurm_gpu.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
graphics_devices <- function(){
system2("lshw", c("-class", "display"), stdout=TRUE, stderr=FALSE)
}

library(crew)
library(targets)
library(tarchetypes)
library(crew.cluster)

source("R/packages.R")
source("R/functions.R")

tar_option_set(
controller = crew_controller_group(
crew_controller_slurm(
name = "cpu_worker",
workers = 1,
script_lines = "module load R",
slurm_memory_gigabytes_per_cpu = 1,
slurm_cpus_per_task = 1
),

crew_controller_slurm(
name = "gpu_worker",
workers = 1,
script_lines = c(
"#SBATCH --partition=gpuq",
"#SBATCH --gres=gpu:1",
"module load R"
),
slurm_memory_gigabytes_per_cpu = 1,
slurm_cpus_per_task = 1
)
)
)

tar_plan(
tar_target(
cpu_hardware,
graphics_devices(),
resources = tar_resources(
crew = tar_resources_crew(controller = "cpu_worker")
)
),
tar_target(
gpu_hardware,
graphics_devices(),
resources = tar_resources(
crew = tar_resources_crew(controller = "gpu_worker")
)
)
)
39 changes: 39 additions & 0 deletions episodes/files/plans/plan_slurm_memory.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
library(crew)
library(targets)
library(tarchetypes)
library(crew.cluster)

source("R/packages.R")
source("R/functions.R")

small_memory <- crew_controller_slurm(
name = "small_memory",
script_lines = "module load R",
slurm_memory_gigabytes_per_cpu = 10
)
big_memory <- crew_controller_slurm(
name = "big_memory",
script_lines = "module load R",
slurm_memory_gigabytes_per_cpu = 20
)

tar_option_set(
controller = crew_controller_group(small_memory, big_memory)
)

list(
tar_target(
name = big_memory_task,
command = Sys.getenv("SLURM_MEM_PER_CPU"),
resources = tar_resources(
crew = tar_resources_crew(controller = "big_memory")
)
),
tar_target(
name = small_memory_task,
command = Sys.getenv("SLURM_MEM_PER_CPU"),
resources = tar_resources(
crew = tar_resources_crew(controller = "small_memory")
)
)
)
Loading
Loading