#include "Image/Dims.H"
#include "Util/Alloc.H"
#include "Util/TypeTraits.H"
#include "Util/log.H"
#include "rutz/atomic.h"
#include <cstring>
#include <new>
#include "CUDA/CudaAlloc.H"
#include "CUDA/CudaDevices.H"
Go to the source code of this file.
Classes | |
class | ArrayData< T > |
Implements a ref-counted 2-D array, should only be used via ArrayHandle. More... | |
class | ArrayHandle< T > |
This class provides ref-counting and copy-on-write for ArrayData's. More... | |
struct | ArrayHelper< T, isTrivial > |
This is a helper template struct for ArrayData's constructors. More... | |
struct | ArrayHelper< T, true > |
Specialization of ArrayHelper for builtin/trivial types. More... | |
Defines | |
#define | CUDA_HOST_DEVICE_NUM -1 |
Device id for the host, to distinguish from CUDA devices. | |
Enumerations | |
enum | StoragePolicy { MAKE_OWN_COPY, WRITE_THRU } |
Specifies what to do with the T* used to init an ArrayData. More... | |
enum | InitPolicy { ZEROS, NO_INIT } |
Specifies how to initialize the pixels of a new image. More... | |
enum | MemoryPolicy { GLOBAL_DEVICE_MEMORY, TEXTURE_DEVICE_MEMORY, HOST_MEMORY } |
Specifies where on a particular device the memory is stored. More... | |
Functions | |
void * | wrap_invt_allocate (size_t user_nbytes, const MemoryPolicy mp, const int dev) |
Function to wrap use of invt_allocate to allow for CUDA memory policies. | |
void | wrap_invt_deallocate (void *mem, const MemoryPolicy mp, const int dev, const size_t nBytes) |
Function to wrap use of invt_deallocate to allow for CUDA memory policies. | |
void | check_acquisition (StoragePolicy s, int count) throw () |
The guts of the 2D ref-counted copy-on-write array implementation
Definition in file ArrayData.H.
#define CUDA_HOST_DEVICE_NUM -1 |
Device id for the host, to distinguish from CUDA devices.
Definition at line 93 of file ArrayData.H.
Referenced by ArrayData< T >::clone(), and CudaImage< T >::CudaImage().
enum InitPolicy |
Specifies how to initialize the pixels of a new image.
ZEROS |
All elements are initialized to the pixel type's zero or default value. |
NO_INIT |
Pixels are only minimally initialized. For trivial types, this means the pixel values are not initialized at all; for non-trivial user-defined types, this means each pixel is copy-constructed from the type's default value. |
Definition at line 68 of file ArrayData.H.
enum MemoryPolicy |
Specifies where on a particular device the memory is stored.
GLOBAL_DEVICE_MEMORY |
On GPU, global (to a particular set of kernels on a single device). |
TEXTURE_DEVICE_MEMORY |
On GPU, located in texture memory. |
HOST_MEMORY |
On CPU/Host. |
Definition at line 82 of file ArrayData.H.
enum StoragePolicy |
Specifies what to do with the T* used to init an ArrayData.
MAKE_OWN_COPY |
Make an initial copy of the data, then copy-on-write as usual. |
WRITE_THRU |
Borrow the data, with write-through. Writing to the Array will modify the T[] that initialized it. |
Definition at line 57 of file ArrayData.H.
void* wrap_invt_allocate | ( | size_t | user_nbytes, | |
const MemoryPolicy | mp, | |||
const int | dev | |||
) | [inline] |
Function to wrap use of invt_allocate to allow for CUDA memory policies.
Definition at line 97 of file ArrayData.H.
References GLOBAL_DEVICE_MEMORY, HOST_MEMORY, invt_allocate(), and TEXTURE_DEVICE_MEMORY.
void wrap_invt_deallocate | ( | void * | mem, | |
const MemoryPolicy | mp, | |||
const int | dev, | |||
const size_t | nBytes | |||
) | [inline] |
Function to wrap use of invt_deallocate to allow for CUDA memory policies.
Definition at line 120 of file ArrayData.H.
References GLOBAL_DEVICE_MEMORY, HOST_MEMORY, invt_deallocate(), and TEXTURE_DEVICE_MEMORY.
Referenced by ArrayData< T >::~ArrayData().