8000 Fixes for CUDA compilation by ahojnnes · Pull Request #1777 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes for CUDA compilation #1777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ if(CUDA_ENABLED AND CUDA_FOUND)
# Do not show warnings if cuda library functions are deprecated.
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-declarations")
# Explicitly set PIC flags for CUDA targets.
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --compiler-options -fPIC")
if(NOT IS_MSVC)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --compiler-options -fPIC")
endif()

message(STATUS "Enabling CUDA support (version: ${CUDAToolkit_VERSION}, "
"archs: ${CMAKE_CUDA_ARCHITECTURES})")
Expand Down Expand Up @@ -317,7 +319,9 @@ if(Qt5_FOUND)
string(REPLACE "-fPIC" "" new_qt5_core_options ${core_options})
set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_OPTIONS ${new_qt5_core_options})
set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE "ON")
set(CMAKE_CXX_COMPILE_OPTIONS_PIE "-fPIC")
if(NOT IS_MSVC)
set(CMAKE_CXX_COMPILE_OPTIONS_PIE "-fPIC")
endif()
endif()
endif()

Expand Down
1 change: 0 additions & 1 deletion cmake/CMakeHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ macro(COLMAP_ADD_CUDA_TEST TARGET_NAME)
if(TESTS_ENABLED)
# ${ARGN} will store the list of source files passed to this function.
add_executable(${TARGET_NAME} ${ARGN})
target_link_libraries(${TARGET_NAME} CUDA::cudart CUDA::curand)
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER
${COLMAP_TARGETS_ROOT_FOLDER}/${FOLDER_NAME})
target_link_libraries(${TARGET_NAME} colmap
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ endif()
COLMAP_ADD_LIBRARY(colmap ${COLMAP_SOURCES})

if(CUDA_ENABLED)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --use_fast_math")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --use_fast_math")

# Use a separate stream per thread to allow for concurrent kernel execution
# between multiple threads on the same device.
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --default-stream per-thread")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread")

# Suppress warnings:
# ptxas warning : Stack size for entry function X cannot be statically determined.
Expand Down
0