Module: SGC::Cuda::API

Extended by:
FFI::Library
Defined in:
lib/cuda/runtime/ffi-cuda.rb

Defined Under Namespace

Classes: CudaChannelFormatDesc, CudaDeviceProp, CudaExtent, CudaFunctionAttributes, CudaMemcpy3DParms, CudaMemcpy3DPeerParms, CudaPitchedPtr, CudaPointerAttributes, CudaPos, Dim3, Enum, SurfaceReference, TextureReference

Constant Summary collapse

CudaError =
enum(
    :SUCCESS, 0,
    :ERROR_MISSING_CONFIGURATION, 1,
    :ERROR_MEMORY_ALLOCATION, 2,
    :ERROR_INITIALIZATION_ERROR, 3,
    :ERROR_LAUNCH_FAILURE, 4,
    :ERROR_PRIOR_LAUNCH_FAILURE, 5, # Deprecated.
    :ERROR_LAUNCH_TIMEOUT, 6,
    :ERROR_LAUNCH_OUT_OF_RESOURCES, 7,
    :ERROR_INVALID_DEVICE_FUNCTION, 8,
    :ERROR_INVALID_CONFIGURATION, 9,
    :ERROR_INVALID_DEVICE, 10,
    :ERROR_INVALID_VALUE, 11,
    :ERROR_INVALID_PITCH_VALUE, 12,
    :ERROR_INVALID_SYMBOL, 13,
    :ERROR_MAP_BUFFER_OBJECT_FAILED, 14,
    :ERROR_UNMAP_BUFFER_OBJECT_FAILED, 15,
    :ERROR_INVALID_HOST_POINTER, 16,
    :ERROR_INVALID_DEVICE_POINTER, 17,
    :ERROR_INVALID_TEXTURE, 18,
    :ERROR_INVALID_TEXTURE_BINDING, 19,
    :ERROR_INVALID_CHANNEL_DESCRIPTOR, 20,
    :ERROR_INVALID_MEMCPY_DIRECTION, 21,
    :ERROR_ADDRESS_OF_CONSTANT, 22, # Deprecated.
    :ERROR_TEXTURE_FETCH_FAILED, 23, # Deprecated.
    :ERROR_TEXTURE_NOT_BOUND, 24, # Deprecated.
    :ERROR_SYNCHRONIZATION_ERROR, 25, # Deprecated.
    :ERROR_INVALID_FILTER_SETTING, 26,
    :ERROR_INVALID_NORM_SETTING, 27,
    :ERROR_MIXED_DEVICE_EXECUTION, 28, # Deprecated.
    :ERROR_CUDART_UNLOADING, 29, # Deprecated.
    :ERROR_UNKNOWN, 30,
    :ERROR_NOT_YET_IMPLEMENTED, 31,
    :ERROR_MEMORY_VALUE_TOO_LARGE, 32, # Deprecated.
    :ERROR_INVALID_RESOURCE_HANDLE, 33,
    :ERROR_NOT_READY, 34,
    :ERROR_INSUFFICIENT_DRIVER, 35,
    :ERROR_SET_ON_ACTIVE_PROCESS, 36,
    :ERROR_INVALID_SURFACE, 37,
    :ERROR_NO_DEVICE, 38,
    :ERROR_ECC_UNCORRECTABLE, 39,
    :ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, 40,
    :ERROR_SHARED_OBJECT_INIT_FAILED, 41,
    :ERROR_UNSUPPORTED_LIMIT, 42,
    :ERROR_DUPLICATE_VARIABLE_NAME, 43,
    :ERROR_DUPLICATE_TEXTURE_NAME, 44,
    :ERROR_DUPLICATE_SURFACE_NAME, 45,
    :ERROR_DEVICES_UNAVAILABLE, 46,
    :ERROR_INVALID_KERNEL_IMAGE, 47,
    :ERROR_NO_KERNEL_IMAGE_FOR_DEVICE, 48,
    :ERROR_INCOMPATIBLE_DRIVER_CONTEXT, 49,
    :ERROR_PEER_ACCESS_ALREADY_ENABLED, 50,
    :ERROR_PEER_ACCESS_NOT_ENABLED, 51,
    :ERROR_DEVICE_ALREADY_IN_USE, 54,
    :ERROR_PROFILER_DISABLED, 55,
    :ERROR_PROFILER_NOT_INITIALIZED, 56,
    :ERROR_PROFILER_ALREADY_STARTED, 57,
    :ERROR_PROFILER_ALREADY_STOPPED, 58,
    :ERROR_STARTUP_FAILURE, 0x7F,
    :ERROR_API_FAILURE_BASE, 10000,
)
CudaDeviceFlags =
enum(
    :SCHEDULE_AUTO, 0,
    :SCHEDULE_SPIN, 1,
    :SCHEDULE_YIELD, 2,
    :SCHEDULE_BLOCKING_SYNC, 4,
    :BLOCKING_SYNC, 4, # Deprecated. Use :SCHEDULE_BLOCKING_SYNC.
    :MAP_HOST, 8,
    :LMEM_RESIZE_TO_MAX, 16,
)
CudaEventFlags =
enum(
    :DEFAULT, 0,
    :BLOCKING_SYNC, 1,
    :DISABLE_TIMING, 2,
)
CudaHostAllocFlags =
enum(
    :DEFAULT, 0,
    :PORTABLE, 1,
    :MAPPED, 2,
    :WRITE_COMBINED, 4,
)
CudaHostRegisterFlags =
enum(
    :DEFAULT, 0,
    :PORTABLE, 1,
    :MAPPED, 2,
)
CudaArrayFlags =
enum(
    :DEFAULT, 0x00,
    :LAYERED, 0x01,
    :SURFACE_LOAD_STORE, 0x02,
)
CudaMemoryType =
enum(
    :Host, 1,
    :DEVICE, 2,
)
CudaMemcpyKind =
enum(
    :HOST_TO_HOST, 0,
    :HOST_TO_DEVICE, 1,
    :DEVICE_TO_HOST, 2,
    :DEVICE_TO_DEVICE, 3,
    :DEFAULT, 4,
)
CudaChannelFormatKind =
enum(
    :SIGNED, 0,
    :UNSIGNED, 1,
    :FLOAT, 2,
    :None,3,
)
CudaFunctionCache =
enum(
    :PREFER_NONE, 0,
    :PREFER_SHARED, 1,
    :PREFER_L1, 2,
)
CudaLimit =
enum(
    :STACK_SIZE, 0x00,
    :PRINTF_FIFO_SIZE, 0x01,
    :MALLOC_HEAP_SIZE, 0x02,
)
CudaOutputMode =
enum(
    :KEY_VALUE_PAIR, 0x00,
    :CSV, 0x01,
)
CudaComputeMode =
enum(
    :DEFAULT, 0,
    :EXCLUSIVE, 1,
    :PROHIBITED, 2,
    :EXCLUSIVE_PROCESS, 3,
)
CudaSurfaceBoundaryMode =
enum(
    :ZERO, 0,
    :CLAMP, 1,
    :TRAP, 2,
)
CudaSurfaceFormatMode =
enum(
    :FORCED, 0,
    :AUTO, 1,
)
CudaTextureAddressMode =
enum(
    :WRAP, 0,
    :CLAMP, 1,
    :MIRROR, 2,
    :BORDER, 3,
)
CudaTextureFilterMode =
enum(
    :POINT, 0,
    :LINEAR, 1,
)
CudaTextureReadMode =
enum(
    :ELEMENT_TYPE, 0,
    :NORMALIZED_FLOAT, 1,
)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.make_cudaExtent(w, h, d) ⇒ Object

