Module: Ignis::Collective::P2PBindings
- Extended by:
- FFI::Library
- Defined in:
- lib/nvruby/collective/p2p_bindings.rb
Overview
P2P-specific CUDA bindings for multi-GPU communication Extends RuntimeAPI with peer-to-peer and IPC functions
Defined Under Namespace
Classes: CudaIpcMemHandle
Constant Summary collapse
- P2P_ATTR_PERFORMANCE_RANK =
P2P attribute constants (cudaDeviceP2PAttr)
1- P2P_ATTR_ACCESS_SUPPORTED =
2- P2P_ATTR_NATIVE_ATOMIC_SUPPORTED =
3- P2P_ATTR_CUDA_ARRAY_ACCESS_SUPPORTED =
4- IPC_MEM_LAZY_ENABLE_PEER_ACCESS =
IPC memory flags
1- IPC_HANDLE_SIZE =
CUDA IPC memory handle size (64 bytes)
64
Class Method Summary collapse
-
.check_status!(status, context = "P2P operation") ⇒ void
Check CUDA status and raise error if not success.
-
.ensure_loaded! ⇒ void
Ensure P2P bindings are loaded.
Class Method Details
.check_status!(status, context = "P2P operation") ⇒ void
This method returns an undefined value.
Check CUDA status and raise error if not success
111 112 113 114 115 116 117 118 |
# File 'lib/nvruby/collective/p2p_bindings.rb', line 111 def self.check_status!(status, context = "P2P operation") return if status.zero? CUDA::RuntimeAPI.ensure_loaded! error_name = CUDA::RuntimeAPI.cudaGetErrorName(status) error_string = CUDA::RuntimeAPI.cudaGetErrorString(status) raise CudaRuntimeError.new("#{context}: #{error_name} - #{error_string}", cuda_code: status) end |
.ensure_loaded! ⇒ void
This method returns an undefined value.
Ensure P2P bindings are loaded
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nvruby/collective/p2p_bindings.rb', line 32 def ensure_loaded! return if @loaded CUDA::LibraryLoader.ensure_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 ffi_lib dll_path if dll_path attach_p2p_functions! @loaded = true end |