Exception: Cumo::CUDA::CompileError

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

Instance Method Summary collapse

Constructor Details

#initialize(msg, source, name, options) ⇒ CompileError

Returns a new instance of CompileError.



5
6
7
8
9
10
# File 'lib/cumo/cuda/compile_error.rb', line 5

def initialize(msg, source, name, options)
  @msg = msg
  @source = source
  @name = name
  @options = options
end

Instance Method Details

#dump(io) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cumo/cuda/compile_error.rb', line 20

def dump(io)
  lines = @source.split("\n")
  digits = Math.log10(lines.size).floor + 1
  linum_fmt = "%0#{digits}d "
  io.puts("NVRTC compilation error: #{@msg}")
  io.puts("-----")
  io.puts("Name: #{@name}")
  io.puts("Options: #{@options.join(' ')}")
  io.puts("CUDA source:")
  lines.each.with_index do |line, i|
    io.puts(linum_fmt.sprintf(i + 1) << line.rstrip)
  end
  io.puts("-----")
  io.flush
end

#messageObject



12
13
14
# File 'lib/cumo/cuda/compile_error.rb', line 12

def message
  @msg
end

#to_sObject



16
17
18
# File 'lib/cumo/cuda/compile_error.rb', line 16

def to_s
  @msg
end