From 43148a71f2b21b65494cbdcbd4f689daf0ecaaf4 Mon Sep 17 00:00:00 2001
From: Juan Escobar <escj@aero.obs-mip.fr>
Date: Fri, 6 Mar 2020 14:40:15 +0100
Subject: [PATCH] Juan 06/03/2020: add numabind_core_slurm , for bind on core
 with srun/slurm

---
 bin/numabind_core_slurm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100755 bin/numabind_core_slurm

diff --git a/bin/numabind_core_slurm b/bin/numabind_core_slurm
new file mode 100755
index 000000000..f78124c92
--- /dev/null
+++ b/bin/numabind_core_slurm
@@ -0,0 +1,23 @@
+#!/bin/bash
+#NB_CORE=128
+Numactl='numactl'
+export IP=${SLURM_PROCID}
+
+if [ "x${IP}" != "x" ] 
+then
+export LIP=${SLURM_LOCALID}
+export NP=${SLURM_NTASKS}
+export NN=${SLURM_NNODES}
+export NPN=$(( NP / NN ))
+export NB_CORE=${SLURM_JOB_CPUS_PER_NODE/(*)/}
+export NPC=$(( NB_CORE / NPN ))
+CORE=$(( LIP * NPC ))
+#echo IP=${IP} LIP=${LIP} NP=${NP} NN=${NN} NPN=${NPN} NPC=${NPC} HOST=`hostname` NB_CORE=${NB_CORE} CORE=${CORE} 
+#
+# execution
+#
+exec ${Numactl} --physcpubind ${CORE} $*
+else
+exec ${Numactl} --physcpubind 0 $*
+fi
+
-- 
GitLab