From 1a829b8cc502b2fc189072ee2d97a0499e673e3e Mon Sep 17 00:00:00 2001 From: Carsten Griwodz Date: Fri, 26 Jul 2024 13:33:39 +0200 Subject: [PATCH] adapted dependency settings to new CUDA variables --- .github/workflows/continuous-integration.yml | 4 ++++ CMakeLists.txt | 2 +- src/CMakeLists.txt | 11 ++++++++--- src/application/CMakeLists.txt | 4 ++-- src/application/main.cpp | 20 -------------------- src/application/match.cpp | 12 ------------ src/popsift/{popsift.cpp => popsift.cu} | 0 7 files changed, 15 insertions(+), 38 deletions(-) rename src/popsift/{popsift.cpp => popsift.cu} (100%) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b83d1e3e..8b46ec1b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -27,6 +27,10 @@ jobs: # excludes debug on this one as it has a segmentation fault during the compilation (!) - container: "alicevision/popsift-deps:cuda12.1.0-ubuntu22.04" build_tpe: "Debug" + - container: "alicevision/popsift-deps:cuda12.1.0-ubuntu22.04" + build_tpe: "Release" + - container: "alicevision/popsift-deps:cuda11.8.0-ubuntu20.04" + build_tpe: "Debug" container: image: ${{ matrix.container }} diff --git a/CMakeLists.txt b/CMakeLists.txt index a9c033cb..06b08e3e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ project(PopSift VERSION 1.0.0 LANGUAGES CXX CUDA) # Since CMake 3.18. See https://cmake.org/cmake/help/latest/policy/CMP0104.html cmake_policy(SET CMP0104 NEW) -set(CMAKE_CUDA_ARCHITECTURES "all-major" +set(CMAKE_CUDA_ARCHITECTURES "native" CACHE STRING "Which CUDA CCs to support: native, all, all-major or an explicit list delimited by semicolons" FORCE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e0816e7..07dc81f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(popsift SHARED - popsift/popsift.cpp popsift/popsift.h + popsift/popsift.cu popsift/popsift.h popsift/features.cu popsift/features.h popsift/sift_constants.cu popsift/sift_constants.h popsift/sift_conf.cu popsift/sift_conf.h @@ -41,8 +41,11 @@ add_library(popsift SHARED target_link_libraries(popsift PUBLIC - CUDA::nvtx3 + CUDA::cudart + CUDA::nvToolsExt Threads::Threads) +# expected library to link was: "CUDA::nvtx3" but it appears to be simply nvToolsExt +# or maybe ${NVTX_LIBRARY} ??? # It is necessary to choose between shared and static, otherwise the CUDA_RUNTIME_LIBRARY target property # will not be set. @@ -58,13 +61,15 @@ set(popsift_generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") # BUILD_INTERFACE allows to include the directory with source only when target is # built in the building tree (ie, not from an install location) +# The CUDA install dir variable has changed from the old CUDA_INCLUDE_DIRS to the new CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES target_include_directories(popsift PUBLIC $ $ $ $ - ${CUDA_INCLUDE_DIRS}) + ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} + ) # EXPORTING THE LIBRARY # diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index 3b28cec8..34285bea 100755 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -73,7 +73,7 @@ add_executable(popsift-demo main.cpp pgmread.cpp pgmread.h) set_property(TARGET popsift-demo PROPERTY CXX_STANDARD 11) target_compile_options(popsift-demo PRIVATE ${PD_COMPILE_OPTIONS} ) -target_include_directories(popsift-demo PUBLIC ${PD_INCLUDE_DIRS}) +target_include_directories(popsift-demo PUBLIC PopSift::popsift ${PD_INCLUDE_DIRS}) target_compile_definitions(popsift-demo PRIVATE ${Boost_DEFINITIONS}) target_link_libraries(popsift-demo PUBLIC PopSift::popsift ${PD_LINK_LIBS}) @@ -87,7 +87,7 @@ add_executable(popsift-match match.cpp pgmread.cpp pgmread.h) set_property(TARGET popsift-match PROPERTY CXX_STANDARD 11) target_compile_options(popsift-match PRIVATE ${PD_COMPILE_OPTIONS} ) -target_include_directories(popsift-match PUBLIC ${PD_INCLUDE_DIRS}) +target_include_directories(popsift-match PUBLIC PopSift::popsift ${PD_INCLUDE_DIRS}) target_compile_definitions(popsift-match PRIVATE ${Boost_DEFINITIONS}) target_link_libraries(popsift-match PUBLIC PopSift::popsift ${PD_LINK_LIBS}) diff --git a/src/application/main.cpp b/src/application/main.cpp index a35725f0..bf1128ff 100755 --- a/src/application/main.cpp +++ b/src/application/main.cpp @@ -30,13 +30,6 @@ #endif #include "pgmread.h" -#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX) -#include -#else -#define nvtxRangePushA(a) -#define nvtxRangePop() -#endif - using namespace std; static bool print_dev_info = false; @@ -183,8 +176,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) exit( -1 ); } - nvtxRangePushA( "load and convert image - devil" ); - ilImage img; if( img.Load( inputFile.c_str() ) == false ) { cerr << "Could not load image " << inputFile << endl; @@ -200,8 +191,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) image_data = img.GetData(); - nvtxRangePop( ); // "load and convert image - devil" - job = PopSift.enqueue( w, h, image_data ); img.Clear(); @@ -209,7 +198,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) else #endif { - nvtxRangePushA( "load and convert image - pgmread" ); int w{}; int h{}; image_data = readPGMfile( inputFile, w, h ); @@ -217,8 +205,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) exit( EXIT_FAILURE ); } - nvtxRangePop( ); // "load and convert image - pgmread" - if( ! float_mode ) { // PopSift.init( w, h ); @@ -251,16 +237,10 @@ void read_job( SiftJob* job, bool really_write ) << endl; if( really_write ) { - nvtxRangePushA( "Writing features to disk" ); - std::ofstream of( "output-features.txt" ); feature_list->print( of, write_as_uchar ); } delete feature_list; - - if( really_write ) { - nvtxRangePop( ); // Writing features to disk - } } int main(int argc, char **argv) diff --git a/src/application/match.cpp b/src/application/match.cpp index 73054271..3460975d 100755 --- a/src/application/match.cpp +++ b/src/application/match.cpp @@ -30,13 +30,6 @@ #endif #include "pgmread.h" -#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX) -#include -#else -#define nvtxRangePushA(a) -#define nvtxRangePop() -#endif - using namespace std; static bool print_dev_info {false}; @@ -171,7 +164,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) unsigned char* image_data; SiftJob* job; - nvtxRangePushA( "load and convert image" ); #ifdef USE_DEVIL if( ! pgmread_loading ) { @@ -189,8 +181,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) cout << "Loading " << w << " x " << h << " image " << inputFile << endl; image_data = img.GetData(); - nvtxRangePop( ); - // PopSift.init( w, h ); job = PopSift.enqueue( w, h, image_data ); @@ -206,8 +196,6 @@ SiftJob* process_image( const string& inputFile, PopSift& PopSift ) exit( EXIT_FAILURE ); } - nvtxRangePop( ); - // PopSift.init( w, h ); job = PopSift.enqueue( w, h, image_data ); diff --git a/src/popsift/popsift.cpp b/src/popsift/popsift.cu similarity index 100% rename from src/popsift/popsift.cpp rename to src/popsift/popsift.cu