Class: SGC::CU::CUDevicePtr
- Inherits:
-
Object
- Object
- SGC::CU::CUDevicePtr
- Defined in:
- lib/cuda/driver/deviceptr.rb
Instance Method Summary collapse
-
#free ⇒ Object
Free the allocated device memory that this pointer pointing to.
-
#offset(index) ⇒ CUDevicePtr
A pointer pointing to the memory location index (bytes) from this pointer address.
Instance Method Details
#free ⇒ Object
Free the allocated device memory that this pointer pointing to.
35 36 37 38 39 40 |
# File 'lib/cuda/driver/deviceptr.rb', line 35 def free status = API::cuMemFree(API::read_cudeviceptr(@pdevptr)) Pvt::handle_error(status, "Failed to free device memory.") API::write_cudeviceptr(@pdevptr, 0) nil end |
#offset(index) ⇒ CUDevicePtr
Returns A pointer pointing to the memory location index (bytes) from this pointer address.
46 47 48 49 50 51 |
# File 'lib/cuda/driver/deviceptr.rb', line 46 def offset(index) p = FFI::MemoryPointer.new(:CUDevicePtr) addr = API::read_cudeviceptr(@pdevptr).to_i + index API::write_cudeviceptr(p, addr) CUDevicePtr.send(:new, p) end |