how to change the default SM architecture in the Optix samples with CMAke?

Hi,

the default sm is :
.version 4.1
.target sm_20

I want to change the sm to 50 ,but I do not know how to set the flags with CMAKE?

Try this. It might already be in your Cmake code somewhere, but set to sm_20.

if(NOT PASSED_FIRST_CONFIGURE)
  set(flag "--gpu-architecture sm_50")
  list(FIND CUDA_NVCC_FLAGS ${flag} index)
  if(index EQUAL -1)
    list(APPEND CUDA_NVCC_FLAGS ${flag})
    set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} CACHE LIST "Semi-colon delimit multiple arguments." FORCE)
  endif()

  set(PASSED_FIRST_CONFIGURE ON CACHE INTERNAL "Already Configured once?")
endif(NOT PASSED_FIRST_CONFIGURE)

Hi, nljones
I can not find sm_20, but I find this:

if(NOT PASSED_FIRST_CONFIGURE)
  set(flag "--use_fast_math")
  list(FIND CUDA_NVCC_FLAGS ${flag} index)
  if(index EQUAL -1)
    list(APPEND CUDA_NVCC_FLAGS ${flag})
    set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} CACHE LIST "Semi-colon delimit multiple arguments." FORCE)
  endif()

  if (CUDA_VERSION VERSION_LESS "3.0")
    set(flag "--keep")
    list(FIND CUDA_NVCC_FLAGS ${flag} index)
    if(index EQUAL -1)
      list(APPEND CUDA_NVCC_FLAGS ${flag})
      set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} CACHE LIST "Semi-colon delimit multiple arguments." FORCE)
    endif()
  endif()

  if( APPLE )
    # Undef'ing __BLOCKS__ for OSX builds.  This is due to a name clash between OSX 10.6
    # C headers and CUDA headers
    set(flag "-U__BLOCKS__")
    list(FIND CUDA_NVCC_FLAGS ${flag} index)
    if(index EQUAL -1)
      list(APPEND CUDA_NVCC_FLAGS ${flag})
      set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} CACHE LIST "Semi-colon delimit multiple arguments." FORCE)
    endif()
  endif()
endif(NOT PASSED_FIRST_CONFIGURE)

You could add to that a section to append “–gpu-architecture sm_50” to the list of flags as I showed before. Also, you can check the CUDA_NVCC_FLAGS variable in Cmake after you configure to verify that the correct SM version is being passed.