Package solvcon :: Module scuda :: Class Scuda
[hide private]
[frames] | no frames]

Class Scuda

source code


Wrapper for CUDA library by using ctypes.

Instance Methods [hide private]
 
__init__(self, libname_cudart='libcudart.so', libname_cuda='libcuda.so')
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__del__(self) source code
 
__getattr__(self, key) source code
 
__len__(self) source code
 
download_device_properties(self)
Use CUDA runtime API to download device properties to self object.
source code
int
use_device(self, idx)
Use the specified device ID.
source code
 
use_first_valid_device(self) source code
 
alloc(self, nbytes) source code
 
free(self, gmem, do_remove=True) source code
 
memcpy(self, tgt, src) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
has_cuda() source code
Class Variables [hide private]
  cudaMemcpyHostToHost = 0
  cudaMemcpyHostToDevice = 1
  cudaMemcpyDeviceToHost = 2
  cudaMemcpyDeviceToDevice = 3
  cudaSuccess = 0
  cudaErrorMissingConfiguration = 1
  cudaErrorMemoryAllocation = 2
  cudaErrorInitializationError = 3
  cudaErrorLaunchFailure = 4
  cudaErrorPriorLaunchFailure = 5
  cudaErrorLaunchTimeout = 6
  cudaErrorLaunchOutOfResources = 7
  cudaErrorInvalidDeviceFunction = 8
  cudaErrorInvalidConfiguration = 9
  cudaErrorInvalidDevice = 10
  cudaErrorInvalidValue = 11
  cudaErrorInvalidPitchValue = 12
  cudaErrorInvalidSymbol = 13
  cudaErrorMapBufferObjectFailed = 14
  cudaErrorUnmapBufferObjectFailed = 15
  cudaErrorInvalidHostPointer = 16
  cudaErrorInvalidDevicePointer = 17
  cudaErrorInvalidTexture = 18
  cudaErrorInvalidTextureBinding = 19
  cudaErrorInvalidChannelDescriptor = 20
  cudaErrorInvalidMemcpyDirection = 21
  cudaErrorAddressOfConstant = 22
  cudaErrorTextureFetchFailed = 23
  cudaErrorTextureNotBound = 24
  cudaErrorSynchronizationError = 25
  cudaErrorInvalidFilterSetting = 26
  cudaErrorInvalidNormSetting = 27
  cudaErrorMixedDeviceExecution = 28
  cudaErrorCudartUnloading = 29
  cudaErrorUnknown = 30
  cudaErrorNotYetImplemented = 31
  cudaErrorMemoryValueTooLarge = 32
  cudaErrorInvalidResourceHandle = 33
  cudaErrorNotReady = 34
  cudaErrorInsufficientDriver = 35
  cudaErrorSetOnActiveProcess = 36
  cudaErrorInvalidSurface = 37
  cudaErrorNoDevice = 38
  cudaErrorECCUncorrectable = 39
  cudaErrorSharedObjectSymbolNotFound = 40
  cudaErrorSharedObjectInitFailed = 41
  cudaErrorUnsupportedLimit = 42
  cudaErrorDuplicateVariableName = 43
  cudaErrorDuplicateTextureName = 44
  cudaErrorDuplicateSurfaceName = 45
  cudaErrorDevicesUnavailable = 46
  cudaErrorInvalidKernelImage = 47
  cudaErrorNoKernelImageForDevice = 48
  cudaErrorIncompatibleDriverContext = 49
  cudaErrorStartupFailure = 127
  cudaErrorApiFailureBase = 10000
Instance Variables [hide private]
  _alloc_gpumem
all allocated GpuMemory objects.
  cuda
CUDA driver library.
  cudart
CUDA runtime library.
  device
the ID of device to use.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, libname_cudart='libcudart.so', libname_cuda='libcuda.so')
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • libname_cudart (str) - name of the CUDA runtime library.
  • libname_cuda (str) - name of the CUDA driver library.
Overrides: object.__init__

download_device_properties(self)

source code 

Use CUDA runtime API to download device properties to self object. Set self._device_properties.

Returns:
nothing

use_device(self, idx)

source code 

Use the specified device ID. Set self.device.

Parameters:
  • idx (int) - device ID to use.
Returns: int
the device ID.