From 6eda6db8bf4a7a4136b29915447ee00d8ff920e0 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Tue, 24 Jul 2018 22:59:57 +0000 Subject: [PATCH] testsuite: wreck: test CUDA_VISIBLE_DEVICES support Add basic sanity checks for proper operation of the CUDA_VISIBLE_DEVICES plugin for wreck jobs. --- t/t2000-wreck.t | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/t/t2000-wreck.t b/t/t2000-wreck.t index 99e95e40ab33..69b5709b983a 100755 --- a/t/t2000-wreck.t +++ b/t/t2000-wreck.t @@ -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 &&