Skip to content

Commit 3a488cb

Browse files
committed
[oar_resources_add] Remove the cpuset-prefix code, useless finally + fix man for gpudevice-prefix
1 parent 6aa251e commit 3a488cb

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

sources/core/man/man8/oar_resources_add.pod

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ Or, given the RR value, try to match a round-robin distribution of the core ids,
9090

9191
# of gpudevices on host (mainly useful for development purposes when one wants to emulate more GPUs than systems really have).
9292

93+
=item B<--gpudevice-prefix> <str>
94+
95+
Path prefix to use for the path of the device file of the GPU (e.g.: /dev/nvidia).
96+
9397
=item B<--gputopo> <list>
9498

9599
Provide the topology for the CPUs/GPUs affinity (see hwloc), given a ordered list of the Linux GPU device ids.

sources/core/tools/oar_resources_add

+7-26
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ CORES=4
66
THREADS=1
77
GPUS=
88
HOST_PREFIX="node-"
9-
CPUSET_PREFIX=
10-
NO_CPUSET_PREFIX=
119
YAML=
1210
CREATE_PROPERTIES=1
1311
USE_THREADS=
@@ -41,12 +39,10 @@ Options:
4139
--cpusets <#> # of cpusets/host (useful for fake setups only)
4240
--cputopo <list|RR> topology of the cpus: ordered list of the cpuset ids or RR for round robin
4341
--gpudevices <#> # of gpu devices/host (useful for fake setups only)
44-
--gpudevices-prefix <str> path prefix to use for the GPU device (e.g.: /dev/nvidia)
42+
--gpudevice-prefix <str> path prefix to use for the GPU device (e.g.: /dev/nvidia)
4543
--gputopo <list> topology of the gpus: ordered list of the gpudevice ids
4644
--host-prefix <str> hostname prefix (default: "node-")
4745
--host-suffix <str> hostname suffix (e.g. ".domain")
48-
--cpuset-prefix <str> use a custom cpuset resource prefix instead of node: (or pu: if threads)
49-
--no-cpuset-prefix no cpuset resource prefix, just a number
5046
-a, --auto-offset guess next host/cpu/core/thread/gpu ids
5147
-p, --no-create-properties do not generate oarproperty commands
5248
-A, --append <str> append a text string (extra properties)
@@ -71,7 +67,7 @@ debug() {
7167
[ -n "$DEBUG" ] && echo "DEBUG: $@" 1>&2
7268
}
7369

74-
LONG_OPTS="hosts:,cpus:,cores:,threads:,gpus:,host-prefix:,host-suffix:,cpuset-prefix:,gpudevice-prefix:,host0:,cpu0:,core0:,thread0:,gpu0:,cpuset:,cpusets:,cputopo:,gpudevices:,gputopo:,append:,use-threads,write-to:,auto-offset,yaml,no-create-properties,repair,no-cpuset-prefix,help,debug"
70+
LONG_OPTS="hosts:,cpus:,cores:,threads:,gpus:,host-prefix:,host-suffix:,gpudevice-prefix:,host0:,cpu0:,core0:,thread0:,gpu0:,cpuset:,cpusets:,cputopo:,gpudevices:,gputopo:,append:,use-threads,write-to:,auto-offset,yaml,no-create-properties,repair,help,debug"
7571
SHORT_OPTS="H:C:c:t:g:P:S:A:o:TRaYph"
7672
args=$(getopt -l $LONG_OPTS -o $SHORT_OPTS -q -- "$@")
7773
[ $? -gt 0 ] && die "Syntax error, $(getopt -l $LONG_OPTS -o $SHORT_OPTS -Q -- "$@" 2>&1)."
@@ -113,13 +109,6 @@ while [ $# -ge 1 ]; do
113109
HOST_SUFFIX=$2
114110
shift
115111
;;
116-
--cpuset-prefix)
117-
CPUSET_PREFIX=$2
118-
shift
119-
;;
120-
--no-cpuset-prefix)
121-
NO_CPUSET_PREFIX=1
122-
;;
123112
--gpudevice-prefix)
124113
GPUDEVICE_PREFIX=$2
125114
shift
@@ -221,14 +210,6 @@ debug "GPUS=$GPUS"
221210
CPUSETS=${CPUSETS:-$((CPUS*CORES*THREADS))}
222211
debug "CPUSETS=$CPUSETS"
223212

224-
if [ -z "$NO_CPUSET_PREFIX" -a -z "$CPUSET_PREFIX" ]; then
225-
if [ -n "$USE_THREADS" ]; then
226-
CPUSET_PREFIX="pu:"
227-
else
228-
CPUSET_PREFIX="core:"
229-
fi
230-
fi
231-
232213
declare -a CPUTOPO
233214
if [ -n "$CPUTOPO" ]; then
234215
if [ "$CPUTOPO" == "RR" ]; then
@@ -345,7 +326,7 @@ fi
345326

346327
while [ $host -le $HOSTS ]; do
347328
debug "Host loop $host <= $HOSTS"
348-
hostname="'$HOST_PREFIX$((host+HOST0-1))$HOST_SUFFIX'"
329+
hostname="$HOST_PREFIX$((host+HOST0-1))$HOST_SUFFIX"
349330
cpuset=0
350331
gpudevice=0
351332
while [ $cpu -lt $((CPUS*host)) ]; do
@@ -385,15 +366,15 @@ EOF
385366
else
386367
if [ -z "$DO_REPAIR" ]; then
387368
if [ -z "$USE_THREADS" ]; then
388-
echo "oarnodesetting -a -h $hostname -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) -p cpuset=$CPUSET_PREFIX${CPUTOPO[$cpuset]} ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
369+
echo "oarnodesetting -a -h $hostname -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) -p cpuset=${CPUTOPO[$cpuset]} ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
389370
else
390-
echo "oarnodesetting -a -h $hostname -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) -p thread=$((thread+THREAD0)) -p cpuset=$CPUSET_PREFIX${CPUTOPO[$cpuset]} ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
371+
echo "oarnodesetting -a -h $hostname -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) -p thread=$((thread+THREAD0)) -p cpuset=${CPUTOPO[$cpuset]} ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
391372
fi
392373
else
393374
if [ -z "$USE_THREADS" ]; then
394-
echo "oarnodesetting --sql \"network_address = $hostname and cpuset = $CPUSET_PREFIX${CPUTOPO[$cpuset]}\" -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
375+
echo "oarnodesetting --sql \"network_address = '$hostname' and cpuset = '${CPUTOPO[$cpuset]}'\" -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
395376
else
396-
echo "oarnodesetting --sql \"network_address = $hostname and cpuset = $CPUSET_PREFIX${CPUTOPO[$cpuset]}\" -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) -p thread=$((thread+THREAD0)) ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
377+
echo "oarnodesetting --sql \"network_address = '$hostname' and cpuset = '${CPUTOPO[$cpuset]}'\" -p host=$hostname -p cpu=$((cpu+CPU0)) -p core=$((core+CORE0)) -p thread=$((thread+THREAD0)) ${DO_GPUS:+-p gpu=$((gpu+GPU0)) -p gpudevice=$GPUDEVICE_PREFIX${GPUTOPO[$gpudevice]} }$APPEND"
397378
fi
398379
fi
399380
fi

0 commit comments

Comments
 (0)