GPUOcelot
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes

executive::Device Class Reference

#include <Device.h>

Inheritance diagram for executive::Device:
Inheritance graph
[legend]
Collaboration diagram for executive::Device:
Collaboration graph
[legend]

List of all members.

Classes

class  MemoryAllocation
 An interface to a memory allocation. More...
class  Properties
 properties of a specific device More...
class  PropertiesData

Public Types

enum  AllocationType { HostAllocation, DeviceAllocation, AnyAllocation, InvalidAllocation }
 

Possible types of allocations.

More...
typedef std::vector
< MemoryAllocation * > 
MemoryAllocationVector
 Vector of memory allocations.
typedef std::vector< Device * > DeviceVector
 Vector of devices.

Public Member Functions

virtual bool checkMemoryAccess (const void *pointer, size_t size) const
 Check a memory access against all allocations.
virtual MemoryAllocationgetMemoryAllocation (const void *address, AllocationType type=DeviceAllocation) const =0
 Get the allocation containing a pointer or 0.
virtual MemoryAllocationgetGlobalAllocation (const std::string &module, const std::string &name)=0
 Get the address of a global by name.
virtual MemoryAllocationallocate (size_t size)=0
 Allocate some new dynamic memory on this device.
virtual MemoryAllocationregisterHost (void *p, size_t size, unsigned int flags=0)=0
 Register some host memory.
virtual MemoryAllocationallocateHost (size_t size, unsigned int flags=0)=0
 Make this a host memory allocation.
virtual void free (void *pointer)=0
 Free an existing non-global allocation.
virtual MemoryAllocationVector getNearbyAllocations (void *pointer) const =0
 Get nearby allocations to a pointer.
virtual MemoryAllocationVector getAllAllocations () const =0
 Get all allocations, host, global, and device.
virtual std::string nearbyAllocationsToString (void *pointer) const
 Get a string representation of nearby allocations.
virtual void clearMemory ()=0
 Wipe all memory allocations, but keep modules.
virtual void * glRegisterBuffer (unsigned int buffer, unsigned int flags)=0
 Registers an opengl buffer with a resource.
virtual void * glRegisterImage (unsigned int image, unsigned int target, unsigned int flags)=0
 Registers an opengl image with a resource.
virtual void unRegisterGraphicsResource (void *resource)=0
 Unregister a resource.
virtual void mapGraphicsResource (void **resource, int count, unsigned int stream)=0
 Map a graphics resource for use with this device.
virtual void * getPointerToMappedGraphicsResource (size_t &size, void *resource)=0
 Get a pointer to a mapped resource along with its size.
virtual void setGraphicsResourceFlags (void *resource, unsigned int flags)=0
 Change the flags of a mapped resource.
virtual void unmapGraphicsResource (void **resource, int count, unsigned int stream)=0
 Unmap a mapped resource.
virtual void load (const ir::Module *module)=0
 Load a module, must have a unique name.
virtual void unload (const std::string &name)=0
 Unload a module by name.
virtual ExecutableKernelgetKernel (const std::string &module, const std::string &kernel)=0
 Get a translated kernel from the device.
const Propertiesproperties () const
 Get the device properties.
virtual unsigned int createEvent (int flags)=0
 Create a new event.
virtual void destroyEvent (unsigned int event)=0
 Destroy an existing event.
virtual bool queryEvent (unsigned int event)=0
 Query to see if an event has been recorded (yes/no)
virtual void recordEvent (unsigned int event, unsigned int stream)=0
 Record something happening on an event.
virtual void synchronizeEvent (unsigned int event)=0
 Synchronize on an event.
virtual float getEventTime (unsigned int start, unsigned int end)=0
 Get the elapsed time in ms between two recorded events.
virtual unsigned int createStream ()=0
 Create a new stream.
virtual void destroyStream (unsigned int stream)=0
 Destroy an existing stream.
virtual bool queryStream (unsigned int stream)=0
 Query the status of an existing stream (ready/not)
virtual void synchronizeStream (unsigned int stream)=0
 Synchronize a particular stream.
virtual void setStream (unsigned int stream)=0
 Sets the current stream.
virtual void select ()
 Select this device as the current device. Only one device is allowed to be selected at any time.
virtual bool selected ()
 is this device selected?
virtual void unselect ()
 Deselect this device.
virtual void bindTexture (void *pointer, const std::string &moduleName, const std::string &textureName, const textureReference &ref, const cudaChannelFormatDesc &desc, const ir::Dim3 &size)=0
 Binds a texture to a memory allocation at a pointer.
virtual void unbindTexture (const std::string &moduleName, const std::string &textureName)=0
 unbinds anything bound to a particular texture
virtual void * getTextureReference (const std::string &moduleName, const std::string &textureName)=0
 Get's a reference to an internal texture.
int driverVersion () const
 Get the driver version.
int runtimeVersion () const
 Get the runtime version.
