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

Fix doxygen warnings in utilities/ headers #10974

Merged
merged 6 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
16 changes: 15 additions & 1 deletion cpp/include/cudf/utilities/bit.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@

namespace cudf {
namespace detail {
// @cond
// Work around a bug in NVRTC that fails to compile assert() in constexpr
// functions (fixed after CUDA 11.0)
#if defined __GNUC__
Expand All @@ -40,7 +41,14 @@ namespace detail {
#else
#define constexpr_assert(CHECK) (LIKELY(CHECK) ? void(0) : [] { assert(!#CHECK); }())
#endif
// @endcond

/**
* @brief Returns the number of bits the given type can hold.
*
* @tparam T The type to query
* @return `sizeof(T)` in bits
*/
template <typename T>
constexpr CUDF_HOST_DEVICE inline std::size_t size_in_bits()
{
Expand All @@ -57,6 +65,9 @@ constexpr CUDF_HOST_DEVICE inline std::size_t size_in_bits()

/**
* @brief Returns the index of the word containing the specified bit.
*
* @param bit_index The index of the bit to query
* @return The index of the word containing the specified bit
*/
constexpr CUDF_HOST_DEVICE inline size_type word_index(size_type bit_index)
{
Expand All @@ -65,6 +76,9 @@ constexpr CUDF_HOST_DEVICE inline size_type word_index(size_type bit_index)

/**
* @brief Returns the position within a word of the specified bit.
*
* @param bit_index The index of the bit to query
* @return The position within a word of the specified bit
*/
constexpr CUDF_HOST_DEVICE inline size_type intra_word_index(size_type bit_index)
{
Expand Down
32 changes: 27 additions & 5 deletions cpp/include/cudf/utilities/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,18 @@ namespace cudf {
* CUDF_EXPECTS macro.
*/
struct logic_error : public std::logic_error {
/**
* @brief Constructs a logic_error with the error message.
*
* @param message Message to be associated with the exception
*/
logic_error(char const* const message) : std::logic_error(message) {}

/**
* @brief Construct a new logic error object with error message
*
* @param message Message to be associated with the exception
*/
logic_error(std::string const& message) : std::logic_error(message) {}

// TODO Add an error code member? This would be useful for translating an
Expand All @@ -46,27 +56,38 @@ struct logic_error : public std::logic_error {
* @brief Exception thrown when a CUDA error is encountered.
*/
struct cuda_error : public std::runtime_error {
/**
* @brief Construct a new cuda error object with error message and code.
*
* @param message Error message
* @param error CUDA error code
*/
cuda_error(std::string const& message, cudaError_t const& error)
: std::runtime_error(message), _cudaError(error)
{
}

public:
/**
* @brief Returns the CUDA error code associated with the exception.
*
* @return CUDA error code
*/
cudaError_t error_code() const { return _cudaError; }

protected:
cudaError_t _cudaError;
cudaError_t _cudaError; //!< CUDA error code
};

struct fatal_cuda_error : public cuda_error {
using cuda_error::cuda_error;
using cuda_error::cuda_error; // Inherit constructors
};
/** @} */

} // namespace cudf

#define STRINGIFY_DETAIL(x) #x
#define CUDF_STRINGIFY(x) STRINGIFY_DETAIL(x)
#define STRINGIFY_DETAIL(x) #x ///< Stringify a macro argument
#define CUDF_STRINGIFY(x) STRINGIFY_DETAIL(x) ///< Stringify a macro argument

/**
* @addtogroup utility_error
Expand Down Expand Up @@ -111,7 +132,7 @@ struct fatal_cuda_error : public cuda_error {

namespace cudf {
namespace detail {

// @cond
inline void throw_cuda_error(cudaError_t error, const char* file, unsigned int line)
{
// Calls cudaGetLastError twice. It is nearly certain that a fatal error occurred if the second
Expand All @@ -129,6 +150,7 @@ inline void throw_cuda_error(cudaError_t error, const char* file, unsigned int l
throw cuda_error{msg, error};
}
}
// @endcond
} // namespace detail
} // namespace cudf

Expand Down
Loading