From 5c2bd39b9909cf5eeb725fc9cddef5eb930531f4 Mon Sep 17 00:00:00 2001 From: Yu Fang Date: Wed, 3 Aug 2022 23:34:45 -0700 Subject: [PATCH] Fix view --- .../src/Cajita_ParticleDynamicPartitioner.hpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/cajita/src/Cajita_ParticleDynamicPartitioner.hpp b/cajita/src/Cajita_ParticleDynamicPartitioner.hpp index 2fea96604..2719f428f 100644 --- a/cajita/src/Cajita_ParticleDynamicPartitioner.hpp +++ b/cajita/src/Cajita_ParticleDynamicPartitioner.hpp @@ -86,22 +86,23 @@ class ParticleDynamicPartitionerWorkloadMeasurer auto dx_copy = dx; auto cell_bits_per_tile_dim_copy = cell_bits_per_tile_dim; + auto view_copy = view; Kokkos::parallel_for( "compute_local_workload_parpos", Kokkos::RangePolicy( 0, particle_num ), KOKKOS_LAMBDA( const int i ) { - int ti = - static_cast( - ( view( i, 0 ) - lower_corner[0] ) / dx_copy - 0.5 ) >> - cell_bits_per_tile_dim_copy; - int tj = - static_cast( - ( view( i, 1 ) - lower_corner[1] ) / dx_copy - 0.5 ) >> - cell_bits_per_tile_dim_copy; - int tz = - static_cast( - ( view( i, 2 ) - lower_corner[2] ) / dx_copy - 0.5 ) >> - cell_bits_per_tile_dim_copy; + int ti = static_cast( + ( view_copy( i, 0 ) - lower_corner[0] ) / dx_copy - + 0.5 ) >> + cell_bits_per_tile_dim_copy; + int tj = static_cast( + ( view_copy( i, 1 ) - lower_corner[1] ) / dx_copy - + 0.5 ) >> + cell_bits_per_tile_dim_copy; + int tz = static_cast( + ( view_copy( i, 2 ) - lower_corner[2] ) / dx_copy - + 0.5 ) >> + cell_bits_per_tile_dim_copy; Kokkos::atomic_increment( &workload( ti + 1, tj + 1, tz + 1 ) ); } ); Kokkos::fence();