Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid-based particle initialization and random init rewrite #609

Merged
merged 9 commits into from
Sep 1, 2023
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
Loading