Skip to content

Commit

Permalink
testsuite: wreck: test CUDA_VISIBLE_DEVICES support
Browse files Browse the repository at this point in the history
Add basic sanity checks for proper operation of the CUDA_VISIBLE_DEVICES
plugin for wreck jobs.
  • Loading branch information
grondo committed Jul 25, 2018
1 parent 855b8db commit 6eda6db
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions t/t2000-wreck.t
Expand Up @@ -265,6 +265,34 @@ test_expect_success MULTICORE 'wreckrun: local cpu-affinity option overriedes gl
test_cmp no-affinity.expected no-affinity.out
'

test_expect_success 'wreckrun: CUDA_VISIBLE_DEVICES is set for gpus' '
output=$(flux wreckrun -n1 -g 1 printenv CUDA_VISIBLE_DEVICES) &&
test_debug "echo CUDA_VISIBLE_DEVICES = $output" &&
test "$output" = "0" &&
output=$(flux wreckrun -n1 -g 2 printenv CUDA_VISIBLE_DEVICES) &&
test_debug "echo CUDA_VISIBLE_DEVICES = $output" &&
test "$output" = "0,1"
'
test_expect_success 'wreckrun: CUDA_VISIBLE_DEVICES not set with gpubind=off' '
output=$(flux wreckrun -n1 -g1 -o gpubind=off printenv CUDA_VISIBLE_DEVICES ||:) &&
test_debug "echo CUDA_VISIBLE_DEVICES=$output" &&
test "$output" = ""
'
test_expect_success 'wreckrun: -o gpubind=per-task works' '
flux wreckrun -l -n2 -N1 -g2 printenv CUDA_VISIBLE_DEVICES |sort >cuda_visible.out1 &&
cat <<-EOF >cuda_visible.expected1 &&
0: 0,1,2,3
1: 0,1,2,3
EOF
test_cmp cuda_visible.expected1 cuda_visible.out1 &&
flux wreckrun -l -n2 -N1 -g2 -o gpubind=per-task \
printenv CUDA_VISIBLE_DEVICES |sort >cuda_visible.out2 &&
cat <<-EOF >cuda_visible.expected2 &&
0: 0,1
1: 2,3
EOF
test_cmp cuda_visible.expected2 cuda_visible.out2
'
test_expect_success 'wreckrun: top level environment' '
flux kvs put --json lwj.environ="{ \"TEST_ENV_VAR\": \"foo\" }" &&
run_timeout 5 flux wreckrun -n2 printenv TEST_ENV_VAR > output_top_env &&
Expand Down

0 comments on commit 6eda6db

Please sign in to comment.