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

Affinity tests to support larger systems

Change the integer to hex function to support 32-bit unsigned
integers and exit on systems with more than 32 cpus per node
since Expect can not work with numbers so large.
parent 91e8fc8d
No related branches found
No related tags found
No related merge requests found
...@@ -1761,11 +1761,11 @@ proc test_super_user { } { ...@@ -1761,11 +1761,11 @@ proc test_super_user { } {
################################################################ ################################################################
# #
# Proc: dec2hex16 # Proc: dec2hex
# #
# Purpose: Create a 16 bit hex number from a signed decimal number # Purpose: Create a 32 bit hex number from a signed decimal number
# #
# Returns: 16 bit hex version of input 'value' # Returns: 32 bit hex version of input 'value'
# #
# Input: value -- decimal number to convert # Input: value -- decimal number to convert
# #
...@@ -1773,43 +1773,42 @@ proc test_super_user { } { ...@@ -1773,43 +1773,42 @@ proc test_super_user { } {
# http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/415982 # http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/415982
################################################################ ################################################################
# Replace all non-decimal characters # Replace all non-decimal characters
proc dec2hex16 {value} { proc dec2hex {value} {
regsub -all {[^0-x\.-]} $value {} newtemp regsub -all {[^0-x\.-]} $value {} newtemp
set value [string trim $newtemp] set value [string trim $newtemp]
if {$value < 32767 && $value > -32768} { if {$value < 2147483647 && $value > -2147483648} {
set tempvalue [format "%#010X" [expr $value]] set tempvalue [format "%#010X" [expr $value]]
return [string range $tempvalue 6 9] return [string range $tempvalue 2 9]
} elseif {$value < 32768} { } elseif {$value < -2147483647} {
return "8000" return "80000000"
} else { } else {
return "7FFF" return "7FFFFFFF"
} }
} }
################################################################ ################################################################
# #
# Proc: dec2hex32 # Proc: uint2hex
# #
# Purpose: Create a 32 bit hex number from a signed decimal number # Purpose: Create a 32 bit hex number from an unsigned decimal
# number.
# #
# Returns: 32 bit hex version of input 'value' # Returns: 32 bit hex version of input 'value'
# #
# Input: value -- decimal number to convert # Input: value -- unsigneddecimal number to convert
# #
# Courtesy of Chris Cornish # Courtesy of Chris Cornish
# http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/415982 # http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/415982
################################################################ ################################################################
# Replace all non-decimal characters # Replace all non-decimal characters
proc dec2hex {value} { proc uint2hex {value} {
regsub -all {[^0-x\.-]} $value {} newtemp regsub -all {[^0-x\.-]} $value {} newtemp
set value [string trim $newtemp] set value [string trim $newtemp]
if {$value < 2147483647 && $value > -2147483648} { if {$value <= 4294967295 && $value >= 0} {
set tempvalue [format "%#010X" [expr $value]] set tempvalue [format "%#010X" [expr $value]]
return [string range $tempvalue 2 9] return [string range $tempvalue 2 9]
} elseif {$value < -2147483647} {
return "80000000"
} else { } else {
return "7FFFFFFF" return "FFFFFFFF"
} }
} }
......
...@@ -149,6 +149,31 @@ expect { ...@@ -149,6 +149,31 @@ expect {
} }
} }
if {$task_cnt > 32} {
send "exit\r"
expect {
-re "error" {
send_user "\nFAILURE: some error occurred\n"
set exit_code 1
}
timeout {
send_user "\nFAILURE: salloc not responding "
send_user "or failure to recognize prompt\n"
slow_kill $salloc_pid
set exit_code 1
}
eof {
wait
}
}
if {$exit_code == 0} {
exec $bin_rm -f $file_prog
send_user "\nWARNING: Expect unable to work with more than 32-bit numbers\n"
}
exit $exit_code
}
# #
# Run a job step with affinity # Run a job step with affinity
# #
...@@ -285,7 +310,7 @@ set cpu_cnt 0 ...@@ -285,7 +310,7 @@ set cpu_cnt 0
while {$cpu_cnt < $task_cnt} { while {$cpu_cnt < $task_cnt} {
set mask_sum 0 set mask_sum 0
set mask [ expr 1 << $cpu_cnt ] set mask [ expr 1 << $cpu_cnt ]
set mstr [ dec2hex $mask] set mstr [ uint2hex $mask ]
send "$srun -c1 --cpu_bind=mask_cpu:$mstr ./$file_prog\r" send "$srun -c1 --cpu_bind=mask_cpu:$mstr ./$file_prog\r"
expect { expect {
-re "TASK_ID:($number),MASK:($number)" { -re "TASK_ID:($number),MASK:($number)" {
...@@ -326,7 +351,7 @@ set full_mask [ expr (1 << $task_cnt) - 1 ] ...@@ -326,7 +351,7 @@ set full_mask [ expr (1 << $task_cnt) - 1 ]
while {$cpu_cnt < $task_cnt} { while {$cpu_cnt < $task_cnt} {
set mask_sum 0 set mask_sum 0
set mask [ expr 1 << $cpu_cnt ] set mask [ expr 1 << $cpu_cnt ]
set mstr [ dec2hex $mask] set mstr [ uint2hex $mask ]
set fwd_mask "$fwd_mask,$mstr" set fwd_mask "$fwd_mask,$mstr"
set fwd_map "$fwd_map,$cpu_cnt" set fwd_map "$fwd_map,$cpu_cnt"
set rev_mask "$mstr,$rev_mask" set rev_mask "$mstr,$rev_mask"
...@@ -555,4 +580,3 @@ if {$exit_code == 0} { ...@@ -555,4 +580,3 @@ if {$exit_code == 0} {
send_user " or if Shared=FORCE for the default partition.\n" send_user " or if Shared=FORCE for the default partition.\n"
} }
exit $exit_code exit $exit_code
...@@ -336,7 +336,7 @@ set cpu_cnt 0 ...@@ -336,7 +336,7 @@ set cpu_cnt 0
while {$cpu_cnt < $task_cnt} { while {$cpu_cnt < $task_cnt} {
set mask_sum 0 set mask_sum 0
set mask [ expr 1 << $cpu_cnt ] set mask [ expr 1 << $cpu_cnt ]
set mstr [ dec2hex $mask] set mstr [ uint2hex $mask ]
send "$srun -n $task_cnt --mem_bind=mask_mem:$mstr ./$file_prog\r" send "$srun -n $task_cnt --mem_bind=mask_mem:$mstr ./$file_prog\r"
expect { expect {
-re "TASK_ID:($number),CPU_MASK:($number),MEM_MASK:($number)" { -re "TASK_ID:($number),CPU_MASK:($number),MEM_MASK:($number)" {
...@@ -377,7 +377,7 @@ set full_mask [ expr (1 << $task_cnt) - 1 ] ...@@ -377,7 +377,7 @@ set full_mask [ expr (1 << $task_cnt) - 1 ]
while {$cpu_cnt < $task_cnt} { while {$cpu_cnt < $task_cnt} {
set mask_sum 0 set mask_sum 0
set mask [ expr 1 << $cpu_cnt ] set mask [ expr 1 << $cpu_cnt ]
set mstr [ dec2hex $mask] set mstr [ uint2hex $mask ]
set fwd_mask "$fwd_mask,$mstr" set fwd_mask "$fwd_mask,$mstr"
set fwd_map "$fwd_map,$cpu_cnt" set fwd_map "$fwd_map,$cpu_cnt"
set rev_mask "$mstr,$rev_mask" set rev_mask "$mstr,$rev_mask"
......
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