EinsumsPy/GPU/PyGPUView.hpp#
Defined in header EinsumsPy/GPU/PyGPUView.hpp.
See Overview for a list of names and headers that are part of the public Einsums API.
-
namespace einsums
-
namespace python#
Typedefs
-
class PyGPUView#
- #include <PyGPUView.hpp>
Makes the data in a Python buffer object available to the GPU.
Public Functions
-
PyGPUView(pybind11::buffer &buffer, detail::PyViewMode mode = detail::COPY)#
Creates a view of the given buffer object.
This makes the data in the buffer available to the GPU with the given mode.
- Parameters:
buffer – The buffer to make available.
mode – The mode for making the data available. Can not be detail::DEVICE_TENSOR.
-
template<typename T, size_t Rank>
inline PyGPUView(DeviceTensor<T, Rank> &tensor)# Creates a view of the given tensor.
This makes the data in the DeviceTensor available to be used alongside Python buffers.
- Parameters:
tensor – The tensor to convert.
-
template<typename T, size_t Rank>
inline PyGPUView(DeviceTensorView<T, Rank> &tensor)# Creates a view of the given tensor.
This makes the data in the DeviceTensor available to be used alongside Python buffers.
- Parameters:
tensor – The tensor to convert.
-
template<typename T, size_t Rank>
inline PyGPUView(DeviceTensor<T, Rank> const &tensor)# Creates a view of the given tensor.
This makes the data in the DeviceTensor available to be used alongside Python buffers.
- Parameters:
tensor – The tensor to convert.
-
template<typename T, size_t Rank>
inline PyGPUView(DeviceTensorView<T, Rank> const &tensor)# Creates a view of the given tensor.
This makes the data in the DeviceTensor available to be used alongside Python buffers.
- Parameters:
tensor – The tensor to convert.
-
~PyGPUView()#
-
void *host_data() noexcept#
Get the pointer to the host data.
-
void const *host_data() const noexcept#
Get the pointer to the host data.
-
void *dev_data() noexcept#
Get the pointer to the device data.
-
void const *dev_data() const noexcept#
Get the pointer to the device data.
-
size_t dim(int i) const#
Get the dimension of the given axis. Supports negative indexing.
-
std::vector<size_t> strides() const noexcept#
Get the strides of each axis in bytes.
This is different from how the C++ side works, which is in elements. To get the equivalent C++ stride, you must divide by PyGPUView::itemsize().
-
size_t stride(int i) const#
Get the strides of the given axis in bytes. Supports negative indexing.
This is different from how the C++ side works, which is in elements. To get the equivalent C++ stride, you must divide by PyGPUView::itemsize().
-
std::string fmt_spec() const noexcept#
Get the format specifier for the data type.
This is specified by pybind11. For instance, floats are “f”, doubles are “d”, and long doubles are “g”. Complex types are “Z” followed by their underlying type.
-
size_t *gpu_dims() noexcept#
Get the device pointer to the array of the dimensions.
-
size_t const *gpu_dims() const noexcept#
Get the device pointer to the array of the dimensions.
-
size_t *gpu_strides() noexcept#
Get the device pointer to the array of the strides in bytes.
-
size_t const *gpu_strides() const noexcept#
Get the device pointer to the array of the strides in bytes.
-
size_t rank() const noexcept#
Get the rank.
-
size_t size() const noexcept#
Get the number of elements.
-
size_t itemsize() const noexcept#
Get the size of each item.
-
void update_H2D()#
Synchronize the data by sending the host data to the device.
This only does something when the mode is set to detail::COPY. Otherwise, it does nothing.
-
void update_D2H()#
Synchronize the data by sending the device data to the host.
This only does something when the mode is set to detail::COPY. Otherwise, it does nothing.
-
PyGPUView(pybind11::buffer &buffer, detail::PyViewMode mode = detail::COPY)#
-
class PyGPUView#
-
namespace python#