Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-12 01:51:29

0001 #!/bin/bash
0002 
0003 LOCALTOP=$1
0004 DEVICE=$2
0005 
0006 # the test is not possible if:
0007 # 1. GPU not available (only if GPU test requested) / avx instructions not supported (needed for singularity on CPU)
0008 # 1b. Nvidia drivers not available
0009 # 2. wrong architecture (not amd64)
0010 # 3. singularity not found or not usable
0011 # 4. inside singularity container w/o unprivileged user namespace enabled (needed for singularity-in-singularity)
0012 # so just return true in those cases
0013 
0014 if [ "$DEVICE" = "GPU" ]; then
0015         if nvidia-smi -L; then
0016                 echo "has GPU"
0017         else
0018                 echo "missing GPU"
0019                 exit 0
0020         fi
0021 
0022         if cmsTriton check; then
0023                 echo "has NVIDIA driver"
0024         else
0025                 echo "missing current or compatible NVIDIA driver"
0026                 exit 0
0027         fi
0028 else
0029         if grep -q avx /proc/cpuinfo; then
0030                 echo "has avx"
0031         else
0032                 echo "missing avx"
0033                 exit 0
0034         fi
0035 fi
0036 
0037 THIS_ARCH=$(echo $SCRAM_ARCH | cut -d'_' -f2)
0038 if [ "$THIS_ARCH" == "amd64" ]; then
0039        echo "has amd64"
0040 else
0041        echo "missing amd64"
0042        exit 0
0043 fi
0044 
0045 if type singularity >& /dev/null; then
0046         echo "has singularity"
0047 else
0048         echo "missing singularity"
0049         exit 0
0050 fi
0051 
0052 if [ -n "$SINGULARITY_CONTAINER" ]; then
0053         if grep -q "^allow setuid = no" /etc/singularity/singularity.conf && unshare -U echo >/dev/null 2>&1; then
0054                 echo "has unprivileged user namespace support"
0055         else
0056                 echo "missing unprivileged user namespace support"
0057                 exit 0
0058         fi
0059 fi
0060 
0061 fallbackName=triton_server_instance_${DEVICE}
0062 tmpFile=$(mktemp -p ${LOCALTOP} SonicTritonTestXXXXXXXX.log)
0063 cmsRun ${LOCALTOP}/src/HeterogeneousCore/SonicTriton/test/tritonTest_cfg.py modules=TritonGraphProducer,TritonGraphFilter,TritonGraphAnalyzer maxEvents=2 unittest=1 verbose=1 device=${DEVICE} testother=1 fallbackName=${fallbackName} >& $tmpFile
0064 CMSEXIT=$?
0065 
0066 cat $tmpFile
0067 
0068 if grep -q "Socket closed" $tmpFile; then
0069         echo "Transient server error (not caused by client code)"
0070         CMSEXIT=0
0071 fi
0072 
0073 rm $tmpFile
0074 exit $CMSEXIT