Sha256: 914619dadccf09712a3d1530db679c8175f68a63227858f16042bff207376005

Contents?: true

Size: 712 Bytes

Versions: 20

Compression:

Stored size: 712 Bytes

Contents

require_relative '../cuda'
require_relative 'compile_error'

module Cumo::CUDA
  class NVRTCProgram
    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

    def destroy
      NVRTC.nvrtcDestroyProgram(@ptr) if @ptr
    end

    def compile(options: [])
      begin
        NVRTC.nvrtcCompileProgram(@ptr, options)
        return NVRTC.nvrtcGetPTX(@ptr)
      rescue NVRTCError => e
        log = NVRTC.nvrtcGetProgramLog(@ptr)
        raise CompileError.new(log, @src, @name, options)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
cumo-0.4.3 lib/cumo/cuda/nvrtc_program.rb
cumo-0.4.2 lib/cumo/cuda/nvrtc_program.rb
cumo-0.4.1 lib/cumo/cuda/nvrtc_program.rb
cumo-0.4.0 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.5 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.4 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.3 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.2 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.1 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.0 lib/cumo/cuda/nvrtc_program.rb
cumo-0.3.0.pre1 lib/cumo/cuda/nvrtc_program.rb
cumo-0.2.5 lib/cumo/cuda/nvrtc_program.rb
cumo-0.2.4 lib/cumo/cuda/nvrtc_program.rb
cumo-0.2.3 lib/cumo/cuda/nvrtc_program.rb
cumo-0.2.2 lib/cumo/cuda/nvrtc_program.rb
cumo-0.2.1 lib/cumo/cuda/nvrtc_program.rb
cumo-0.2.0 lib/cumo/cuda/nvrtc_program.rb
cumo-0.1.2 lib/cumo/cuda/nvrtc_program.rb
cumo-0.1.1 lib/cumo/cuda/nvrtc_program.rb
cumo-0.1.0 lib/cumo/cuda/nvrtc_program.rb