Module: SGC::Cuda::CudaMemory

Defined in:
lib/cuda/runtime/memory.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) memcpy(dst_ptr, src_ptr, nbytes, memcpy_kind)

Copy nbytes from the memory at src_ptr to the memory at dst_ptr.



76
77
78
79
# File 'lib/cuda/runtime/memory.rb', line 76

def memcpy(dst_ptr, src_ptr, nbytes, memcpy_kind)
    status = API::cudaMemcpy(dst_ptr.ptr, src_ptr.ptr, nbytes, memcpy_kind)
    Pvt::handle_error(status, "Failed to copy memory.")
end

+ (Object) memcpy_dtod(dst_ptr, src_ptr, nbytes)

Copy nbytes from the device memory at src_ptr to the device memory at dst_ptr.



102
103
104
# File 'lib/cuda/runtime/memory.rb', line 102

def memcpy_dtod(dst_ptr, src_ptr, nbytes)
    memcpy(dst_ptr, src_ptr, nbytes, :DEVICE_TO_DEVICE)
end

+ (Object) memcpy_dtoh(dst_ptr, src_ptr, nbytes)

Copy nbytes from the device memory at src_ptr to the host memory at dst_ptr.



96
97
98
# File 'lib/cuda/runtime/memory.rb', line 96

def memcpy_dtoh(dst_ptr, src_ptr, nbytes)
    memcpy(dst_ptr, src_ptr, nbytes, :DEVICE_TO_HOST)
end

+ (Object) memcpy_htod(dst_ptr, src_ptr, nbytes)

Copy nbytes from the host memory at src_ptr to the device memory at dst_ptr.



90
91
92
# File 'lib/cuda/runtime/memory.rb', line 90

def memcpy_htod(dst_ptr, src_ptr, nbytes)
    memcpy(dst_ptr, src_ptr, nbytes, :HOST_TO_DEVICE)
end

+ (Object) memcpy_htoh(dst_ptr, src_ptr, nbytes)

Copy nbytes from the host memory at src_ptr to the host memory at dst_ptr.



84
85
86
# File 'lib/cuda/runtime/memory.rb', line 84

def memcpy_htoh(dst_ptr, src_ptr, nbytes)
    memcpy(dst_ptr, src_ptr, nbytes, :HOST_TO_HOST)
end