#ifndef __AMSCURARRAY_HPP__ #define __AMSCURARRAY_HPP__ namespace amscuda { //Cuda ragged array class template class curarray { public: int device; curarray* devptr; //pointer to mirror class on the device int Narrays; //number of arrays int *N; //dimension of each array T** hostarrayptrs; //pointers to each array on the host - null on the device T** devarrayptrs; //pointers to each array on the device //the double pointer is a host pointer to device pointers on the host class //for the device class, only the second set of arrays is in use //the constructor and destructor set all pointers to NULL, they // do *not* manage memory. This is done with curarray_new and curarray_delete __device__ __host__ curarray(); __device__ __host__ ~curarray(); __host__ int push(); __host__ int pull(); //__device__ int dev_resizearray(int arraynum, int arraysize); __host__ int resizearray(int arraynum, int arraysize); // I may want a way to resize arrays on the device without pushing/pulling all the array contents }; template int curarray_new(curarray** ptr, int Narrays); template int curarray_delete(curarray** ptr); template int curarray_device_new(curarray *hostptr); template int curarray_device_delete(curarray *hostptr); template int curarray_push(curarray *hostptr); template int curarray_pull(curarray *hostptr); //template int curarray_host_fillall(curarray *hostptr, const T &val); //template int curarray_device_fillall(curarray *hostptr, const T &val); //template __host__ int curarray_deletearray(curarray *hostptr, int arrayindex); //template __device__ int curarray_dev_deletearray(curarray *devptr, int arrayindex); //template __host__ int curarray_allocarray(curarray *hostptr, int arrayindex, int size); //template __device__ int curarray_dev_allocarray(curarray *devptr, int arrayindex, int size); void test_amscurarray1(); }; #include #endif