@@ -168,6 +168,33 @@ if [ "$LAUNCHER_SCHED" == "dynamic" ]; then
168168 fi
169169fi
170170
171+ if [ $LAUNCHER_BIND -eq 1 ]
172+ then
173+ num_socks=$( lstopo-no-graphics --only socket | wc -l | awk ' {print $1}' )
174+ if [ $num_socks -eq 0 ]
175+ then
176+ num_socks=1
177+ fi
178+ num_cores=$( lstopo-no-graphics --only core | wc -l | awk ' {print $1}' )
179+ num_threads=$( lstopo-no-graphics --only pu | wc -l | awk ' {print $1}' )
180+ if [ $LAUNCHER_PPN -gt $num_cores ]
181+ then
182+ export LAUNCHER_BIND_HT=1
183+ if [ $LAUNCHER_PPN -gt $num_threads ]
184+ then
185+ echo " WARNING: Requested Processes per Node ($LAUNCHER_PPN ) exceeds number of available threads ($num_threads ). Resetting..."
186+ export LAUNCHER_PPN=$num_threads
187+ export LAUNCHER_NPROCS=$(( $LAUNCHER_NHOSTS * $LAUNCHER_PPN ))
188+ fi
189+ pu_per_task=$(( $num_threads / $LAUNCHER_PPN ))
190+ else
191+ export LAUNCHER_BIND_HT=0
192+ pu_per_task=$(( $num_cores / $LAUNCHER_PPN ))
193+ fi
194+
195+ export LAUNCHER_PUPT=$pu_per_task
196+ fi
197+
171198# ------------------------------
172199# Let's finally launch the job
173200# ------------------------------
@@ -181,13 +208,29 @@ echo " Processes per host: $LAUNCHER_PPN"
181208echo " Total processes: $LAUNCHER_NPROCS "
182209echo " Total jobs: $LAUNCHER_NJOBS "
183210echo " Scheduling method: $LAUNCHER_SCHED "
211+ if [ $LAUNCHER_BIND -eq 1 ]
212+ then
213+ echo
214+ echo " ------ Process Binding Enabled ------"
215+ echo " Sockets per host: $num_socks "
216+ echo " Cores per host: $num_cores "
217+ echo " Threads per host: $num_threads "
218+ echo -n " Binding each task to $LAUNCHER_PUPT "
219+ if [ $LAUNCHER_BIND_HT -eq 1 ]
220+ then
221+ echo " threads (Hyperthreads in use)"
222+ else
223+ echo " cores (Hyperthreads ignored)"
224+ fi
225+ fi
226+
227+
184228if [ $LAUNCHER_USE_PHI -eq 1 ]
185229then
186230 echo
187231 echo " --- Intel Xeon Phi Support Enabled ---"
188232 echo " Cards per host: $LAUNCHER_NPHI "
189233 echo " Processes per card: $LAUNCHER_PHI_PPN "
190- echo
191234fi
192235echo
193236echo " -------------------------------------"
0 commit comments