8 #ifndef MULTI_WRAPPER_IMPLS_POINTER_HPP_ 9 #define MULTI_WRAPPER_IMPLS_POINTER_HPP_ 11 #include "../pointer.hpp" 12 #include "../device.hpp" 13 #include "../context.hpp" 25 #if CUDA_VERSION >= 9020 26 return pointer::detail_::get_attribute<CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL>(ptr);
28 auto context_handle = context_handle_of(ptr);
29 return context::detail_::get_device_id(context_handle);
52 #if CUDA_VERSION >= 9020 54 CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,
55 CU_POINTER_ATTRIBUTE_CONTEXT
59 void* value_ptrs[] = {&device_id, &context_handle};
60 pointer::detail_::get_attributes(2, attributes, value_ptrs, ptr);
62 auto context_handle = pointer::detail_::context_handle_of(ptr);
63 auto device_id = context::detail_::get_device_id(context_handle);
65 return context::wrap(device_id, context_handle);
72 #endif // MULTI_WRAPPER_IMPLS_POINTER_HPP_ Wrapper class for a CUDA context.
Definition: context.hpp:244
Definitions and functionality wrapping CUDA APIs.
Definition: array.hpp:22
CUcontext handle_t
Raw CUDA driver handle for a context; see {context_t}.
Definition: types.hpp:878
CUdevice id_t
Numeric ID of a CUDA device used by the CUDA Runtime API.
Definition: types.hpp:850
context_t context_of(const void *ptr)
Obtain (a non-owning wrapper for) the CUDA context with which a memory address is associated (e...
Definition: pointer.hpp:50
CUpointer_attribute attribute_t
Raw CUDA driver choice type for attributes of pointers.
Definition: types.hpp:662
device_t device() const
Returns a proxy for the device into whose global memory the pointer points.
Definition: pointer.hpp:39
device_t get(id_t id)
Returns a proxy for the CUDA device with a given id.
Definition: device.hpp:837
context_t context() const
Returns a proxy for the context in which the memory area, into which the pointer points, was allocated.
Definition: pointer.hpp:45
Wrapper class for a CUDA device.
Definition: device.hpp:135