Skip to content
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

Forward-merge branch-24.10 into branch-24.12 #487

Merged
merged 1 commit into from
Oct 3, 2024
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
5 changes: 4 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ if(KvikIO_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if(KvikIO_BUILD_TESTS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(CUDAToolkit_FOUND
AND KvikIO_BUILD_TESTS
AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME
)
include(cmake/thirdparty/get_gtest.cmake)

# include CTest module -- automatically calls enable_testing()
Expand Down
10 changes: 10 additions & 0 deletions cpp/include/kvikio/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <tuple>
#include <type_traits>

#ifdef KVIKIO_CUDA_FOUND
#include <nvtx3/nvtx3.hpp>
#endif

#include <kvikio/error.hpp>
#include <kvikio/shim/cuda.hpp>
Expand Down Expand Up @@ -291,6 +293,7 @@ inline bool is_future_done(const T& future)
return future.wait_for(std::chrono::seconds(0)) != std::future_status::timeout;
}

#ifdef KVIKIO_CUDA_FOUND
/**
* @brief Tag type for libkvikio's NVTX domain.
*/
Expand All @@ -309,6 +312,7 @@ struct libkvikio_domain {
} \
}
#define GET_KVIKIO_NVTX_FUNC_RANGE_MACRO(_1, _2, NAME, ...) NAME
#endif

/**
* @brief Convenience macro for generating an NVTX range in the `libkvikio` domain
Expand All @@ -329,9 +333,15 @@ struct libkvikio_domain {
* }
* ```
*/
#ifdef KVIKIO_CUDA_FOUND
#define KVIKIO_NVTX_FUNC_RANGE(...) \
GET_KVIKIO_NVTX_FUNC_RANGE_MACRO( \
__VA_ARGS__, KVIKIO_NVTX_FUNC_RANGE_2, KVIKIO_NVTX_FUNC_RANGE_1) \
(__VA_ARGS__)
#else
#define KVIKIO_NVTX_FUNC_RANGE(...) \
do { \
} while (0)
#endif

} // namespace kvikio
Loading