attach_function :make_cudaExtent, [:size_t, :size_t, :size_t], CudaExtent attach_function :make_cudaPitchedPtr, [:pointer, :size_t, :size_t, :size_t], CudaPitchedPtr attach_function :make_cudaPos, [:size_t, :size_t, :size_t], CudaPos



514
515
516
517
518
# File 'lib/cuda/runtime/ffi-cuda.rb', line 514

def make_cudaExtent(w, h, d)
    e = CudaExtent.new
    e[:width], e[:height], e[:depth] = w, h, d
    e
end

.make_cudaPitchedPtr(d, p, xsz, ysz) ⇒ Object



521
522
523
524
525
526
527
528
# File 'lib/cuda/runtime/ffi-cuda.rb', line 521

def make_cudaPitchedPtr(d, p, xsz, ysz)
    s = CudaPitchedPtr.new
    s[:ptr] = d
    s[:pitch] = p
    s[:xsize] = xsz
    s[:ysize] = ysz
    s
end

.make_cudaPos(x, y, z) ⇒ Object



531
532
533
534
535
536
537
# File 'lib/cuda/runtime/ffi-cuda.rb', line 531

def make_cudaPos(x, y, z)
    p = CudaPos.new
    p[:x] = x
    p[:y] = y
    p[:z] = z
    p
