Exception: Ignis::NVRTCError

Inherits:
CudaError show all
Defined in:
lib/nvruby/errors.rb

Overview

Raised when NVRTC compilation fails

Constant Summary collapse

STATUSES =
{
  0  => :success,
  1  => :out_of_memory,
  2  => :program_creation_failure,
  3  => :invalid_input,
  4  => :invalid_program,
  5  => :invalid_option,
  6  => :compilation_error,
  7  => :builtin_operation_failure,
  8  => :no_name_expressions_after_compilation,
  9  => :no_lowered_names_before_compilation,
  10 => :name_expression_not_valid,
  11 => :internal_error
}.freeze

Instance Attribute Summary collapse

Attributes inherited from CudaError

#cuda_code

Instance Method Summary collapse

Constructor Details

#initialize(status, compilation_log: nil, context: nil) ⇒ NVRTCError

Returns a new instance of NVRTCError.

Parameters:

  • status (Integer)

    NVRTC result code

  • compilation_log (String, nil) (defaults to: nil)

    Compilation error log

  • context (String, nil) (defaults to: nil)

    Context for error



249
250
251
252
253
254
255
256
257
258
259
# File 'lib/nvruby/errors.rb', line 249

def initialize(status, compilation_log: nil, context: nil)
  @compilation_log = compilation_log
  @context = context
  status_name = STATUSES[status] || :unknown

  message = "NVRTC error: #{status_name}"
  message = "#{context}: #{message}" if context
  message = "#{message}\nCompilation log:\n#{compilation_log}" if compilation_log && !compilation_log.empty?

  super(message, cuda_code: status)
end

Instance Attribute Details

#compilation_logString? (readonly)

Returns Compilation log with error details.

Returns:

  • (String, nil)

    Compilation log with error details



241
242
243
# File 'lib/nvruby/errors.rb', line 241

def compilation_log
  @compilation_log
end

#contextString? (readonly)

Returns Context where error occurred.

Returns:

  • (String, nil)

    Context where error occurred



244
245
246
# File 'lib/nvruby/errors.rb', line 244

def context
  @context
end