Actual source code: ex12.c
1: static const char help[] = "Tests PetscDevice and PetscDeviceContext init sequence control from command line.\n\n";
3: #include "petscdevicetestcommon.h"
5: int main(int argc, char *argv[])
6: {
7: PetscDeviceContext dctx;
9: PetscFunctionBeginUser;
10: // check that things are properly caught at init-time, i.e. allow failures for "lazy" during
11: // initialize
12: PetscCall(PetscInitialize(&argc, &argv, NULL, help));
13: // and check that things are properly handled if explicitly requested
14: PetscCall(PetscDeviceContextGetCurrentContext(&dctx));
15: PetscCall(PetscFinalize());
16: return 0;
17: }
19: /*TEST
21: testset:
22: requires: defined(PETSC_HAVE_DEVICE) defined(PETSC_USE_INFO)
23: filter: grep -e PetscDevice -e "PETSC ERROR" -e "PETSc successfully started"
24: args: -info -device_enable {{none lazy eager}separate output}
25: args: -petsc_ci_portable_error_output -error_output_stdout
26: test:
27: requires: cuda
28: args: -device_enable_cuda {{none lazy eager}separate output}
29: suffix: cuda_no_env
30: test:
31: requires: cuda
32: env: CUDA_VISIBLE_DEVICES=0
33: args: -device_enable_cuda {{none lazy eager}separate output}
34: suffix: cuda_env_set
35: test:
36: requires: cuda
37: env: CUDA_VISIBLE_DEVICES=
38: args: -device_enable_cuda {{none lazy eager}separate output}
39: suffix: cuda_env_set_empty
40: test:
41: requires: hip
42: args: -device_enable_hip {{none lazy eager}separate output}
43: suffix: hip_no_env
44: test:
45: requires: hip
46: env: HIP_VISIBLE_DEVICES=0
47: args: -device_enable_hip {{none lazy eager}separate output}
48: suffix: hip_env_set
49: test:
50: requires: hip
51: env: HIP_VISIBLE_DEVICES=
52: args: -device_enable_hip {{none lazy eager}separate output}
53: suffix: hip_env_set_empty
55: TEST*/