Cuda::Symbol< Type, Dim > Class Template Reference

Representation of CUDA symbol. More...

#include <symbol.hpp>

Inheritance diagram for Cuda::Symbol< Type, Dim >:

Inheritance graph
[legend]
Collaboration diagram for Cuda::Symbol< Type, Dim >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Symbol ()
 Default constructor.
 Symbol (const Size< Dim > &_size, Type *_symbol)
 Constructor.
 Symbol (const Layout< Type, Dim > &layout, Type *_symbol)
 Constructor.
const Type & getSymbol () const
 Get the symbol address.
const Type * getBuffer () const
 Get the address of the data in global memory space.
Type * getBuffer ()
 Get the address of the data in global memory space.


Detailed Description

template<class Type, unsigned Dim>
class Cuda::Symbol< Type, Dim >

Representation of CUDA symbol.

CUDA symbols are used to access data residing in global or constant memory space declared as global variables in CUDA code (__constant__ or __device__ qualifiers at file scope). The CUDA templates implementation can be used for C-style arrays like this:

__constant__ float data[1024];
Cuda::Symbol<float, 1> symbol(Cuda::Size<1>(1024), data);

Size and data type of the array and the symbol must match.


Constructor & Destructor Documentation

template<class Type, unsigned Dim>
Cuda::Symbol< Type, Dim >::Symbol ( const Size< Dim > &  _size,
Type *  _symbol 
) [inline]

Constructor.

Parameters:
_size requested size of symbol
_symbol symbol in global or constant memory space The constructor fails if the size of the symbol as reported by CUDA doesn't match the requested size passed as an argument.

template<class Type, unsigned Dim>
Cuda::Symbol< Type, Dim >::Symbol ( const Layout< Type, Dim > &  layout,
Type *  _symbol 
) [inline]

Constructor.

Parameters:
layout requested layout of symbol
_symbol symbol in global or constant memory space The constructor fails if the size of the symbol as reported by CUDA doesn't match the requested layout passed as an argument.


Member Function Documentation

template<class Type, unsigned Dim>
const Type& Cuda::Symbol< Type, Dim >::getSymbol (  )  const [inline]

Get the symbol address.

This is not the address of the data in device memory, but a reference to the data structure in host memory representing the symbol. You will never need this unless you directly call CUDA functions related to symbols.

Returns:
reference to symbol data structure in host memory

template<class Type, unsigned Dim>
const Type* Cuda::Symbol< Type, Dim >::getBuffer (  )  const [inline]

Get the address of the data in global memory space.

This creates a runtime error when called for data residing in constant memory space.

Returns:
address of data in global memory space

template<class Type, unsigned Dim>
Type* Cuda::Symbol< Type, Dim >::getBuffer (  )  [inline]

Get the address of the data in global memory space.

This creates a runtime error when called for data residing in constant memory space.

Returns:
address of data in global memory space


The documentation for this class was generated from the following file:

Generated on Sun Sep 13 00:55:21 2009 for cudatemplates by  doxygen 1.5.6