Class: Cumo::CUDA::NVRTCProgram
- Inherits:
-
Object
- Object
- Cumo::CUDA::NVRTCProgram
- Defined in:
- lib/cumo/cuda/nvrtc_program.rb
Instance Method Summary collapse
- #compile(options: []) ⇒ Object
- #destroy ⇒ Object
-
#initialize(src, name: "default_program", headers: [], include_names: []) ⇒ NVRTCProgram
constructor
A new instance of NVRTCProgram.
Constructor Details
#initialize(src, name: "default_program", headers: [], include_names: []) ⇒ NVRTCProgram
Returns a new instance of NVRTCProgram.
7 8 9 10 11 12 |
# File 'lib/cumo/cuda/nvrtc_program.rb', line 7 def initialize(src, name: "default_program", headers: [], include_names: []) @ptr = nil @src = src # should be UTF-8 @name = name # should be UTF-8 @ptr = NVRTC.nvrtcCreateProgram(src, name, headers, include_names) end |
Instance Method Details
#compile(options: []) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/cumo/cuda/nvrtc_program.rb', line 18 def compile(options: []) begin NVRTC.nvrtcCompileProgram(@ptr, ) return NVRTC.nvrtcGetPTX(@ptr) rescue NVRTCError log = NVRTC.nvrtcGetProgramLog(@ptr) raise CompileError.new(log, @src, @name, ) end end |
#destroy ⇒ Object
14 15 16 |
# File 'lib/cumo/cuda/nvrtc_program.rb', line 14 def destroy NVRTC.nvrtcDestroyProgram(@ptr) if @ptr end |