Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UEABS
ueabs
Commits
0bd2bc4a
Commit
0bd2bc4a
authored
Mar 18, 2019
by
Martti Louhivuori
Browse files
Add KNC affinity wrapper example
parent
84a5184b
Changes
1
Hide whitespace changes
Inline
Side-by-side
gpaw/examples/affinity_wrapper.sh
0 → 100755
View file @
0bd2bc4a
#!/bin/bash
# An affinity wrapper for KNCs.
# As arguments, it expects first the number of processes per node
# followed by the command to run (and any possible arguments to it).
# get some information about the job
ppn
=
$1
shift
rank
=
$PMI_RANK
nmpi
=
$PMI_SIZE
# echo "RANK", $PMI_RANK
# number of devices in the system
ndev
=
2
# number of cores per device
nphcores
=
61
nphcores
=
$((
nphcores
-
1
))
# number of threads per physical core
tpc
=
4
# ranks per device
rpd
=
$((
ppn
/
ndev
))
if
[
"
$rpd
"
==
"0"
]
;
then
rpd
=
1
fi
# physical cores per device
ncores
=
$((
nphcores
/
rpd
))
# partition number of the current rank on its device
partition
=
$((
rank
%
rpd
))
# offset for the current rank
offset
=
$((
ncores
*
partition
))
# build core selection string
select
=
"
${
ncores
}
c,
${
tpc
}
t,
${
offset
}
o"
# fire up the actual run
log
=
"affinity-
`
printf
%03d
$rank
`
.log"
rm
-f
$log
echo
"host
`
hostname
`
rank
`
printf
%03d
$rank
`
-
$select
"
|&
tee
-a
$log
env
|
grep
PYMIC |&
tee
-a
$log
PYMIC_KMP_AFFINITY
=
compact,verbose
PYMIC_KMP_PLACE_THREADS
=
$select
$@
|&
tee
-a
$log
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment