Skip to content
Snippets Groups Projects
Commit 95ee2077 authored by Nathan Yee's avatar Nathan Yee Committed by Morris Jette
Browse files

Update core reservation tests for nodes with multiple threads per core

parent c148e28a
No related branches found
No related tags found
No related merge requests found
......@@ -35,17 +35,33 @@ proc inc3_11_7 {} {
global bin_rm file_in bin_sleep sbatch number scontrol
global alpha_numeric_under scancel
global cluster_cpus cores_per_node def_partition
set num_nodes [available_nodes $def_partition]
set core_res_num [ expr ($cores_per_node / 2) ]
global res_name res_thread_cnt
send_user "\n+++++ STARTING TEST 7 +++++\n"
# Make the reservation
# Make a reservation, just to get node size infomation
set ret_code [create_res "StartTime=now Duration=1 NodeCnt=1 User=$user_name" 0]
if {$ret_code != 0} {
send_user "\n\033\[31mFAILURE: Unable to create a valid reservation\033\[m\n"
exit $ret_code
}
# Delete the reservation
set ret_code [delete_res $res_name]
if {$ret_code != 0} {
exit $ret_code
}
# Now make a reservation using half the cores on that node
# There is no way to specify a the Nodes in a reservation with CoreCnt,
# so hope that we get a node with the same size
set core_res_num [ expr ($cores_per_node / 2) ]
set ret_code [create_res "StartTime=now Duration=60 NodeCnt=1 CoreCnt=$core_res_num User=$user_name" 0]
if {$ret_code != 0} {
send_user "\n\033\[31mFAILURE: Unable to create a valid reservation\033\[m\n"
exit $ret_code
}
set core_res_num [ expr ($cores_per_node / 2) ]
set thread_res_num [ expr $core_res_num * $res_thread_cnt ]
# Make the job script
exec $bin_rm -f $file_in
......@@ -102,7 +118,7 @@ proc inc3_11_7 {} {
sleep 1
# (Second test) Submit the batch job: a job using all cores allocated by the reservation
set sbatch_pid [spawn $sbatch -n$core_res_num --reservation=$res_name --output=/dev/null $file_in]
set sbatch_pid [spawn $sbatch -n$thread_res_num --reservation=$res_name --output=/dev/null $file_in]
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
......@@ -152,7 +168,7 @@ proc inc3_11_7 {} {
sleep 1
# (Third test) Submit the batch job: a job using all cores not allocated by the reservation
set sbatch_pid [spawn $sbatch -n$core_res_num --nodelist=$res_nodes --output=/dev/null $file_in]
set sbatch_pid [spawn $sbatch -n$thread_res_num --nodelist=$res_nodes --output=/dev/null $file_in]
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
......@@ -199,9 +215,9 @@ proc inc3_11_7 {} {
cancel_job $job_id
set core_res_num [ expr ($core_res_num + 1) ]
# (Fourth test) Submit a batch job: a job using more cores than allocated by the reservation
set sbatch_pid [spawn $sbatch -n$core_res_num --reservation=$res_name --output=/dev/null $file_in]
set thread_res_num [ expr ($thread_res_num + 1) ]
set sbatch_pid [spawn $sbatch -n$thread_res_num --reservation=$res_name --output=/dev/null $file_in]
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
......@@ -252,7 +268,7 @@ proc inc3_11_7 {} {
# (Fifth test) Submit a batch job: a job specifying node in reservation and
# using more cores than allocated by the reservation
set sbatch_pid [spawn $sbatch -n$core_res_num --nodelist=$res_nodes --nodes=1 --output=/dev/null $file_in]
set sbatch_pid [spawn $sbatch -n$thread_res_num --nodelist=$res_nodes --nodes=1 --output=/dev/null $file_in]
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
......
......@@ -35,9 +35,7 @@ proc inc3_11_8 {} {
global bin_rm file_in bin_sleep sbatch number scontrol
global alpha_numeric_under scancel
global cluster_cpus cores_per_node def_partition
set num_nodes [available_nodes $def_partition]
set core_res_num [ expr ($cores_per_node / 2) ]
global res_nodes res_thread_cnt
send_user "\n+++++ STARTING TEST 8 +++++\n"
......@@ -45,9 +43,24 @@ proc inc3_11_8 {} {
exec $bin_rm -f $file_in
make_bash_script $file_in "$bin_sleep 100"
# Make a reservation, just to get node size infomation
set ret_code [create_res "StartTime=now Duration=1 NodeCnt=1 User=$user_name" 0]
if {$ret_code != 0} {
send_user "\n\033\[31mFAILURE: Unable to create a valid reservation\033\[m\n"
exit $ret_code
}
# Delete the reservation
set ret_code [delete_res $res_name]
if {$ret_code != 0} {
exit $ret_code
}
set num_nodes [available_nodes $def_partition]
set core_res_num [ expr $cores_per_node / 2 ]
set thread_res_num [ expr $core_res_num * $res_thread_cnt ]
# (First test) Submit the batch job: a simple job using just 1 core inside the reservation
set sbatch_pid [spawn $sbatch --nodes=$num_nodes --time=30:00 --ntasks-per-node=$core_res_num --output=/dev/null $file_in]
# (First test) Submit the batch job: a simple job using half the threads on the nodes
set sbatch_pid [spawn $sbatch --nodelist=$res_nodes --time=30:00 --ntasks-per-node=$thread_res_num --output=/dev/null $file_in]
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
......@@ -98,6 +111,7 @@ proc inc3_11_8 {} {
# Delete the reservation
set ret_code [delete_res $res_name]
if {$ret_code != 0} {
cancel_job $job_id
exit $ret_code
}
......@@ -131,7 +145,7 @@ proc inc3_11_8 {} {
if {$ret_code != 0} {
send_user "\n\033\[32mSUCCESS: Reservation can not be created as expected\033\[m\n"
} else {
send_user "\n\033\[31mFAILURE: Reservation can be created when it shouldnot \033\[m\n"
send_user "\n\033\[31mFAILURE: Reservation can be created when it should not\033\[m\n"
set exit_code 1
# Delete the reservation
......
......@@ -43,15 +43,17 @@ source ./inc3.11.8
set test_id "3.11"
set file_in "test$test_id.input"
set exit_code 0
set res_name ""
set res_name_save ""
set user_name ""
set def_partition ""
set def_node ""
set ii 0
set test_id "3.11"
set file_in "test$test_id.input"
set exit_code 0
set res_name ""
set res_name_save ""
set res_nodes ""
set res_thread_cnt 0
set user_name ""
set def_partition ""
set def_node ""
set ii 0
print_header $test_id
......@@ -63,11 +65,12 @@ print_header $test_id
proc create_res { res_params failure_expected } {
#exp_internal 1
global scontrol
global alpha_numeric_under
global alpha_numeric_under number
global res_name
global res_nodes
global res_nodecnt
global res_corecnt
global res_thread_cnt
set ret_code 0
set res_name ""
......@@ -161,6 +164,21 @@ proc create_res { res_params failure_expected } {
wait
}
}
spawn $scontrol show node $res_nodes
expect {
-re "ThreadsPerCore=($number)" {
set res_thread_cnt $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set ret_code 1
}
eof {
wait
}
}
#exp_internal 0
return $ret_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