Skip to content

Commit

Permalink
Fix some GPU warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Sep 24, 2020
1 parent b24a18c commit 7164526
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
41 changes: 20 additions & 21 deletions core/src/Cabana_ParticleGridCommunication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ information.
\param positions The particle position container, either Slice or View.
*/
template <class LocalGridType, class PositionSliceType>
KOKKOS_INLINE_FUNCTION void periodicWrap( const LocalGridType &local_grid,
PositionSliceType &positions )
void periodicWrap( const LocalGridType &local_grid,
PositionSliceType &positions )
{
using execution_space = typename PositionSliceType::execution_space;

Expand Down Expand Up @@ -482,36 +482,34 @@ void getHaloIds( const LocalGridType &local_grid, CountView &send_count,
auto sis = local_grid.sharedIndexSpace(
Cajita::Own(), Cajita::Cell(), i, j, k,
minimum_halo_width );
const int min_ind_i = sis.min( Cajita::Dim::I );
const int min_ind_j = sis.min( Cajita::Dim::J );
const int min_ind_k = sis.min( Cajita::Dim::K );
Kokkos::Array<int, 3> min_ind = {min_ind_i, min_ind_j,
min_ind_k};
const int max_ind_i = sis.max( Cajita::Dim::I ) + 1;
const int max_ind_j = sis.max( Cajita::Dim::J ) + 1;
const int max_ind_k = sis.max( Cajita::Dim::K ) + 1;
Kokkos::Array<int, 3> max_ind = {max_ind_i, max_ind_j,
max_ind_k};

Kokkos::Array<double, 3> min_coord;
Kokkos::Array<double, 3> max_coord;
local_mesh.coordinates( Cajita::Node(), min_ind.data(),
min_coord.data() );
local_mesh.coordinates( Cajita::Node(), max_ind.data(),
max_coord.data() );

auto halo_ids_func = KOKKOS_LAMBDA( const int p )
{
Kokkos::Array<double, 3> pos = {
positions( p, Cajita::Dim::I ),
positions( p, Cajita::Dim::J ),
positions( p, Cajita::Dim::K )};
Kokkos::Array<double, 3> min_coord;
Kokkos::Array<double, 3> max_coord;
Kokkos::Array<int, 3> min_ind;
Kokkos::Array<int, 3> max_ind;

// Check the if particle is both in the owned space
// and the ghosted space of this neighbor (ignore
// the current cell).

const int min_ind_i = sis.min( Cajita::Dim::I );
const int min_ind_j = sis.min( Cajita::Dim::J );
const int min_ind_k = sis.min( Cajita::Dim::K );
min_ind = {min_ind_i, min_ind_j, min_ind_k};
const int max_ind_i = sis.max( Cajita::Dim::I ) + 1;
const int max_ind_j = sis.max( Cajita::Dim::J ) + 1;
const int max_ind_k = sis.max( Cajita::Dim::K ) + 1;
max_ind = {max_ind_i, max_ind_j, max_ind_k};
local_mesh.coordinates( Cajita::Node(),
min_ind.data(),
min_coord.data() );
local_mesh.coordinates( Cajita::Node(),
max_ind.data(),
max_coord.data() );
if ( ( pos[Cajita::Dim::I] >
min_coord[Cajita::Dim::I] &&
pos[Cajita::Dim::I] <
Expand Down Expand Up @@ -672,6 +670,7 @@ struct PeriodicHalo
, _shifts( pair.second )
{
}
~PeriodicHalo() {}

auto getHalo() const { return _halo; }

Expand Down
1 change: 0 additions & 1 deletion core/unit_test/tstParticleGridCommunication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ void testHalo( const int halo_width, const int test_type )
pos_host( num_data - 1, 2 ) = center_z + shift_z;
}
int local_num_data = num_data;
std::cout << local_num_data << std::endl;

Cabana::AoSoA<DataTypes, Kokkos::HostSpace> initial( "initial", num_data );
Cabana::deep_copy( initial, data_host );
Expand Down

0 comments on commit 7164526

Please sign in to comment.