Module: Ignis::CUDA::GraphBindings
- Extended by:
- FFI::Library
- Defined in:
- lib/nvruby/cuda/graph_bindings.rb
Overview
CUDA Graphs FFI bindings Provides stream capture and graph execution for reduced launch overhead
Constant Summary collapse
- CUDA_STREAM_CAPTURE_MODE_GLOBAL =
CUDA Stream Capture Mode
0- CUDA_STREAM_CAPTURE_MODE_THREAD_LOCAL =
1- CUDA_STREAM_CAPTURE_MODE_RELAXED =
2- CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH =
CUDA Graph Instantiate Flags
1- CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD =
2- CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH =
4- CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY =
8- CUDA_GRAPH_NODE_TYPE_KERNEL =
CUDA Graph Node Types
0- CUDA_GRAPH_NODE_TYPE_MEMCPY =
1- CUDA_GRAPH_NODE_TYPE_MEMSET =
2- CUDA_GRAPH_NODE_TYPE_HOST =
3- CUDA_GRAPH_NODE_TYPE_GRAPH =
4- CUDA_GRAPH_NODE_TYPE_EMPTY =
5- CUDA_GRAPH_NODE_TYPE_WAIT_EVENT =
6- CUDA_GRAPH_NODE_TYPE_EVENT_RECORD =
7
Class Method Summary collapse
-
.check_status!(status, context = "CUDA Graph operation") ⇒ void
Check status and raise error if not success.
-
.ensure_loaded! ⇒ void
Ensure CUDA runtime is loaded and graph functions are attached.
Class Method Details
.check_status!(status, context = "CUDA Graph operation") ⇒ void
This method returns an undefined value.
Check status and raise error if not success
68 69 70 71 72 |
# File 'lib/nvruby/cuda/graph_bindings.rb', line 68 def check_status!(status, context = "CUDA Graph operation") return if status.zero? raise CudaRuntimeError.new("#{context} failed", cuda_code: status) end |
.ensure_loaded! ⇒ void
This method returns an undefined value.
Ensure CUDA runtime is loaded and graph functions are attached
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/nvruby/cuda/graph_bindings.rb', line 39 def ensure_loaded! @mutex.synchronize do return if @loaded LibraryLoader.load_library(:cuda_runtime) # Resolve cudart path per platform dll_path = if defined?(Ignis::Platform) Ignis::Platform.cudart_path elsif RUBY_PLATFORM.match?(/mswin|mingw|cygwin/i) cuda_bin = Ignis.configuration.cuda_bin_path rescue nil cuda_bin ? Dir.glob(File.join(cuda_bin, 'cudart64_*.dll')).max : 'cudart64_130' else 'libcudart.so.13' end raise LibraryNotFoundError, 'cudart' unless dll_path ffi_lib dll_path attach_graph_functions! @loaded = true end end |