Skip to content
Snippets Groups Projects
Commit fa95b493 authored by Moe Jette's avatar Moe Jette
Browse files

Tweak code to determine CPU count on node.

parent 081d91a8
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ if {[test_multiple_slurmd] != 0} { ...@@ -53,7 +53,7 @@ if {[test_multiple_slurmd] != 0} {
} }
make_bash_script $file_in " make_bash_script $file_in "
env | grep SLURM_JOB_CPUS_PER_NODE env | grep SLURM_CPUS_ON_NODE
$bin_hostname" $bin_hostname"
# #
...@@ -67,12 +67,16 @@ set timeout $max_job_delay ...@@ -67,12 +67,16 @@ set timeout $max_job_delay
set node_cnt 1 set node_cnt 1
set task_cnt 1 set task_cnt 1
spawn $srun -N$node_cnt --cpus-per-task=$task_cnt -l -t1 $bin_hostname spawn $srun -N$node_cnt --cpus-per-task=$task_cnt -l -t1 $file_in
expect { expect {
-re "Granted job allocation ($number)" { -re "Granted job allocation ($number)" {
set job_id $expect_out(1,string) set job_id $expect_out(1,string)
exp_continue exp_continue
} }
-re "SLURM_CPUS_ON_NODE=($number)" {
set cpus_per_node $expect_out(1,string)
exp_continue
}
-re "($number): ($alpha_numeric)" { -re "($number): ($alpha_numeric)" {
set task $expect_out(1,string) set task $expect_out(1,string)
set host $expect_out(2,string) set host $expect_out(2,string)
...@@ -108,6 +112,11 @@ if {[string compare $host ""] == 0} { ...@@ -108,6 +112,11 @@ if {[string compare $host ""] == 0} {
send_user "\nFAILURE: Did not get hostname\n" send_user "\nFAILURE: Did not get hostname\n"
exit 1 exit 1
} }
if {$cpus_per_node != $cpu_count} {
send_user "FAILURE: should have run $cpus_per_node tasks (one per CPU) "
send_user "instead of $cpu_count tasks\n"
exit 1
}
if {$cpu_count < 2} { if {$cpu_count < 2} {
send_user "\nWARNING: The node only has one CPU\n" send_user "\nWARNING: The node only has one CPU\n"
exit $exit_code exit $exit_code
......
...@@ -118,7 +118,8 @@ if {[string compare $host ""] == 0} { ...@@ -118,7 +118,8 @@ if {[string compare $host ""] == 0} {
exit 1 exit 1
} }
if {$cpus_per_node != $cpu_count} { if {$cpus_per_node != $cpu_count} {
send_user "FAILURE: should have run $cpus_per_node tasks (one per CPU) instead of $cpu_count tasks\n" send_user "FAILURE: should have run $cpus_per_node tasks (one per CPU) "
send_user "instead of $cpu_count tasks\n"
exit 1 exit 1
} }
if {$cpus_per_node < 2} { if {$cpus_per_node < 2} {
......
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