File indexing completed on 2026-04-09 07:49:17
0001
0002 usage(){ cat << EOU
0003 SGLFW_SOPTIX_Scene_test_local.sh : triangulated raytrace and rasterized visualization
0004 =======================================================================================
0005
0006 This is a "local" non-CMake build variant of SGLFW_SOPTIX_Scene_test.sh
0007 for development only. The binary created and this script are NOT
0008 included in release. Use SGLFW_SOPTIX_Scene_test.sh for that.
0009
0010
0011 One step way to create the stree and scene from gdml or other geometry source
0012 ---------------------------------------------------------------------------------
0013
0014 ::
0015
0016 ~/o/u4/tests/U4TreeCreateSSimTest.sh
0017
0018
0019 Two step way to create the scene folder from gdml or other geometry source
0020 -----------------------------------------------------------------------------
0021
0022 1. load geometry and use U4Tree::Create to convert to stree.h and persist the tree::
0023
0024 ~/o/u4/tests/U4TreeCreateTest.sh
0025
0026
0027 2. load stree and create corresponding SScene::
0028
0029 ~/o/sysrap/tests/SScene_test.sh
0030
0031
0032
0033 Simpler Prior Developments
0034 ---------------------------
0035
0036 Related simpler priors::
0037
0038 ~/o/sysrap/tests/SOPTIX_Scene_test.sh
0039 ~/o/sysrap/tests/SOPTIX_Scene_test.cc
0040
0041
0042
0043 Which GL/glew.h is picked up ?
0044 ---------------------------------
0045
0046 On changing env from JUNO-opticks to ONLY-opticks build directly with
0047 opticks-full note that have changed the OpenGL version in use
0048 causing missing symbol GL_CONTEXT_LOST
0049
0050 Fixed that with GL_VERSION_4_5 check, but why the older version ?
0051
0052 * probably just a change in glew header not a change in actual GL version used
0053
0054 Adding "-M" to gcc commandline lists all the
0055 included headers in Makefile dependency format.
0056 This shows are picking up system headers::
0057
0058 /usr/include/GL/glew.h
0059 /usr/include/GL/glu.h
0060 /usr/include/GL/gl.h
0061 /usr/include/GLFW/glfw3.h
0062
0063 Which corresponds to::
0064
0065 //SGLFW::init GL_RENDERER [NVIDIA TITAN RTX/PCIe/SSE2]
0066 //SGLFW::init GL_VERSION [4.1.0 NVIDIA 515.43.04]
0067
0068 HMM: this maybe because I removed glew and glfw from the
0069 standard externals ?
0070
0071 HMM: but after installing those get::
0072
0073 undefined symbol: glfwSetWindowMaximizeCallback
0074
0075 when using::
0076
0077 /data/blyth/opticks_Debug/externals/include/GL/glew.h
0078 /usr/include/GL/glu.h
0079 /usr/include/GL/gl.h
0080 /data/blyth/opticks_Debug/externals/include/GLFW/glfw3.h
0081
0082 Return to system with::
0083
0084 glfw-
0085 glfw-manifest-wipe
0086 glfw-manifest-wipe | sh
0087
0088 glew-
0089 glew-manifest-wipe
0090 glew-manifest-wipe | sh
0091
0092
0093
0094 xir-notes::
0095
0096 nvcc warning : '--device-debug (-G)' overrides '--generate-line-info (-lineinfo)'
0097
0098 With "-G" and default options::
0099
0100 [ 2][COMPILE FEEDBACK]: COMPILE ERROR: Optimized debugging is not supported.
0101 Module is built with full debug info, but requested debug level is not
0102 "OPTIX_COMPILE_DEBUG_LEVEL_FULL".
0103
0104 EOU
0105 }
0106
0107 name=SGLFW_SOPTIX_Scene_test
0108
0109 export FOLD=/tmp/$USER/opticks/$name
0110 mkdir -p $FOLD
0111 bin=$FOLD/$name
0112
0113
0114
0115
0116
0117 source $HOME/.opticks/GEOM/GEOM.sh
0118 [ -z "$GEOM" ] && echo $BASH_SOURCE FATAL GEOM $GEOM IS REQUIRTED && exit 1
0119
0120 _CFB=${GEOM}_CFBaseFromGEOM
0121 if [ ! -d "${!_CFB}/CSGFoundry/SSim/scene" ]; then
0122 echo $BASH_SOURCE : FATAL GEOM $GEOM ${_CFB} ${!_CFB}
0123 exit 1
0124 fi
0125
0126 source $HOME/.opticks/GEOM/EVT.sh
0127 source $HOME/.opticks/GEOM/MOI.sh
0128
0129 logging()
0130 {
0131 type $FUNCNAME
0132
0133
0134
0135
0136 export SOPTIX_Options__LEVEL=2
0137 export SOPTIX_Scene__DUMP=1
0138 }
0139 [ -n "$LOG" ] && logging
0140
0141
0142
0143 wh=2560,1440
0144
0145
0146 fullscreen=1
0147
0148
0149
0150
0151
0152
0153
0154 eye=1,0,0
0155
0156 look=0,0,0
0157 up=0,0,1
0158
0159 tmin=0.1
0160
0161
0162 escale=extent
0163
0164 cam=perspective
0165
0166
0167 vizmask=t
0168
0169
0170 export WH=${WH:-$wh}
0171 export FULLSCREEN=${FULLSCREEN:-$fullscreen}
0172 export EYE=${EYE:-$eye}
0173 export LOOK=${LOOK:-$look}
0174 export UP=${UP:-$up}
0175 export TMIN=${TMIN:-$tmin}
0176 export ESCALE=${ESCALE:-$escale}
0177 export CAM=${CAM:-$cam}
0178 export VIZMASK=${VIZMASK:-$vizmask}
0179
0180
0181
0182
0183
0184 defarg="info_ptx_xir_build_run"
0185 arg=${1:-$defarg}
0186
0187 cu=../SOPTIX.cu
0188 ptx=$FOLD/SOPTIX.ptx
0189 xir=$FOLD/SOPTIX.optixir
0190 cptx=$OPTICKS_PREFIX/optix/objects-Debug/SysRap_OPTIX/SOPTIX.ptx
0191 export SOPTIX__optixpath=$ptx
0192
0193
0194 cuda_prefix=/usr/local/cuda
0195 CUDA_PREFIX=${CUDA_PREFIX:-$cuda_prefix}
0196 for l in lib lib64 ; do [ -d "$CUDA_PREFIX/$l" ] && cuda_l=$l ; done
0197
0198 optix_prefix=${OPTICKS_OPTIX_PREFIX}
0199 OPTIX_PREFIX=${OPTIX_PREFIX:-$optix_prefix}
0200 [ -z "$OPTIX_PREFIX" ] && echo $BASH_SOURCE - ERROR no OPTIX_PREFIX or OPTICKS_OPTIX_PREFIX && exit 1
0201
0202 sysrap_dir=..
0203 SYSRAP_DIR=${SYSRAP_DIR:-$sysrap_dir}
0204
0205
0206
0207 vars="BASH_SOURCE defarg arg CUDA_PREFIX OPTIX_PREFIX cuda_l SCENE_FOLD FOLD SOPTIX_PTX SOPTIX_XIR SOPTIX_KERNEL bin SGLFW_FRAME GEOM BASE"
0208
0209 if [ "${arg/info}" != "$arg" ]; then
0210 for var in $vars ; do printf "%20s : %s\n" "$var" "${!var}" ; done
0211 fi
0212
0213 if [ "${arg/ptx}" != "$arg" -o "${arg/xir}" != "$arg" ]; then
0214
0215 opt=""
0216 if [ "${arg/ptx}" != "$arg" ]; then
0217 out=$ptx
0218 opt=-ptx
0219 elif [ "${arg/xir}" != "$arg" ]; then
0220 out=$xir
0221 opt=-optix-ir
0222 fi
0223 echo $BASH_SOURCE arg $arg out $out opt $opt
0224
0225
0226
0227 $CUDA_PREFIX/bin/nvcc $cu \
0228 $opt \
0229 -std=c++11 \
0230 -c \
0231 -lineinfo \
0232 -use_fast_math \
0233 -I.. \
0234 -I$CUDA_PREFIX/include \
0235 -I$OPTIX_PREFIX/include \
0236 -o $out
0237 [ $? -ne 0 ] && echo $BASH_SOURCE : out $out build error && exit 1
0238 ls -alst $out
0239
0240 echo $BASH_SOURCE out $out DONE
0241 fi
0242
0243
0244 if [ "${arg/build}" != "$arg" ]; then
0245
0246 echo $BASH_SOURCE build
0247 gcc $name.cc \
0248 -fvisibility=hidden \
0249 -fvisibility-inlines-hidden \
0250 -fdiagnostics-show-option \
0251 -Wall \
0252 -Wno-unused-function \
0253 -Wno-shadow \
0254 -Wsign-compare \
0255 -DWITH_CUDA_GL_INTEROP \
0256 -DWITH_CHILD \
0257 -DCONFIG_Debug \
0258 -g -O0 -std=c++17 \
0259 -I$SYSRAP_DIR \
0260 -I$OPTICKS_PREFIX/include/SysRap \
0261 -I$OPTICKS_PREFIX/externals/glm/glm \
0262 -I$OPTICKS_PREFIX/externals/include \
0263 -I$CUDA_PREFIX/include \
0264 -I$OPTIX_PREFIX/include \
0265 -L$CUDA_PREFIX/$cuda_l -lcudart \
0266 -lstdc++ \
0267 -lm -ldl \
0268 -L$OPTICKS_PREFIX/lib64 -lSysRap \
0269 -L$OPTICKS_PREFIX/externals/lib -lGLEW \
0270 -L$OPTICKS_PREFIX/externals/lib64 -lglfw \
0271 -lGL \
0272 -o $bin
0273
0274 [ $? -ne 0 ] && echo $BASH_SOURCE : build error && exit 1
0275 echo $BASH_SOURCE build DONE
0276 fi
0277
0278
0279 if [ "${arg/dbg}" != "$arg" -o -n "$GDB" ]; then
0280 source dbg__.sh
0281 dbg__ $bin
0282 [ $? -ne 0 ] && echo $BASH_SOURCE : run error && exit 2
0283 fi
0284
0285 if [ "${arg/run}" != "$arg" ]; then
0286 $bin
0287 [ $? -ne 0 ] && echo $BASH_SOURCE : run error && exit 3
0288 fi
0289
0290 if [ "${arg/grab}" != "$arg" ]; then
0291 source $OPTICKS_HOME/bin/BASE_grab.sh $arg
0292 fi
0293
0294 if [ "${arg/list}" != "$arg" -o "${arg/pub}" != "$arg" ]; then
0295 source $OPTICKS_HOME/bin/BASE_grab.sh $arg
0296 fi
0297
0298 exit 0
0299