Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #! /bin/bash -e
0002 
0003 function help() {
0004   cat <<@EOF
0005 Usage:
0006   cmsCudaRebuild.sh [-g|-G] [-v] [-h]
0007 
0008 Check out and build all packages that contain CUDA code in .cu files.
0009 
0010 Options:
0011   -g    Compile with debugging symbols, passing
0012           "-g -rdynamic" to the host compiler, and
0013           "-g -lineinfo" to CUDA compiler
0014 
0015   -G    Compile with debugging symbols and enable asserts on the GPU, passing
0016           "-g -rdynamic -DGPU_DEBUG" to the host compiler, and
0017           "-g -lineinfo -DGPU_DEBUG" to the CUDA compiler.
0018 
0019   -h    Show this help, and exit.
0020 
0021   -v    Make scram be verbose.
0022 
0023 @EOF
0024 }
0025 
0026 
0027 DEBUG=0
0028 VERBOSE=0
0029 
0030 while [ "$*" ]; do
0031   case "$1" in
0032   -h)
0033     help
0034     exit 0
0035     ;;
0036   -g)
0037     DEBUG=1
0038     shift
0039     ;;
0040   -G)
0041     DEBUG=2
0042     shift
0043     ;;
0044   -v)
0045     VERBOSE=$((VERBOSE + 1))
0046     shift
0047     ;;
0048   *)
0049     help
0050     exit 1
0051     ;;
0052   esac
0053 done
0054 
0055 # move to the .../src directory
0056 cd $CMSSW_BASE/src/
0057 
0058 # check out all packages containing .cu files
0059 git ls-files --full-name | grep '.*\.cu$' | cut -d/ -f-2 | sort -u | xargs git cms-addpkg
0060 
0061 # set additional compilation flags
0062 if (( DEBUG == 1 )); then
0063   export USER_CXXFLAGS="-g -rdynamic $USER_CXXFLAGS"
0064   export USER_CUDA_FLAGS="-g -lineinfo $USER_CUDA_FLAGS"
0065 elif (( DEBUG == 2 )); then
0066   export USER_CXXFLAGS="-g -rdynamic -DGPU_DEBUG $USER_CXXFLAGS"
0067   export USER_CUDA_FLAGS="-g -lineinfo -DGPU_DEBUG $USER_CUDA_FLAGS"
0068 fi
0069 
0070 if (( VERBOSE > 0 )); then
0071   SCRAM_VERBOSE="-v"
0072 fi
0073 
0074 # clean all built packages
0075 scram b clean
0076 
0077 # rebuild all checked out packages
0078 scram b $SCRAM_VERBOSE -j