mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 17:15:39 +08:00
Add GetDeviceAddress method to CudaContext.
This commit is contained in:
1 parent
8081786402
commit
df8656f800
2 files changed
+13
No files matched your search
@@ -343,5 +343,12 @@ void* CudaContext::handle() const { return impl_->context_handle(); }
|
||||
|
||||
int CudaContext::device_number() const { return impl_->device().device_num; }
|
||||
|
||||
Status CudaContext::GetDeviceAddress(uintptr_t addr, uintptr_t* devaddr) {
|
||||
ContextSaver set_temporary(reinterpret_cast<CUcontext>(handle()));
|
||||
CU_RETURN_NOT_OK(
|
||||
cuPointerGetAttribute(devaddr, CU_POINTER_ATTRIBUTE_DEVICE_POINTER, addr));
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
} // namespace cuda
|
||||
} // namespace arrow
|
||||
@@ -119,6 +119,12 @@ class ARROW_EXPORT CudaContext : public std::enable_shared_from_this<CudaContext
|
||||
/// \brief Return device number
|
||||
int device_number() const;
|
||||
|
||||
/// \brief Get device address for the context
|
||||
/// \param[in] addr device address
|
||||
/// \param[out] devaddr the device address for the context
|
||||
/// \return Status
|
||||
Status GetDeviceAddress(uintptr_t addr, uintptr_t* devaddr);
|
||||
|
||||
private:
|
||||
CudaContext();
|
||||
|
||||
|
||||
Reference in new issue
Block a user