-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2bcbb8
commit 9cd7e1a
Showing
8 changed files
with
55 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <cudf/utilities/export.hpp> | ||
|
||
#include <cuda_runtime_api.h> | ||
|
||
namespace CUDF_EXPORT cudf { | ||
|
||
namespace detail { | ||
/** | ||
* @brief RAII struct to wrap a cuda event and ensure its proper destruction. | ||
*/ | ||
struct cuda_event { | ||
cuda_event(); | ||
virtual ~cuda_event(); | ||
|
||
// Moveable but not copyable. | ||
cuda_event(const cuda_event&) = delete; | ||
cuda_event& operator=(const cuda_event&) = delete; | ||
|
||
cuda_event(cuda_event&&) = default; | ||
cuda_event& operator=(cuda_event&&) = default; | ||
|
||
operator cudaEvent_t() const; | ||
|
||
private: | ||
cudaEvent_t e_; | ||
}; | ||
} // namespace detail | ||
|
||
} // namespace CUDF_EXPORT cudf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <cudf/utilities/cuda_event.hpp> | ||
#include <cudf/utilities/error.hpp> | ||
|
||
#include <rmm/detail/error.hpp> | ||
|
||
namespace cudf::detail { | ||
|
||
cuda_event::cuda_event() { CUDF_CUDA_TRY(cudaEventCreateWithFlags(&e_, cudaEventDisableTiming)); } | ||
|
||
cuda_event::~cuda_event() { RMM_ASSERT_CUDA_SUCCESS(cudaEventDestroy(e_)); } | ||
|
||
cuda_event::operator cudaEvent_t() const { return e_; } | ||
|
||
} // namespace cudf::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters