Skip to content

Commit

Permalink
Merge pull request #609 from streeve/particle_init_cajita
Browse files Browse the repository at this point in the history
Grid-based particle initialization and random init rewrite
  • Loading branch information
streeve authored Sep 1, 2023
2 parents 1579e88 + a3763e5 commit fbbbb0a
Show file tree
Hide file tree
Showing 16 changed files with 1,411 additions and 109 deletions.
6 changes: 3 additions & 3 deletions benchmark/cajita/Cajita_SparseMapPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
positions[p] = position_type(
Kokkos::ViewAllocateWithoutInitializing( "positions" ),
problem_sizes[p] );
Cabana::createRandomParticles( positions[p], problem_sizes[p],
global_low_corner[0],
global_high_corner[0] );
Cabana::createParticles( Cabana::InitRandom(), positions[p],
problem_sizes[p], global_low_corner,
global_high_corner );
}
// Number of runs in the test loops.
int num_run = 10;
Expand Down
6 changes: 3 additions & 3 deletions benchmark/cajita/Cajita_SparsePartitionerPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ void performanceTest( ParticleWorkloadTag, std::ostream& stream, MPI_Comm comm,
positions[p] = position_type(
Kokkos::ViewAllocateWithoutInitializing( "positions" ),
problem_sizes[p] );
Cabana::createRandomParticles( positions[p], problem_sizes[p],
global_low_corner[0],
global_high_corner[0] );
Cabana::createParticles( Cabana::InitRandom(), positions[p],
problem_sizes[p], global_low_corner,
global_high_corner );
}

for ( int c = 0; c < num_cells_per_dim_size; ++c )
Expand Down
5 changes: 4 additions & 1 deletion benchmark/core/Cabana_LinkedCellPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
// Define problem grid.
x_min[p] = 0.0;
x_max[p] = 1.3 * std::pow( num_p, 1.0 / 3.0 );
double grid_min[3] = { x_min[p], x_min[p], x_min[p] };
double grid_max[3] = { x_max[p], x_max[p], x_max[p] };
aosoas[p].resize( num_p );
auto x = Cabana::slice<0>( aosoas[p], "position" );
Cabana::createRandomParticles( x, x.size(), x_min[p], x_max[p] );
Cabana::createParticles( Cabana::InitRandom(), x, x.size(), grid_min,
grid_max );
}

// Loop over number of ratios (neighbors per particle).
Expand Down
7 changes: 4 additions & 3 deletions benchmark/core/Cabana_NeighborArborXPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
// Define problem grid.
x_min[p] = 0.0;
x_max[p] = 1.3 * std::pow( num_p, 1.0 / 3.0 );
double grid_min[3] = { x_min[p], x_min[p], x_min[p] };
double grid_max[3] = { x_max[p], x_max[p], x_max[p] };
aosoas[p].resize( num_p );
auto x = Cabana::slice<0>( aosoas[p], "position" );
Cabana::createRandomParticles( x, x.size(), x_min[p], x_max[p] );
Cabana::createParticles( Cabana::InitRandom(), x, x.size(), grid_min,
grid_max );

if ( sort )
{
Expand All @@ -74,8 +77,6 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
// in cells the size of the smallest cutoff distance.
double cutoff = cutoff_ratios.front();
double sort_delta[3] = { cutoff, cutoff, cutoff };
double grid_min[3] = { x_min[p], x_min[p], x_min[p] };
double grid_max[3] = { x_max[p], x_max[p], x_max[p] };
auto x = Cabana::slice<0>( aosoas[p], "position" );
Cabana::LinkedCellList<Device> linked_cell_list(
x, sort_delta, grid_min, grid_max );
Expand Down
7 changes: 4 additions & 3 deletions benchmark/core/Cabana_NeighborVerletPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
// Define problem grid.
x_min[p] = 0.0;
x_max[p] = 1.3 * std::pow( num_p, 1.0 / 3.0 );
double grid_min[3] = { x_min[p], x_min[p], x_min[p] };
double grid_max[3] = { x_max[p], x_max[p], x_max[p] };
aosoas[p].resize( num_p );
auto x = Cabana::slice<0>( aosoas[p], "position" );
Cabana::createRandomParticles( x, x.size(), x_min[p], x_max[p] );
Cabana::createParticles( Cabana::InitRandom(), x, x.size(), grid_min,
grid_max );

if ( sort )
{
Expand All @@ -80,8 +83,6 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
// in cells the size of the smallest cutoff distance.
double cutoff = cutoff_ratios.front();
double sort_delta[3] = { cutoff, cutoff, cutoff };
double grid_min[3] = { x_min[p], x_min[p], x_min[p] };
double grid_max[3] = { x_max[p], x_max[p], x_max[p] };
Cabana::LinkedCellList<Device> linked_cell_list(
x, sort_delta, grid_min, grid_max );
Cabana::permute( linked_cell_list, aosoas[p] );
Expand Down
Loading

0 comments on commit fbbbb0a

Please sign in to comment.