Skip to content

Commit

Permalink
NVTX is no longer optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Carsten Griwodz committed Aug 12, 2024
1 parent bdd37e5 commit 6dd87af
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 60 deletions.
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_SYSTEM_NAME}-$

option(PopSift_BUILD_EXAMPLES "Build PopSift applications." ON)
option(PopSift_BUILD_DOCS "Build PopSift documentation." OFF)
option(PopSift_USE_NVTX_PROFILING "Use CUDA NVTX for profiling." OFF)
option(PopSift_ERRCHK_AFTER_KERNEL "Synchronize and check CUDA error after every kernel." OFF)
option(PopSift_USE_POSITION_INDEPENDENT_CODE "Generate position independent code." ON)
option(PopSift_USE_GRID_FILTER "Switch off grid filtering to massively reduce compile time while debugging other things." ON)
Expand Down Expand Up @@ -90,10 +89,6 @@ find_package(CUDAToolkit)
message(STATUS "CUDA Version is ${CUDAToolkit_VERSION}")
set(CUDA_VERSION ${CUDAToolkit_VERSION})

if(PopSift_USE_NVTX_PROFILING)
message(STATUS "PROFILING CPU CODE: NVTX is in use")
endif()

if(PopSift_ERRCHK_AFTER_KERNEL)
message(STATUS "Synchronizing and checking errors after every kernel call")
list(APPEND CUDA_NVCC_FLAGS "-DERRCHK_AFTER_KERNEL")
Expand Down Expand Up @@ -150,13 +145,6 @@ else()
set(DISABLE_GRID_FILTER 0)
endif()

if(PopSift_USE_NVTX_PROFILING)
# library required for NVTX profiling of the CPU
set(PopSift_USE_NVTX 1)
else()
set(PopSift_USE_NVTX 0)
endif()

add_subdirectory(src)

if(PopSift_BUILD_DOCS)
Expand Down Expand Up @@ -194,7 +182,6 @@ message(STATUS "Build Shared libs: " ${BUILD_SHARED_LIBS})
message(STATUS "Build examples: " ${PopSift_BUILD_EXAMPLES})
message(STATUS "Build documentation: " ${PopSift_BUILD_DOCS})
message(STATUS "Generate position independent code: " ${CMAKE_POSITION_INDEPENDENT_CODE})
message(STATUS "Use CUDA NVTX for profiling: " ${PopSift_USE_NVTX_PROFILING})
message(STATUS "Synchronize and check CUDA error after every kernel: " ${PopSift_ERRCHK_AFTER_KERNEL})
message(STATUS "Grid filtering: " ${PopSift_USE_GRID_FILTER})
message(STATUS "Additional warning for CUDA nvcc: " ${PopSift_NVCC_WARNINGS})
Expand Down
1 change: 0 additions & 1 deletion cmake/sift_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
#define POPSIFT_HAVE_SHFL_DOWN_SYNC() @PopSift_HAVE_SHFL_DOWN_SYNC@
#define POPSIFT_HAVE_NORMF() @PopSift_HAVE_NORMF@
#define POPSIFT_DISABLE_GRID_FILTER() @DISABLE_GRID_FILTER@
#define POPSIFT_USE_NVTX() @PopSift_USE_NVTX@

7 changes: 1 addition & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,9 @@ add_library(popsift
target_link_libraries(popsift
PUBLIC
CUDA::cudart
CUDA::nvtx3
Threads::Threads)

if(PopSift_USE_NVTX_PROFILING)
target_link_libraries(popsift
PUBLIC
CUDA::nvtx3)
endif()

set_target_properties(popsift PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(popsift PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(popsift PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
Expand Down
4 changes: 0 additions & 4 deletions src/popsift/popsift.cu
Original file line number Diff line number Diff line change
Expand Up @@ -438,18 +438,14 @@ void SiftJob::setImg( popsift::ImageBase* img )

popsift::ImageBase* SiftJob::getImg()
{
#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX)
_nvtx_id = nvtxRangeStartA( "inserting image" );
#endif
return _img;
}

void SiftJob::setFeatures( popsift::FeaturesBase* f )
{
_p.set_value( f );
#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX)
nvtxRangeEnd( _nvtx_id );
#endif
}

popsift::FeaturesHost* SiftJob::get()
Expand Down
10 changes: 1 addition & 9 deletions src/popsift/popsift.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "sift_extremum.h"

#include <cuda_runtime.h>
#include <nvtx3/nvToolsExtCuda.h>

#include <exception>
#include <future>
Expand All @@ -23,13 +24,6 @@
#include <thread>
#include <vector>

#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX)
#include <nvtx3/nvToolsExtCuda.h>
#else
#define nvtxRangeStartA(a)
#define nvtxRangeEnd(a)
#endif

/* user parameters */
namespace popsift
{
Expand All @@ -50,9 +44,7 @@ class SiftJob
unsigned char* _imageData;
popsift::ImageBase* _img;
std::exception_ptr _err;
#if POPSIFT_IS_DEFINED(POPSIFT_USE_NVTX)
nvtxRangeId_t _nvtx_id;
#endif

public:

Expand Down
9 changes: 2 additions & 7 deletions src/popsift/s_filtergrid.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
#include "sift_extremum.h"
#include "sift_pyramid.h"

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

#if ! POPSIFT_IS_DEFINED(POPSIFT_DISABLE_GRID_FILTER)

#include <nvtx3/nvToolsExtCuda.h>

#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/device_vector.h>
Expand Down
5 changes: 0 additions & 5 deletions src/popsift/s_image.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
#include <fstream>
#include <iostream>

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

using namespace std;

Expand Down
5 changes: 0 additions & 5 deletions src/popsift/s_orientation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
#include <cmath>
#include <cstdio>

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

using namespace popsift;
using namespace std;
Expand Down
5 changes: 0 additions & 5 deletions src/popsift/sift_desc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@
#include <cstdio>
#include <iostream>

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

using namespace popsift;
using namespace std;
Expand Down
5 changes: 0 additions & 5 deletions src/popsift/sift_pyramid.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@
#define mkdir(path, perm) _mkdir(path)
#endif

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

#define PYRAMID_PRINT_DEBUG 0

Expand Down

0 comments on commit 6dd87af

Please sign in to comment.