Skip to content

Commit 1de58bd

Browse files
authored
[gpurun] add numactl check and fallback for -nm and -nr (#625)
1 parent 94a627f commit 1de58bd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

offload/utils/gpurun/gpurun

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,26 @@ if [ -z "$_num_local_ranks" ] && [ ! -z $SLURM_CPUS_ON_NODE ] ; then
203203
_num_local_ranks=$SLURM_CPUS_ON_NODE
204204
_local_rank_num=$SLURM_LOCALID
205205
fi
206+
206207
if [ "$_use_numactl_rocr" == "1" ] ; then
207-
numactl --cpunodebind $ROCR_VISIBLE_DEVICES --membind $ROCR_VISIBLE_DEVICES $*
208-
exit $?
208+
_cmd_binary=`which numactl`
209+
if [ $? == 0 ] ; then
210+
numactl --cpunodebind $ROCR_VISIBLE_DEVICES --membind $ROCR_VISIBLE_DEVICES $*
211+
exit $?
212+
else
213+
$*
214+
exit $?
215+
fi
209216
fi
210217
if [ "$_use_numactl_ompi" == "1" ] ; then
211-
numactl --cpunodebind $OMPI_COMM_WORLD_LOCAL_RANK --membind $OMPI_COMM_WORLD_LOCAL_RANK $*
212-
exit $?
218+
_cmd_binary=`which numactl`
219+
if [ $? == 0 ] ; then
220+
numactl --cpunodebind $OMPI_COMM_WORLD_LOCAL_RANK --membind $OMPI_COMM_WORLD_LOCAL_RANK $*
221+
exit $?
222+
else
223+
$*
224+
exit $?
225+
fi
213226
fi
214227
# If none of the above MPIs, assume gpurun is wrapper for single process on single GPU
215228
if [ -z "$_num_local_ranks" ] ; then

0 commit comments

Comments
 (0)