Skip to content

Commit

Permalink
Merge pull request #680 from streeve/deprecate_cajita
Browse files Browse the repository at this point in the history
Rename Cajita -> Cabana::Grid
  • Loading branch information
streeve authored Sep 21, 2023
2 parents 6fe7db5 + 7a0d777 commit 57e3263
Show file tree
Hide file tree
Showing 157 changed files with 3,186 additions and 1,742 deletions.
2 changes: 1 addition & 1 deletion .jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pipeline {
.. && \
make -j8 && \
# Exclude current failing tests (core MPI and partial Cajita)
ctest --output-on-failure -E "Cabana.*MPI|Cabana_Performance_Comm|Cajita_IndexConversion|Cajita_Halo|Cajita_ParticleGridDistributor|Cajita_Interpolation|Cajita_BovWriter|valgrind"
ctest --output-on-failure -E "Cabana.*MPI|Cabana_Performance_Comm|Grid_IndexConversion|Grid_Halo|Grid_ParticleGridDistributor|Grid_Interpolation|Grid_BovWriter|valgrind"
'''
}
post {
Expand Down
22 changes: 16 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ endif()
# enable doxygen
find_package(Doxygen)
if(Doxygen_FOUND)
doxygen_add_docs(doxygen core/src cajita/src)
doxygen_add_docs(doxygen core/src grid/src)
endif()

##---------------------------------------------------------------------------##
Expand All @@ -228,12 +228,22 @@ endif()

add_subdirectory(core)

option(Cabana_ENABLE_CAJITA "Build Cajita (grid and particle-grid)" ${Cabana_ENABLE_MPI})
if(Cabana_ENABLE_CAJITA)
option(Cabana_ENABLE_GRID "Build grid and particle-grid capabilities" ${Cabana_ENABLE_MPI})
### FIXME: remove in next release.
option(Cabana_ENABLE_CAJITA "Build grid and particle-grid capabilities" OFF)
option(Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS "Do not warn about Cajita deprecation." OFF)
if (Cabana_ENABLE_CAJITA)
if (NOT Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS)
message(DEPRECATION "Option Cabana_ENABLE_CAJITA is deprecated, replaced by Cabana_ENABLE_GRID")
endif()
set(Cabana_ENABLE_GRID ON)
endif()

if(Cabana_ENABLE_GRID)
if(MPI_FOUND)
add_subdirectory(cajita)
add_subdirectory(grid)
else()
message(FATAL_ERROR "Cajita requires MPI")
message(FATAL_ERROR "Grid subpackage requires MPI")
endif()
endif()

Expand Down Expand Up @@ -267,7 +277,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CabanaConfig.cmake" "${CMAKE_CURRENT_
## Clang Format
##---------------------------------------------------------------------------##
if(CLANG_FORMAT_FOUND)
file(GLOB_RECURSE FORMAT_SOURCES core/*.cpp core/*.hpp cajita/*hpp cajita/*cpp example/*cpp example/*hpp cmake/*cpp cmake/*hpp benchmark/*cpp benchmark/*hpp)
file(GLOB_RECURSE FORMAT_SOURCES core/*.cpp core/*.hpp grid/*hpp grid/*cpp example/*cpp example/*hpp cmake/*cpp cmake/*hpp benchmark/*cpp benchmark/*hpp)
add_custom_target(cabana-format
COMMAND ${CLANG_FORMAT_EXECUTABLE} -i -style=file ${FORMAT_SOURCES}
DEPENDS ${FORMAT_SOURCES})
Expand Down
4 changes: 2 additions & 2 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

add_subdirectory(core)

if(Cabana_ENABLE_CAJITA)
add_subdirectory(cajita)
if(Cabana_ENABLE_GRID)
add_subdirectory(grid)
endif()
44 changes: 0 additions & 44 deletions benchmark/cajita/CMakeLists.txt

This file was deleted.

10 changes: 5 additions & 5 deletions benchmark/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
############################################################################

add_executable(BinSortPerformance Cabana_BinSortPerformance.cpp)
target_link_libraries(BinSortPerformance cabanacore)
target_link_libraries(BinSortPerformance Core)

add_executable(NeighborVerletPerformance Cabana_NeighborVerletPerformance.cpp)
target_link_libraries(NeighborVerletPerformance cabanacore)
target_link_libraries(NeighborVerletPerformance Core)

if(Cabana_ENABLE_ARBORX)
add_executable(NeighborArborXPerformance Cabana_NeighborArborXPerformance.cpp)
target_link_libraries(NeighborArborXPerformance cabanacore)
target_link_libraries(NeighborArborXPerformance Core)
endif()

add_executable(LinkedCellPerformance Cabana_LinkedCellPerformance.cpp)
target_link_libraries(LinkedCellPerformance cabanacore)
target_link_libraries(LinkedCellPerformance Core)

if(Cabana_ENABLE_MPI)
add_executable(CommPerformance Cabana_CommPerformance.cpp)
target_link_libraries(CommPerformance cabanacore)
target_link_libraries(CommPerformance Core)
endif()

if(Cabana_ENABLE_TESTING)
Expand Down
44 changes: 44 additions & 0 deletions benchmark/grid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
############################################################################
# Copyright (c) 2018-2023 by the Cabana authors #
# All rights reserved. #
# #
# This file is part of the Cabana library. Cabana is distributed under a #
# BSD 3-clause license. For the licensing terms see the LICENSE file in #
# the top-level directory. #
# #
# SPDX-License-Identifier: BSD-3-Clause #
############################################################################

if(NOT Kokkos_ENABLE_SYCL) #FIXME_SYCL
add_executable(SparseMapPerformance Cabana_Grid_SparseMapPerformance.cpp)
target_link_libraries(SparseMapPerformance Grid)

add_executable(SparsePartitionerPerformance Cabana_Grid_SparsePartitionerPerformance.cpp)
target_link_libraries(SparsePartitionerPerformance Grid)
endif()

add_executable(HaloPerformance Cabana_Grid_HaloPerformance.cpp)
target_link_libraries(HaloPerformance Grid)

add_executable(InterpolationPerformance Cabana_Grid_InterpolationPerformance.cpp)
target_link_libraries(InterpolationPerformance Grid)

if(Cabana_ENABLE_HEFFTE)
add_executable(FastFourierTransformPerformance Cabana_Grid_FastFourierTransformPerformance.cpp)
target_link_libraries(FastFourierTransformPerformance Grid)
endif()

if(Cabana_ENABLE_TESTING)
if(NOT Kokkos_ENABLE_SYCL) #FIXME_SYCL
add_test(NAME Cabana_Grid_Performance_SparseMap COMMAND ${NONMPI_PRECOMMAND} $<TARGET_FILE:SparseMapPerformance> sparsemap_output.txt)
add_test(NAME Cabana_Grid_Performance_SparsePartitioner COMMAND ${NONMPI_PRECOMMAND} $<TARGET_FILE:SparsePartitionerPerformance> sparsepartitioner_output.txt)
endif()

add_test(NAME Cabana_Grid_Performance_Halo COMMAND ${NONMPI_PRECOMMAND} $<TARGET_FILE:HaloPerformance> halo_output.txt)

add_test(NAME Cabana_Grid_Performance_Interpolation COMMAND ${NONMPI_PRECOMMAND} $<TARGET_FILE:InterpolationPerformance> interpolation_output.txt)

if (Cabana_ENABLE_HEFFTE)
add_test(NAME Cabana_Grid_Performance_FastFourierTransform COMMAND ${NONMPI_PRECOMMAND} $<TARGET_FILE:FastFourierTransformPerformance> fastfouriertransform_output.txt)
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "../Cabana_BenchmarkUtils.hpp"

#include <Cajita.hpp>
#include <Cabana_Grid.hpp>

#include <Kokkos_Core.hpp>
#include <Kokkos_Random.hpp>
Expand All @@ -25,13 +25,13 @@

#include <mpi.h>

using namespace Cajita;
using namespace Cabana::Grid;

//---------------------------------------------------------------------------//
// Performance test.
template <class Device>
void performanceTest( std::ostream& stream,
const Cajita::DimBlockPartitioner<3> partitioner,
const DimBlockPartitioner<3> partitioner,
std::vector<double> grid_sizes_per_dim_per_rank,
MPI_Comm comm, const std::string& test_prefix )
{
Expand Down Expand Up @@ -172,7 +172,7 @@ int main( int argc, char* argv[] )
MPI_Comm_size( MPI_COMM_WORLD, &comm_size );

// Get partitioner
Cajita::DimBlockPartitioner<3> partitioner;
DimBlockPartitioner<3> partitioner;
// Get ranks per dimension
std::array<int, 3> ranks_per_dimension =
partitioner.ranksPerDimension( MPI_COMM_WORLD, { 0, 0, 0 } );
Expand All @@ -186,7 +186,7 @@ int main( int argc, char* argv[] )
file.open( filename + "_" + std::to_string( comm_size ),
std::fstream::out );
file << "\n";
file << "Cajita FFT Performance Benchmark"
file << "Cabana::Grid FFT Performance Benchmark"
<< "\n";
file << "----------------------------------------------"
<< "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../Cabana_BenchmarkUtils.hpp"

#include <Cabana_Core.hpp>
#include <Cajita.hpp>
#include <Cabana_Grid.hpp>

#include <Kokkos_Core.hpp>

Expand All @@ -26,11 +26,13 @@

#include <mpi.h>

using namespace Cabana::Grid;

//---------------------------------------------------------------------------//
// Performance test.
template <class Device>
void performanceTest( std::ostream& stream,
const Cajita::DimBlockPartitioner<3> partitioner,
const DimBlockPartitioner<3> partitioner,
std::vector<int> grid_sizes_per_dim_per_rank,
const std::string& test_prefix,
std::vector<int> halo_widths, MPI_Comm comm )
Expand Down Expand Up @@ -83,20 +85,19 @@ void performanceTest( std::ostream& stream,
grid_sizes_per_dim_per_rank[p] * ranks_per_dim[d];
}

auto global_mesh = Cajita::createUniformGlobalMesh(
auto global_mesh = createUniformGlobalMesh(
global_low_corner, global_high_corner, grid_sizes_per_dim );
auto global_grid = createGlobalGrid( comm, global_mesh,
is_dim_periodic, partitioner );

// Create a cell array.
auto layout =
createArrayLayout( global_grid, halo_width, 4, Cajita::Cell() );
auto array =
Cajita::createArray<double, device_type>( "array", layout );
createArrayLayout( global_grid, halo_width, 4, Cell() );
auto array = createArray<double, device_type>( "array", layout );

// Assign the owned cells a value of 1 and ghosted 0.
Cajita::ArrayOp::assign( *array, 0.0, Cajita::Ghost() );
Cajita::ArrayOp::assign( *array, 1.0, Cajita::Own() );
ArrayOp::assign( *array, 0.0, Ghost() );
ArrayOp::assign( *array, 1.0, Own() );

// create host mirror view
auto array_view = array->view();
Expand All @@ -105,8 +106,8 @@ void performanceTest( std::ostream& stream,
{
// create halo
halo_create_timer.start( pid );
auto halo = createHalo( Cajita::NodeHaloPattern<3>(),
halo_width, *array );
auto halo =
createHalo( NodeHaloPattern<3>(), halo_width, *array );
halo_create_timer.stop( pid );

// gather
Expand All @@ -116,8 +117,7 @@ void performanceTest( std::ostream& stream,

// scatter
halo_scatter_timer.start( pid );
halo->scatter( exec_space(), Cajita::ScatterReduce::Sum(),
*array );
halo->scatter( exec_space(), ScatterReduce::Sum(), *array );
halo_scatter_timer.stop( pid );
}
// Increment the problem id.
Expand Down Expand Up @@ -177,7 +177,7 @@ int main( int argc, char* argv[] )
MPI_Comm_size( MPI_COMM_WORLD, &comm_size );

// Get partitioner
Cajita::DimBlockPartitioner<3> partitioner;
DimBlockPartitioner<3> partitioner;
// Get ranks per dimension
std::array<int, 3> ranks_per_dimension =
partitioner.ranksPerDimension( MPI_COMM_WORLD, { 0, 0, 0 } );
Expand All @@ -190,7 +190,7 @@ int main( int argc, char* argv[] )
file.open( filename + "_" + std::to_string( comm_size ),
std::fstream::out );
file << "\n";
file << "Cajita Halo Performance Benchmark"
file << "Cabana::Grid Halo Performance Benchmark"
<< "\n";
file << "----------------------------------------------"
<< "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

#include "../Cabana_BenchmarkUtils.hpp"

#include <Cajita.hpp>
#include <Cabana_Grid.hpp>

#include <Kokkos_Core.hpp>
#include <Kokkos_Random.hpp>

#include <mpi.h>

using namespace Cajita;
using namespace Cabana::Grid;

// This is an example fused kernel version of p2g. It is not intended to be
// physical, but only to compare performance.
Expand Down Expand Up @@ -201,7 +201,7 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
using aosoa_type = Cabana::AoSoA<member_types, memory_space>;

// Define properties that do not depend on mesh size.
Cajita::DimBlockPartitioner<3> partitioner;
DimBlockPartitioner<3> partitioner;
int halo_width = 1;
uint64_t seed = 1938347;

Expand Down Expand Up @@ -323,7 +323,7 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
auto position = Cabana::slice<2>( aosoa, "position" );
auto scalar = Cabana::slice<3>( aosoa, "scalar" );

Cajita::grid_parallel_for(
grid_parallel_for(
"particles_init", exec_space{}, *local_grid, Own(), Cell(),
KOKKOS_LAMBDA( const int i, const int j, const int k ) {
int i_own = i - owned_cells.min( Dim::I );
Expand All @@ -340,14 +340,12 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
// Get the coordinates of the low cell node.
int low_node[3] = { i, j, k };
double low_coords[3];
local_mesh.coordinates( Cajita::Node(), low_node,
low_coords );
local_mesh.coordinates( Node(), low_node, low_coords );

// Get the coordinates of the high cell node.
int high_node[3] = { i + 1, j + 1, k + 1 };
double high_coords[3];
local_mesh.coordinates( Cajita::Node(), high_node,
high_coords );
local_mesh.coordinates( Node(), high_node, high_coords );

for ( int ip = 0; ip < num_ppc; ++ip )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../Cabana_BenchmarkUtils.hpp"
#include "Cabana_ParticleInit.hpp"

#include <Cajita_SparseIndexSpace.hpp>
#include <Cabana_Grid.hpp>

#include <Kokkos_Core.hpp>

Expand Down Expand Up @@ -75,14 +75,14 @@ void performanceTest( std::ostream& stream, const std::string& test_prefix,
{
std::array<int, 3> global_num_cell = {
num_cells_per_dim[c], num_cells_per_dim[c], num_cells_per_dim[c] };
auto global_mesh = Cajita::createSparseGlobalMesh(
auto global_mesh = Cabana::Grid::createSparseGlobalMesh(
global_low_corner, global_high_corner, global_num_cell );
float cell_size = 1.0 / num_cells_per_dim[c];

// create sparse map
int pre_alloc_size = num_cells_per_dim[c] * num_cells_per_dim[c];
auto sis =
Cajita::createSparseMap<exec_space>( global_mesh, pre_alloc_size );
auto sis = Cabana::Grid::createSparseMap<exec_space>( global_mesh,
pre_alloc_size );

// Create insertion timers
std::stringstream insert_time_name;
Expand Down
Loading

0 comments on commit 57e3263

Please sign in to comment.