Skip to content

Commit

Permalink
TagBoxArray on GPU
Browse files Browse the repository at this point in the history
TagBoxArray functions can now run on GPU now.  We no longer rely on unified
memory for TagBoxArray functions.
  • Loading branch information
WeiqunZhang committed Aug 15, 2020
1 parent ac2128c commit 9f33e26
Show file tree
Hide file tree
Showing 3 changed files with 369 additions and 224 deletions.
55 changes: 24 additions & 31 deletions Src/AmrCore/AMReX_TagBox.H
Original file line number Diff line number Diff line change
Expand Up @@ -62,41 +62,19 @@ public:

/**
* \brief Mark neighbors of every tagged cell a distance nbuff away
* only search interior for initial tagged points where nwid
* is given as the width of the bndry region.
*
* \param nbuff
* \param nwid
*/
void buffer (const IntVect& nbuf, const IntVect& nwid) noexcept;

/**
* \brief Add location of every tagged cell to IntVect array,
* starting at given location. Returns the number of
* collated points.
*
* \param ar
* \param start
*/
Long collate (Vector<IntVect>& ar, int start) const noexcept;

/**
* \brief Returns number of tagged cells in specified Box.
*
* \param bx
*/
Long numTags (const Box& bx) const noexcept;

/**
* \brief Returns total number of tagged cells in the TagBox.
*/
Long numTags () const noexcept;
void buffer (const IntVect& nbuf) noexcept;

/**
* \brief Returns Vector\<int\> of size domain.numPts() suitable for calling
* Fortran, with positions set to same value as in the TagBox
* dataPtr().
*/
//#if (__cplusplus >= 201402L)
// [[deprecated("No need to use this unless calling Fortran < 2003")]]
//#endif
Vector<int> tags () const noexcept;

/**
Expand All @@ -107,6 +85,9 @@ public:
* \param ar
* \param tilebx
*/
//#if (__cplusplus >= 201402L)
// [[deprecated("No need to use this unless calling Fortran < 2003")]]
//#endif
void get_itags(Vector<int>& ar, const Box& tilebx) const noexcept;

/**
Expand All @@ -115,6 +96,9 @@ public:
*
* \param ar
*/
//#if (__cplusplus >= 201402L)
// [[deprecated("No need to use this unless calling Fortran < 2003")]]
//#endif
void tags (const Vector<int>& ar) noexcept;

/**
Expand All @@ -123,6 +107,9 @@ public:
*
* \param ar
*/
//#if (__cplusplus >= 201402L)
// [[deprecated("No need to use this unless calling Fortran < 2003")]]
//#endif
void tags_and_untags (const Vector<int>& ar) noexcept;

/**
Expand All @@ -132,6 +119,9 @@ public:
* \param ar
* \param tilebx
*/
//#if (__cplusplus >= 201402L)
// [[deprecated("No need to use this unless calling Fortran < 2003")]]
//#endif
void tags (const Vector<int>& ar, const Box& tilebx) noexcept;

/**
Expand All @@ -141,6 +131,9 @@ public:
* \param ar
* \param tilebx
*/
//#if (__cplusplus >= 201402L)
// [[deprecated("No need to use this unless calling Fortran < 2003")]]
//#endif
void tags_and_untags (const Vector<int>& ar, const Box& tilebx) noexcept;
};

Expand Down Expand Up @@ -225,17 +218,17 @@ public:
*/
void coarsen (const IntVect& ratio);

/**
* \brief The total number of Tags in all the contained TagBoxes.
*/
Long numTags () const;

/**
* \brief Calls collate() on all contained TagBoxes.
*
* \param TheGlobalCollateSpace
*/
void collate (Vector<IntVect>& TheGlobalCollateSpace) const;

void local_collate_cpu (Vector<IntVect>& v) const;
#ifdef AMREX_USE_GPU
void local_collate_gpu (Vector<IntVect>& v) const;
#endif
};

}
Expand Down
Loading

0 comments on commit 9f33e26

Please sign in to comment.