virtual void launch (const std::string &module, const std::string &kernel, const ir::Dim3 &grid, const ir::Dim3 &block, size_t sharedMemory, const void *argumentBlock, size_t argumentBlockSize, const trace::TraceGeneratorVector &traceGenerators=trace::TraceGeneratorVector(), const ir::ExternalFunctionSet *externals=0)=0
 helper function for launching a kernel
virtual cudaFuncAttributes getAttributes (const std::string &module, const std::string &kernel)=0
 Get the function attributes of a specific kernel.
virtual unsigned int getLastError ()=0
 Get the last error from this device.
virtual void synchronize ()=0
 Wait until all asynchronous operations have completed.
virtual void limitWorkerThreads (unsigned int threads)=0
 Limit the worker threads used by this device.
virtual void setOptimizationLevel (translator::Translator::OptimizationLevel level)=0
 Set the optimization level for kernels in this device.
 Device (unsigned int flags=0)
 Sets the device properties.
virtual ~Device ()
 Virtual destructor is required.

Static Public Member Functions

static DeviceVector createDevices (ir::Instruction::Architecture isa, unsigned int flags, int computeCapability)
 Create devices with the selected isa.
static unsigned int deviceCount (ir::Instruction::Architecture isa, int computeCapability)
 Get the total number of devices of a given ISA.

Protected Types

typedef std::map
< boost::thread::id, bool > 
ThreadMap
 The status of each thread that is connected to this device.

Protected Attributes

Properties _properties
 The properties of this device.
int _driverVersion
 The driver version.
int _runtimeVersion
 The runtime version.
unsigned int _flags
 Device flags.
ThreadMap _selected
 Threads that have selected this device.
boost::mutex _mutex
 Locking object for updating selected threads.

Detailed Description

Interface for controlling an Ocelot device


Member Typedef Documentation

typedef std::vector< Device* > executive::Device::DeviceVector

Vector of devices.

Vector of memory allocations.

typedef std::map<boost::thread::id, bool> executive::Device::ThreadMap [protected]

The status of each thread that is connected to this device.


Member Enumeration Documentation

Possible types of allocations.

Enumerator:
HostAllocation 
DeviceAllocation 
AnyAllocation 
InvalidAllocation 

Constructor & Destructor Documentation

executive::Device::Device ( unsigned int  flags = 0)

Sets the device properties.

executive::Device::~Device ( ) [virtual]

Virtual destructor is required.


Member Function Documentation

virtual MemoryAllocation* executive::Device::allocate ( size_t  size) [pure virtual]
virtual MemoryAllocation* executive::Device::allocateHost ( size_t  size,
unsigned int  flags = 0 
) [pure virtual]
virtual void executive::Device::bindTexture ( void *  pointer,
const std::string &  moduleName,
const std::string &  textureName,
const textureReference ref,
const cudaChannelFormatDesc desc,
const ir::Dim3 size 
) [pure virtual]
bool executive::Device::checkMemoryAccess ( const void *  pointer,
size_t  size 
) const [virtual]

Check a memory access against all allocations.

Reimplemented in executive::PassThroughDevice.

virtual void executive::Device::clearMemory ( ) [pure virtual]
executive::DeviceVector executive::Device::createDevices ( ir::Instruction::Architecture  isa,
unsigned int  flags,
int  computeCapability 
) [static]

Create devices with the selected isa.

virtual unsigned int executive::Device::createEvent ( int  flags) [pure virtual]
virtual unsigned int executive::Device::createStream ( ) [pure virtual]
virtual void executive::Device::destroyEvent ( unsigned int  event) [pure virtual]
virtual void executive::Device::destroyStream ( unsigned int  stream) [pure virtual]
unsigned int executive::Device::deviceCount ( ir::Instruction::Architecture  isa,
int  computeCapability 
) [static]

Get the total number of devices of a given ISA.

int executive::Device::driverVersion ( ) const

Get the driver version.

virtual void executive::Device::free ( void *  pointer) [pure virtual]
virtual MemoryAllocationVector executive::Device::getAllAllocations ( ) const [pure virtual]
virtual cudaFuncAttributes executive::Device::getAttributes ( const std::string &  module,
const std::string &  kernel 
) [pure virtual]
virtual float executive::Device::getEventTime ( unsigned int  start,
unsigned int  end 
) [pure virtual]

Get the elapsed time in ms between two recorded events.

Implemented in executive::ATIGPUDevice, executive::EmulatorDevice, executive::NVIDIAGPUDevice, executive::PassThroughDevice, and executive::RemoteDevice.

virtual MemoryAllocation* executive::Device::getGlobalAllocation ( const std::string &  module,
const std::string &  name 
) [pure virtual]
virtual ExecutableKernel* executive::Device::getKernel ( const std::string &  module,
const std::string &  kernel 
) [pure virtual]
virtual unsigned int executive::Device::getLastError ( ) [pure virtual]
virtual MemoryAllocation* executive::Device::getMemoryAllocation ( const void *  address,
AllocationType  type = DeviceAllocation 
) const [pure virtual]
virtual MemoryAllocationVector executive::Device::getNearbyAllocations ( void *  pointer) const [pure virtual]
virtual void* executive::Device::getPointerToMappedGraphicsResource ( size_t size,
void *  resource 
) [pure virtual]

