Example #1
0
        ExchangeIntern(DeviceBuffer<TYPE, DIM>& source, GridLayout<DIM> memoryLayout, DataSpace<DIM> guardingCells, uint32_t exchange,
                       uint32_t communicationTag, uint32_t area = BORDER, bool sizeOnDevice = false) :
        Exchange<TYPE, DIM>(exchange, communicationTag), deviceDoubleBuffer(NULL)
        {

            assert(!guardingCells.isOneDimensionGreaterThan(memoryLayout.getGuard()));

            DataSpace<DIM> tmp_size = memoryLayout.getDataSpaceWithoutGuarding();
            /*
              DataSpace<DIM> tmp_size = memoryLayout.getDataSpace() - memoryLayout.getGuard() -
                      memoryLayout.getGuard(); delete on each side 2xguard*/

            DataSpace<DIM> exchangeDimensions = exchangeTypeToDim(exchange);

            for (uint32_t dim = 0; dim < DIM; dim++)
            {
                if (DIM > dim && exchangeDimensions[dim] == 1)
                    tmp_size[dim] = guardingCells[dim];
            }

            /*This is only a pointer to other device data
             */
            this->deviceBuffer = new DeviceBufferIntern<TYPE, DIM > (source, tmp_size,
                                                                     exchangeTypeToOffset(exchange, memoryLayout, guardingCells, area),
                                                                     sizeOnDevice);
            if (DIM > DIM1)
            {
                /*create double buffer on gpu for faster memory transfers*/
                this->deviceDoubleBuffer = new DeviceBufferIntern<TYPE, DIM > (tmp_size, false, true);
            }

            this->hostBuffer = new HostBufferIntern<TYPE, DIM > (tmp_size);
        }
Example #2
0
 /*! Check if my DataSpace is greater than other.
  * @param other other DataSpace
  * @return true if my DataSpace (one dimension) is greater than other, false otherwise
  */
 virtual bool isMyDataSpaceGreaterThan(DataSpace<DIM> other)
 {
     return !other.isOneDimensionGreaterThan(data_space);
 }