Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:44

0001 #!/bin/bash
0002 
0003 function die { echo Failure $1: status $2 ; exit $2 ; }
0004 
0005 TEST_DIR=$CMSSW_BASE/src/HeterogeneousCore/CUDATest/test
0006 
0007 if [ "x$#" != "x1" ]; then
0008     die "Need exactly 1 argument ('cpu', 'gpu'), got $#" 1
0009 fi
0010 if [ "x$1" = "xgpu" ]; then
0011     TARGET=gpu
0012 elif [ "x$1" = "xcpu" ]; then
0013     # In non-_GPU_ IBs, if CUDA is enabled, run the GPU-targeted tests
0014     cudaIsEnabled
0015     CUDA_ENABLED=$?
0016     if [ "x${CUDA_ENABLED}" == "x0" ]; then
0017         TARGET=gpu
0018     else
0019         TARGET=cpu
0020     fi
0021 else
0022     die "Argument needs to be 'cpu' or 'gpu', got $1" 1
0023 fi
0024 
0025 echo "*************************************************"
0026 echo "CUDA producer configuration with SwitchProducer, automatic"
0027 cmsRun ${TEST_DIR}/testCUDASwitch_cfg.py --silent || die "cmsRun testCUDASwitch_cfg.py --silent" $?
0028 
0029 echo "*************************************************"
0030 echo "CUDA producer configuration with SwitchProducer, force CPU"
0031 cmsRun ${TEST_DIR}/testCUDASwitch_cfg.py --silent --accelerator="cpu" || die "cmsRun testCUDASwitch_cfg.py --silent --accelerator=\"\"" $?
0032 
0033 if [ "x${TARGET}" == "xgpu" ]; then
0034     echo "*************************************************"
0035     echo "CUDA producer configuration with SwitchProducer, force GPU"
0036     cmsRun ${TEST_DIR}/testCUDASwitch_cfg.py --silent --accelerator="gpu-nvidia" || die "cmsRun testCUDASwitch_cfg.py --silent --accelerator=gpu-nvidia" $?
0037 elif [ "x${TARGET}" == "xcpu" ]; then
0038     echo "*************************************************"
0039     echo "CUDA producer configuration with SwitchProducer, force GPU, should fail"
0040     cmsRun -j testCUDATest_jobreport.xml ${TEST_DIR}/testCUDASwitch_cfg.py --silent --accelerator="gpu-nvidia" && die "cmsRun testCUDASwitch_cfg.py --silent --accelerator=gpu-nvidia did not fail" 1
0041     EXIT_CODE=$(edmFjrDump --exitCode testCUDATest_jobreport.xml)
0042     if [ "x${EXIT_CODE}" != "x8035" ]; then
0043         echo "Test (that was expected to fail) reported exit code ${EXIT_CODE} instead of expected 8035"
0044     fi
0045 fi