Class: Cumo::CUDA::LinkState

Inherits:
Object
  • Object
show all
Defined in:
lib/cumo/cuda/link_state.rb

Overview

CUDA link state.

Instance Method Summary collapse

Constructor Details

#initializeLinkState

Returns a new instance of LinkState.



6
7
8
9
10
11
12
13
14
15
# File 'lib/cumo/cuda/link_state.rb', line 6

def initialize
  @ptr = Driver.cuLinkCreate
  if block_given?
    begin
      yield(self)
    ensure
      destroy
    end
  end
end

Instance Method Details

#add_ptr_data(data, name) ⇒ Object



23
24
25
# File 'lib/cumo/cuda/link_state.rb', line 23

def add_ptr_data(data, name)
  Driver.cuLinkAddData(@ptr, Driver::CU_JIT_INPUT_PTX, data, name)
end

#completeObject



27
28
29
# File 'lib/cumo/cuda/link_state.rb', line 27

def complete
  cubin = Driver.cuLinkComplete(@ptr)
end

#destroyObject



17
18
19
20
21
# File 'lib/cumo/cuda/link_state.rb', line 17

def destroy
  return unless @ptr
  Driver.cuLinkDestroy(@ptr)
  @ptr = nil
end