Example #1
0
 /**
  * constructor
  * @param dataSpace DataSpace describing the size of the HostBufferIntern to be created
  */
 HostBufferIntern(DataSpace<DIM> dataSpace) throw (std::bad_alloc) :
 HostBuffer<TYPE, DIM>(dataSpace),
 pointer(NULL),ownPointer(true)
 {
     CUDA_CHECK(cudaMallocHost(&pointer, dataSpace.getElementCount() * sizeof (TYPE)));
     reset(false);
 }
 virtual void init()
 {
  //   __startAtomicTransaction(__getTransactionEvent());
     size_t current_size = host->getCurrentSize();
     DataSpace<DIM> hostCurrentSize = host->getCurrentDataSpace(current_size);
     if (host->is1D() && device->is1D())
         fastCopy(host->getPointer(), device->getPointer(), hostCurrentSize.getElementCount());
     else
         copy(hostCurrentSize);
     device->setCurrentSize(current_size);
     this->activate();
  //   __setTransactionEvent(__endTransaction());
 }
Example #3
0
 /**
  * constructor
  * @param dataSpace description of spread of any dimension
  */
 Buffer(DataSpace<DIM> dataSpace) :
 data_space(dataSpace),data1D(true)
 {
     CUDA_CHECK(cudaMallocHost(&current_size, sizeof (size_t)));
     *current_size = dataSpace.getElementCount();
 }