Skip to content

Commit

Permalink
adapted dependency settings to new CUDA variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Carsten Griwodz committed Jul 26, 2024
1 parent 3e7894f commit 1a829b8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${popsift_generated_dir}>
$<BUILD_INTERFACE:${popsift_generated_dir}/popsift>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
${CUDA_INCLUDE_DIRS})
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
)

# EXPORTING THE LIBRARY
#
Expand Down
4 changes: 2 additions & 2 deletions src/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand All @@ -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})

Expand Down
20 changes: 0 additions & 20 deletions src/application/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
#endif
#include "pgmread.h"

#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX)
#include <nvToolsExtCuda.h>
#else
#define nvtxRangePushA(a)
#define nvtxRangePop()
#endif

using namespace std;

static bool print_dev_info = false;
Expand Down Expand Up @@ -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;
Expand All @@ -200,25 +191,20 @@ 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();
}
else
#endif
{
nvtxRangePushA( "load and convert image - pgmread" );
int w{};
int h{};
image_data = readPGMfile( inputFile, w, h );
if( image_data == nullptr ) {
exit( EXIT_FAILURE );
}

nvtxRangePop( ); // "load and convert image - pgmread"

if( ! float_mode )
{
// PopSift.init( w, h );
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 0 additions & 12 deletions src/application/match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
#endif
#include "pgmread.h"

#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX)
#include <nvToolsExtCuda.h>
#else
#define nvtxRangePushA(a)
#define nvtxRangePop()
#endif

using namespace std;

static bool print_dev_info {false};
Expand Down Expand Up @@ -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 )
{
Expand All @@ -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 );

Expand All @@ -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 );

Expand Down
File renamed without changes.

0 comments on commit 1a829b8

Please sign in to comment.