Get a pointer to a mapped resource along with its size.

Implemented in executive::ATIGPUDevice, executive::EmulatorDevice, executive::NVIDIAGPUDevice, executive::PassThroughDevice, and executive::RemoteDevice.

virtual void* executive::Device::getTextureReference ( const std::string &  moduleName,
const std::string &  textureName 
) [pure virtual]
virtual void* executive::Device::glRegisterBuffer ( unsigned int  buffer,
unsigned int  flags 
) [pure virtual]
virtual void* executive::Device::glRegisterImage ( unsigned int  image,
unsigned int  target,
unsigned int  flags 
) [pure virtual]
virtual void executive::Device::launch ( const std::string &  module,
const std::string &  kernel,
const ir::Dim3 grid,
const ir::Dim3 block,
size_t  sharedMemory,
const void *  argumentBlock,
size_t  argumentBlockSize,
const trace::TraceGeneratorVector traceGenerators = trace::TraceGeneratorVector(),
const ir::ExternalFunctionSet externals = 0 
) [pure virtual]

helper function for launching a kernel

Parameters:
modulemodule name
kernelkernel name
gridgrid dimensions
blockblock dimensions
sharedMemoryshared memory size
argumentBlockarray of bytes for argument memory
argumentBlockSizenumber of bytes in argument memory
traceGeneratorsvector of trace generators to add and remove from kernel

Implemented in executive::ATIGPUDevice, executive::EmulatorDevice, executive::MulticoreCPUDevice, executive::NVIDIAGPUDevice, executive::PassThroughDevice, and executive::RemoteDevice.

virtual void executive::Device::limitWorkerThreads ( unsigned int  threads) [pure virtual]
virtual void executive::Device::load ( const ir::Module module) [pure virtual]
virtual void executive::Device::mapGraphicsResource ( void **  resource,
int  count,
unsigned int  stream 
) [pure virtual]
std::string executive::Device::nearbyAllocationsToString ( void *  pointer) const [virtual]

Get a string representation of nearby allocations.

Reimplemented in executive::PassThroughDevice.

const executive::Device::Properties & executive::Device::properties ( ) const

Get the device properties.

virtual bool executive::Device::queryEvent ( unsigned int  event) [pure virtual]
virtual bool executive::Device::queryStream ( unsigned int  stream) [pure virtual]
virtual void executive::Device::recordEvent ( unsigned int  event,
unsigned int  stream 
) [pure virtual]
virtual MemoryAllocation* executive::Device::registerHost ( void *  p,
size_t  size,
unsigned int  flags = 0 
) [pure virtual]
int executive::Device::runtimeVersion ( ) const

Get the runtime version.

void executive::Device::select ( ) [virtual]

Select this device as the current device. Only one device is allowed to be selected at any time.

Reimplemented in executive::NVIDIAGPUDevice, executive::PassThroughDevice, and executive::RemoteDevice.

bool executive::Device::selected ( ) [virtual]

is this device selected?

Reimplemented in executive::PassThroughDevice.

virtual void executive::Device::setGraphicsResourceFlags ( void *  resource,
unsigned int  flags 
) [pure virtual]
virtual void executive::Device::setOptimizationLevel ( translator::Translator::OptimizationLevel  level) [pure virtual]
virtual void executive::Device::setStream ( unsigned int  stream) [pure virtual]
virtual void executive::Device::synchronize ( ) [pure virtual]

Wait until all asynchronous operations have completed.

Implemented in executive::ATIGPUDevice, executive::EmulatorDevice, executive::NVIDIAGPUDevice, executive::PassThroughDevice, and executive::RemoteDevice.

virtual void executive::Device::synchronizeEvent ( unsigned int  event) [pure virtual]
virtual void executive::Device::synchronizeStream ( unsigned int  stream) [pure virtual]
virtual void executive::Device::unbindTexture ( const std::string &  moduleName,
const std::string &  textureName 
) [pure virtual]
virtual void executive::Device::unload ( const std::string &  name) [pure virtual]
virtual void executive::Device::unmapGraphicsResource ( void **  resource,
int  count,
unsigned int  stream 
) [pure virtual]
virtual void executive::Device::unRegisterGraphicsResource ( void *  resource) [pure virtual]
void executive::Device::unselect ( ) [virtual]

Member Data Documentation

The driver version.

unsigned int executive::Device::_flags [protected]

Device flags.

boost::mutex executive::Device::_mutex [protected]

Locking object for updating selected threads.

The properties of this device.

The runtime version.

Threads that have selected this device.

Reimplemented in executive::EmulatorDevice.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines