Class: Cumo::CUDA::Module
- Inherits:
-
Object
- Object
- Cumo::CUDA::Module
- Defined in:
- lib/cumo/cuda/module.rb
Overview
CUDA kernel module.
Instance Method Summary collapse
- #get_function(name) ⇒ Object
- #get_global_var(name) ⇒ Object
-
#initialize ⇒ Module
constructor
A new instance of Module.
- #load(cubin) ⇒ Object
- #load_file(fname) ⇒ Object
- #unload ⇒ Object
Constructor Details
#initialize ⇒ Module
Returns a new instance of Module.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cumo/cuda/module.rb', line 6 def initialize @ptr = nil if block_given? begin yield(self) ensure unload end end end |
Instance Method Details
#get_function(name) ⇒ Object
35 36 37 |
# File 'lib/cumo/cuda/module.rb', line 35 def get_function(name) # Function(name) end |
#get_global_var(name) ⇒ Object
31 32 33 |
# File 'lib/cumo/cuda/module.rb', line 31 def get_global_var(name) Driver.cuModuleGetGlobal(@ptr, name) end |
#load(cubin) ⇒ Object
27 28 29 |
# File 'lib/cumo/cuda/module.rb', line 27 def load(cubin) @ptr = Driver.cuModuleLoadData(cubin) end |
#load_file(fname) ⇒ Object
23 24 25 |
# File 'lib/cumo/cuda/module.rb', line 23 def load_file(fname) @ptr = Driver.cuModuleLoad(fname) end |
#unload ⇒ Object
17 18 19 20 21 |
# File 'lib/cumo/cuda/module.rb', line 17 def unload return unless @ptr Driver.cuModuleUnload(@ptr) @ptr = nil end |