Exception: Ignis::CudaDriverError

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

Overview

Raised when CUDA Driver API operation fails

Constant Summary collapse

STATUSES =
{
  0   => :success,
  1   => :invalid_value,
  2   => :out_of_memory,
  3   => :not_initialized,
  4   => :deinitialized,
  100 => :no_device,
  101 => :invalid_device,
  200 => :invalid_image,
  201 => :invalid_context,
  209 => :no_binary_for_gpu,
  218 => :invalid_ptx,
  300 => :invalid_source,
  301 => :file_not_found,
  400 => :invalid_handle,
  500 => :not_found,
  600 => :not_ready,
  700 => :illegal_address,
  701 => :launch_out_of_resources,
  702 => :launch_timeout,
  719 => :launch_failed,
  999 => :unknown
}.freeze

Instance Attribute Summary collapse

Attributes inherited from CudaError

#cuda_code

Instance Method Summary collapse

Constructor Details

#initialize(status, context: nil) ⇒ CudaDriverError

Returns a new instance of CudaDriverError.

Parameters:

  • status (Integer)

    CUDA Driver result code

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

    Context for error



293
294
295
296
297
298
299
300
301
# File 'lib/nvruby/errors.rb', line 293

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

  message = "CUDA Driver error: #{status_name}"
  message = "#{context}: #{message}" if context

  super(message, cuda_code: status)
end

Instance Attribute Details

#contextString? (readonly)

Returns Context where error occurred.

Returns:

  • (String, nil)

    Context where error occurred



289
290
291
# File 'lib/nvruby/errors.rb', line 289

def context
  @context
end