Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JUWELS Booster Pinning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Herten
JUWELS Booster Pinning
Commits
6bf5786c
Commit
6bf5786c
authored
3 years ago
by
Andreas Herten
Browse files
Options
Downloads
Patches
Plain Diff
Add script for distributing to CPU and GPU
parent
019a2d38
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu-gpu-distrib.sh
+37
-0
37 additions, 0 deletions
cpu-gpu-distrib.sh
with
37 additions
and
0 deletions
cpu-gpu-distrib.sh
0 → 100644
+
37
−
0
View file @
6bf5786c
#!/usr/bin/env bash
# Distribute a Slurm set of tasks on a node between NUMA domains with and
# without GPU affinity, using a different executable for each.
#
# Launch with
# srun -n 8 bash cpu-gpu-distrib.sh
# or other Slurm options, like
# srun -n 8 --cpus-per-task 6 bash cpu-gpu-distrib.sh
#
# I'd imagine that further command line parameters might need to be passed;
# in that case
# srun […] bash cpu-gpu-distrib.sh --a=b --c -d conf.conf
#
# -Andreas Herten, 12 August 2021
# Define our apps for GPU and CPU; TODO!
cpu_app
=
"echo app.cpu"
gpu_app
=
"echo app.gpu"
# Define arrays with CPU and GPU NUMA domains
# These are associative arrays as Bash has built-in lookup for them
declare
-A
numa_domains_cpu
=(
[
2]
=
1
[
0]
=
1
[
4]
=
1
[
6]
=
1
)
declare
-A
numa_domains_gpu
=(
[
3]
=
1
[
1]
=
1
[
7]
=
1
[
5]
=
1
)
# Parse current NUMA domain with numactl and other things
# The final printf gets rid of any spurious newline or space
current_numa_domain
=
$(
numactl
-s
|
grep
nodebind |
sed
"s/nodebind: //"
| xargs
printf
'%i'
)
# Central branch - we do one thing for GPU and another for CPU
if
[[
-n
"
${
numa_domains_gpu
[
${
current_numa_domain
}
]
}
"
]]
;
then
# launch GPU
$gpu_app
$*
else
# launch CPU
$cpu_app
$*
fi
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment