Skip to content

Commit

Permalink
Restore DeviceMemory constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
csbnw authored Aug 14, 2024
1 parent dff5959 commit 6b13265
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/cudawrappers/cu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@ class DeviceMemory : public Wrapper<CUdeviceptr> {
checkCudaCall(cuMemHostGetDevicePointer(&_obj, hostMemory, 0));
}

explicit DeviceMemory(const DeviceMemory &other, size_t offset, size_t size)
: _size(size) {
if (size + offset > other.size()) {
throw Error(CUDA_ERROR_INVALID_VALUE);
}
_obj = reinterpret_cast<CUdeviceptr>(reinterpret_cast<char *>(other._obj) +
offset);

void memset(unsigned char value, size_t size) {
checkCudaCall(cuMemsetD8(_obj, value, size));
}
Expand Down

0 comments on commit 6b13265

Please sign in to comment.