#include <symbol.hpp>
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. |
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.
Cuda::Symbol< Type, Dim >::Symbol | ( | const Size< Dim > & | _size, | |
Type * | _symbol | |||
) | [inline] |
Constructor.
_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. |
Cuda::Symbol< Type, Dim >::Symbol | ( | const Layout< Type, Dim > & | layout, | |
Type * | _symbol | |||
) | [inline] |
Constructor.
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. |
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.
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.
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.