end

.read_cudaeventObject



241
# File 'lib/cuda/runtime/ffi-cuda.rb', line 241

def read_pointer(ptr); ptr.read_pointer; end

.read_cudastreamObject



240
# File 'lib/cuda/runtime/ffi-cuda.rb', line 240

def read_pointer(ptr); ptr.read_pointer; end

.read_enumObject



239
# File 'lib/cuda/runtime/ffi-cuda.rb', line 239

def read_int(ptr); ptr.read_int; end

.read_size_tObject



238
# File 'lib/cuda/runtime/ffi-cuda.rb', line 238

def read_long(ptr); ptr.read_long; end

.write_cudaeventObject



246
# File 'lib/cuda/runtime/ffi-cuda.rb', line 246

def write_pointer(ptr, value); ptr.write_long(value.to_i); end

.write_cudastreamObject



245
# File 'lib/cuda/runtime/ffi-cuda.rb', line 245

def write_pointer(ptr, value); ptr.write_long(value.to_i); end

.write_enumObject



244
# File 'lib/cuda/runtime/ffi-cuda.rb', line 244

def write_int(ptr, value); ptr.write_int(value); end

.write_size_tObject



243
# File 'lib/cuda/runtime/ffi-cuda.rb', line 243

def write_long(ptr, value); ptr.write_long(value); end

Instance Method Details

#read_int(ptr) ⇒ Object Also known as: read_enum



230
# File 'lib/cuda/runtime/ffi-cuda.rb', line 230

def read_int(ptr); ptr.read_int; end

#read_long(ptr) ⇒ Object Also known as: read_size_t



231
# File 'lib/cuda/runtime/ffi-cuda.rb', line 231

def read_long(ptr); ptr.read_long; end

#read_pointer(ptr) ⇒ Object Also known as: read_cudastream, read_cudaevent



232
# File 'lib/cuda/runtime/ffi-cuda.rb', line 232

def read_pointer(ptr); ptr.read_pointer; end

#write_int(ptr, value) ⇒ Object Also known as: write_enum



234
# File 'lib/cuda/runtime/ffi-cuda.rb', line 234

def write_int(ptr, value); ptr.write_int(value); end

#write_long(ptr, value) ⇒ Object Also known as: write_size_t



235
# File 'lib/cuda/runtime/ffi-cuda.rb', line 235

def write_long(ptr, value); ptr.write_long(value); end

#write_pointer(ptr, value) ⇒ Object Also known as: write_cudastream, write_cudaevent



236
# File 'lib/cuda/runtime/ffi-cuda.rb', line 236

def write_pointer(ptr, value); ptr.write_long(value.to_i); end