Skip to content
Snippets Groups Projects
Commit a4e9df15 authored by Morris Jette's avatar Morris Jette
Browse files

make task affinity testing more robust

parent 7d0a6805
No related branches found
No related tags found
No related merge requests found
......@@ -930,30 +930,53 @@ proc test_topology { } {
################################################################
#
# Proc: test_affinity
# Proc: test_cpu_affinity
#
# Purpose: Determine if system is enforcing affinity
# Purpose: Determine if system is enforcing CPU affinity
#
# Returns 1 if enforcing, 0 if none
#
################################################################
proc test_affinity { } {
proc test_cpu_affinity { } {
global scontrol alpha
log_user 0
set affinity 0
spawn $scontrol show config
expect {
-re "TaskPlugin *= task/($alpha)" {
-re "task/($alpha)" {
if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} {
set affinity 1
}
exp_continue
}
-re "TaskPlugin *= ($alpha)" {
if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} {
set affinity 1
}
eof {
wait
}
}
log_user 1
return $affinity
}
################################################################
#
# Proc: test_mem_affinity
#
# Purpose: Determine if system is enforcing memory affinity
#
# Returns 1 if enforcing, 0 if none
#
################################################################
proc test_mem_affinity { } {
global scontrol alpha
log_user 0
set affinity 0
spawn $scontrol show config
expect {
-re "task/affinity" {
set affinity 1
exp_continue
}
eof {
......
......@@ -46,10 +46,10 @@ if {[test_serial]} {
}
#
# Test if task affinity support is supported.
# Test if CPU affinity support is supported.
#
if {![test_affinity]} {
send_user "\nWARNING: task affinity not supported on this system\n"
if {![test_cpu_affinity]} {
send_user "\nWARNING: CPU affinity not supported on this system\n"
exit 0
}
send_user "\ntask affinity plugin installed\n"
......@@ -265,7 +265,9 @@ expect {
}
-re $prompt
}
if {$verbose_cnt != $task_cnt} {
# Both task/affinity and task/cpu will generate verbose message,
# so check for double messages in case both plugins are configured.
if {$verbose_cnt != $task_cnt && $verbose_cnt != [expr $task_cnt * 2]} {
send_user "\nFAILURE: verbose messages count inconsisent ($verbose_cnt != $task_cnt)\n"
set exit_code 1
}
......
......@@ -48,7 +48,7 @@ if { [test_launch_poe] } {
#
# Test if memory affinity support is supported.
#
set affinity [test_affinity]
set affinity [test_mem_affinity]
spawn ls /usr/include/numa.h
expect {
......
......@@ -50,10 +50,10 @@ if {[test_launch_poe]} {
}
#
# Test if task affinity support is supported.
# Test if CPU affinity support is supported.
#
if {![test_affinity]} {
send_user "\nWARNING: task affinity not supported on this system\n"
if {![test_cpu_affinity]} {
send_user "\nWARNING: CPU affinity not supported on this system\n"
exit 0
}
send_user "\ntask affinity plugin installed\n"
......@@ -492,8 +492,9 @@ if {$exit_code == 0} {
exec $bin_rm -f $file_prog
send_user "\nSUCCESS\n"
} else {
send_user "\nNOTE: This test can fail if the node configuration in slurm.conf \n"
send_user "\nNOTE: This test can fail if the node configuration in slurm.conf\n"
send_user " (sockets, cores, threads) differs from the actual configuration\n"
send_user " or if using task/cgroup without task/affinity.\n"
}
exit $exit_code
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment