Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:12

0001 qudarap-source(){   echo $BASH_SOURCE ; }
0002 qudarap-vi(){       vi $(qudarap-source) ; }
0003 qudarap-usage(){ cat << "EOU"
0004 QUDARap
0005 ==========
0006 
0007 EOU
0008 }
0009 
0010 qudarap-env(){      
0011   olocal-  
0012 }
0013 
0014 
0015 qudarap-idir(){ echo $(opticks-idir); }
0016 qudarap-bdir(){ echo $(opticks-bdir)/qudarap ; }
0017 qudarap-sdir(){ echo $(opticks-home)/qudarap ; }
0018 qudarap-tdir(){ echo $(opticks-home)/qudarap/tests ; }
0019 
0020 qudarap-c(){    cd $(qudarap-sdir)/$1 ; }
0021 qudarap-cd(){   cd $(qudarap-sdir)/$1 ; }
0022 qudarap-scd(){  cd $(qudarap-sdir); }
0023 qudarap-tcd(){  cd $(qudarap-tdir); }
0024 qudarap-bcd(){  cd $(qudarap-bdir); }
0025 
0026 
0027 
0028 
0029 qudarap-prepare-installation-notes(){ cat << EON
0030 qudarap-prepare-installation-notes
0031 ---------------------------------------
0032 
0033 If you have lots of VRAM you can increase the 
0034 maximum possible launch size by expanding the CHUNKSIZES.  
0035 For example the initial 10x1M,9x10M,5x20M corresponds 
0036 to 200M RNG in 24 file chunks.
0037 That could be expanded to 300M with::
0038 
0039     10x1M,9x10M,10x20M
0040 
0041 NB you will get asserts if the change does not 
0042 ONLY expand the chunks. 
0043 
0044 To use different chunking delete all chunks and run again. 
0045 
0046 EON
0047 }
0048 
0049 
0050 
0051 qudarap-prepare-installation()
0052 {
0053    # these are the defaults anyhow
0054    export SCurandStateMonolithic__init_SEED_OFFSET=0:0
0055    export SCurandStateMonolithic__init_CHUNKSIZES=10x1M,9x10M,5x20M
0056 
0057    ${OPTICKS_PREFIX}/lib/QCurandStateMonolithicTest
0058 
0059    return $? 
0060 }
0061 
0062 qudarap-check-installation()
0063 {
0064    echo -n
0065 }
0066 
0067 
0068 qudarap-divider()
0069 {
0070    cat << EON
0071 ===========================================================================================================
0072   BELOW IS FOR THE OLD MONOLITHIC IMPL : LIKELY TO BE REMOVED ONCE CHUNKED APPROCH HAS BEEN FULLY TESTED
0073 ===========================================================================================================
0074 EON
0075 }
0076 
0077 
0078 
0079 
0080 
0081 
0082 
0083 
0084 
0085 
0086 
0087 qudarap-prepare-sizes-Linux-(){  echo ${OPTICKS_QUDARAP_RNGMAX:-1,3,10} ; }
0088 qudarap-prepare-sizes-Darwin-(){ echo ${OPTICKS_QUDARAP_RNGMAX:-1,3} ; }
0089 qudarap-prepare-sizes(){ $FUNCNAME-$(uname)- | tr "," "\n"  ; }
0090 qudarap-rngdir(){ echo $(opticks-rngdir) ; }
0091 
0092 
0093 qudarap-prepare-installation-old-notes(){ cat << EON
0094 qudarap-prepare-installation-old-notes
0095 ---------------------------------------
0096 
0097 See::
0098 
0099     qudarap/QCurandStateMonolithic.{hh,cc}
0100     sysrap/SCurandStateMonolithic.{hh,cc}
0101 
0102 NB changing the below envvars can adjust the QCurandStateMonolithic_SPEC::
0103 
0104    QUDARAP_RNG_SEED 
0105    QUDARAP_RNG_OFFSET 
0106 
0107 But doing this is for expert usage only because it will then 
0108 be necessary to set QCurandStateMonolithic_SPEC correspondingly
0109 when running Opticks executables for them to find
0110 the customized RNG files. 
0111 
0112 HMM : THIS AWKWARDNESS SUGGESTS SPLITTING THE size and the seed:offset config
0113 
0114 EON
0115 }
0116 
0117 
0118 
0119 
0120 qudarap-prepare-installation-old()
0121 {
0122    local sizes=$(qudarap-prepare-sizes)
0123    local size 
0124    local seed=${QUDARAP_RNG_SEED:-0}
0125    local offset=${QUDARAP_RNG_OFFSET:-0}
0126    for size in $sizes ; do 
0127        QCurandStateMonolithic_SPEC=$size:$seed:$offset  ${OPTICKS_PREFIX}/lib/QCurandStateMonolithicTest
0128        rc=$? ; [ $rc -ne 0 ] && return $rc
0129    done
0130    return 0 
0131 }
0132 
0133 qudarap-check-installation-old()
0134 {
0135    local msg="=== $FUNCNAME :"
0136    local rc=0
0137    qudarap-check-rngdir-
0138    rc=$? ; [ $rc -ne 0 ] && return $rc
0139 
0140    local sizes=$(qudarap-prepare-sizes)
0141    local size 
0142    for size in $sizes ; do 
0143        QCurandStateMonolithic_SPEC=$size:0:0  qudarap-check-rngpath-
0144        rc=$? 
0145        [ $rc -ne 0 ] && return $rc
0146    done
0147    return $rc
0148 }
0149 
0150 qudarap-check-rngdir-()
0151 {
0152     local rngdir=$(qudarap-rngdir)
0153     local rc=0
0154     local err=""
0155     [ ! -d "$rngdir" ] && rc=201 && err=" MISSING rngdir $rngdir " 
0156     echo $msg $rngdir $err rc $rc
0157     return $rc 
0158 }
0159 
0160 qudarap-parse(){ 
0161     : parse the spec envvar returning num/seed/offset 
0162     local defspec=1:0:0
0163     local spec=${QCurandStateMonolithic_SPEC:-$defspec} 
0164     local qty=${1:-num}
0165 
0166     local num
0167     local seed
0168     local offset 
0169 
0170     IFS=: read -r num seed offset <<< "$spec"
0171 
0172     [ $num -le 100 ] && num=$(( $num*1000*1000 ))
0173 
0174     case $qty in
0175        num)    echo $num ;;
0176        seed)   echo $seed ;;
0177        offset) echo $offset ;;
0178     esac
0179 }
0180 qudarap-num(){    qudarap-parse num ; }
0181 qudarap-seed(){   qudarap-parse seed ; }
0182 qudarap-offset(){ qudarap-parse offset ; }
0183 
0184 qudarap-rngname(){ echo QCurandStateMonolithic_$(qudarap-num)_$(qudarap-seed)_$(qudarap-offset).bin ; }
0185 
0186 qudarap-rngname-1(){ QCurandStateMonolithic_SPEC=1:0:0 qudarap-rngname ; }
0187 qudarap-rngname-3(){ QCurandStateMonolithic_SPEC=3:0:0 qudarap-rngname ; }
0188 
0189 qudarap-rngpath(){ echo $(qudarap-rngdir)/$(qudarap-rngname) ; }
0190 
0191 qudarap-check-rngpath-()
0192 {
0193     local rc=0
0194     local path=$(qudarap-rngpath)
0195     local err=""
0196     [ ! -f $path ] && rc=202 && err=" MISSING PATH $path " 
0197     echo $msg $path $err rc $rc
0198     return $rc
0199 }
0200 
0201