Commit 027c4d39 authored by jstark's avatar jstark
Browse files

Added local changes on Sparse grid gpu.

parent 1c916041
Pipeline #3663 failed with stages
in 1 minute and 58 seconds
......@@ -18,6 +18,8 @@ class BlockMapGpu
{
private:
typedef BlockTypeOf<AggregateBlockT, 0> BlockT0;
bool is_new;
#ifdef SE_CLASS1
......@@ -108,13 +110,19 @@ public:
*
*/
template<unsigned int p>
auto insertBlockFlush(size_t blockId) -> decltype(blockMap.insertFlush(blockId).template get<p>())
auto insertBlockFlush(size_t blockId) -> decltype(blockMap.insertFlush(blockId,is_new).template get<p>())
{
typedef BlockTypeOf<AggregateBlockT, p> BlockT;
auto aggregate = blockMap.insertFlush(blockId);
auto &block = aggregate.template get<p>();
auto aggregate = blockMap.insertFlush(blockId,is_new);
auto &block = aggregate.template get<p>();
if (is_new == true)
{
for (int i = 0 ; i < BlockT::size ; i++)
{aggregate.template get<pMask>()[i] = 0;}
}
return block;
}
......@@ -125,9 +133,18 @@ public:
* \return a reference to the block data
*
*/
auto insertBlockFlush(size_t blockId) -> decltype(blockMap.insertFlush(blockId))
auto insertBlockFlush(size_t blockId) -> decltype(blockMap.insertFlush(blockId,is_new))
{
return blockMap.insertFlush(blockId);
typedef BlockTypeOf<AggregateBlockT, 0> BlockT;
auto b = blockMap.insertFlush(blockId,is_new);
if (is_new == true)
{
for (int i = 0 ; i < BlockT::size ; i++)
{b.template get<pMask>()[i] = 0;}
}
return b;
}
BlockMapGpu_ker<AggregateInternalT, indexT, layout_base> toKernel()
......
......@@ -2520,7 +2520,33 @@ public:
{
return gridGeometry.BlockLinId(blockCoord);
}
/*! \brief Insert the point on host side and flush directly
*
* First you have to move everything on host with deviceToHost, insertFlush and than move to GPU again
*
* \param grid point where to insert
*
* \return a reference to the data to fill
*
*
*/
template<unsigned int p>
auto insertFlush(const sparse_grid_gpu_index<self> &coord) -> ScalarTypeOf<AggregateBlockT, p> &
{
auto & indexBuffer = BlockMapGpu<AggregateInternalT, threadBlockSize, indexT, layout_base>::blockMap.getIndexBuffer();
indexT block_id = indexBuffer.template get<0>(coord.get_cnk_pos_id());
indexT local_id = coord.get_data_id();
typedef BlockMapGpu<AggregateInternalT, threadBlockSize, indexT, layout_base> BMG;
auto block_data = this->insertBlockFlush(block_id);
block_data.template get<BMG::pMask>()[local_id] = 1;
return block_data.template get<p>()[local_id];
}
/*! \brief Insert the point on host side and flush directly
*
* First you have to move everything on host with deviceToHost, insertFlush and than move to GPU again
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment