Skip to content

Commit

Permalink
Fix deprecated code and remaining warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Sep 16, 2024
1 parent e45be58 commit 6c34446
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 39 deletions.
10 changes: 1 addition & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)

option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
include(GNUInstallDirs)
include(CMakeDependentOption)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand All @@ -19,14 +18,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
##---------------------------------------------------------------------------##
find_package(Cabana REQUIRED)

if( NOT Cabana_ENABLE_MPI )
message( FATAL_ERROR "Cabana must be compiled with MPI" )
endif()
if( NOT Cabana_ENABLE_CAJITA )
message( FATAL_ERROR "Cabana must be compiled with Cajita" )
endif()

cmake_dependent_option(CabanaMD_ENABLE_LB "Utilize Cabana load balancer" ON Cabana_ENABLE_ALL OFF)
option(CabanaMD_ENABLE_LB "Utilize Cabana load balancer" OFF)

##---------------------------------------------------------------------------##
# Set up optional libraries
Expand Down
6 changes: 3 additions & 3 deletions src/cabanamd.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
#include <types.h>

#ifdef CabanaMD_ENABLE_LB
#include <Cajita_LoadBalancer.hpp>
#include <Cajita_Types.hpp>
#include <Cabana_Grid_LoadBalancer.hpp>
#include <Cabana_Grid_Types.hpp>
#endif

class CabanaMD
Expand Down Expand Up @@ -87,7 +87,7 @@ class CbnMD : public CabanaMD
Binning<t_System> *binning;
InputFile<t_System> *input;
#ifdef CabanaMD_ENABLE_LB
Cajita::Experimental::LoadBalancer<Cajita::UniformMesh<double>> *lb;
Cabana::Grid::Experimental::LoadBalancer<Cabana::Grid::UniformMesh<double>> *lb;
#endif

void init( InputCL cl ) override;
Expand Down
2 changes: 1 addition & 1 deletion src/cabanamd_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void CbnMD<t_System, t_Neighbor>::init( InputCL commandline )
}

#ifdef CabanaMD_ENABLE_LB
lb = new Cajita::Experimental::LoadBalancer<Cajita::UniformMesh<double>>(
lb = new Cabana::Grid::Experimental::LoadBalancer<Cabana::Grid::UniformMesh<double>>(
MPI_COMM_WORLD, system->global_grid );
#endif

Expand Down
52 changes: 26 additions & 26 deletions src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ class SystemCommon
T_X_FLOAT ghost_mesh_lo_x, ghost_mesh_lo_y, ghost_mesh_lo_z;
T_X_FLOAT ghost_mesh_hi_x, ghost_mesh_hi_y, ghost_mesh_hi_z;
T_X_FLOAT halo_width;
std::shared_ptr<Cajita::UniformDimPartitioner> partitioner;
std::shared_ptr<Cajita::GlobalMesh<Cajita::UniformMesh<T_X_FLOAT>>>
std::shared_ptr<Cabana::Grid::DimBlockPartitioner<3>> partitioner;
std::shared_ptr<Cabana::Grid::GlobalMesh<Cabana::Grid::UniformMesh<T_X_FLOAT>>>
global_mesh;
std::shared_ptr<Cajita::LocalGrid<Cajita::UniformMesh<T_X_FLOAT>>>
std::shared_ptr<Cabana::Grid::LocalGrid<Cabana::Grid::UniformMesh<T_X_FLOAT>>>
local_grid;
std::shared_ptr<Cajita::GlobalGrid<Cajita::UniformMesh<T_X_FLOAT>>>
std::shared_ptr<Cabana::Grid::GlobalGrid<Cabana::Grid::UniformMesh<T_X_FLOAT>>>
global_grid;

// Only needed for current comm
Expand Down Expand Up @@ -149,7 +149,7 @@ class SystemCommon
{
halo_width = ghost_cutoff;
// Create the MPI partitions.
partitioner = std::make_shared<Cajita::UniformDimPartitioner>();
partitioner = std::make_shared<Cabana::Grid::DimBlockPartitioner<3>>();
ranks_per_dim = partitioner->ranksPerDimension( MPI_COMM_WORLD, {} );
int cells_per_dim_per_rank = 1;

Expand All @@ -162,7 +162,7 @@ class SystemCommon
cells_per_dim_per_rank * ranks_per_dim[2] };

// Create global mesh of MPI partitions.
global_mesh = Cajita::createUniformGlobalMesh( low_corner, high_corner,
global_mesh = Cabana::Grid::createUniformGlobalMesh( low_corner, high_corner,
cells_per_rank );

global_mesh_x = global_mesh->extent( 0 );
Expand All @@ -171,7 +171,7 @@ class SystemCommon

// Create the global grid.
std::array<bool, 3> is_periodic = { true, true, true };
global_grid = Cajita::createGlobalGrid( MPI_COMM_WORLD, global_mesh,
global_grid = Cabana::Grid::createGlobalGrid( MPI_COMM_WORLD, global_mesh,
is_periodic, *partitioner );

for ( int d = 0; d < 3; d++ )
Expand All @@ -193,11 +193,11 @@ class SystemCommon
// number of ranks (per dim) does not change. We also assume that the
// position of this rank in the cartesian grid of ranks does not change.
void update_global_grid( const std::shared_ptr<
Cajita::GlobalGrid<Cajita::UniformMesh<T_X_FLOAT>>>
Cabana::Grid::GlobalGrid<Cabana::Grid::UniformMesh<T_X_FLOAT>>>
&new_global_grid )
{
global_grid = new_global_grid;
local_grid = Cajita::createLocalGrid( global_grid, halo_width );
local_grid = Cabana::Grid::createLocalGrid( global_grid, halo_width );
update_mesh_info();
}

Expand Down Expand Up @@ -247,23 +247,23 @@ class SystemCommon
// Update local_mesh_* and ghost_mesh* info from global grid
void update_mesh_info()
{
auto local_mesh = Cajita::createLocalMesh<t_device>( *local_grid );

local_mesh_lo_x = local_mesh.lowCorner( Cajita::Own(), 0 );
local_mesh_lo_y = local_mesh.lowCorner( Cajita::Own(), 1 );
local_mesh_lo_z = local_mesh.lowCorner( Cajita::Own(), 2 );
local_mesh_hi_x = local_mesh.highCorner( Cajita::Own(), 0 );
local_mesh_hi_y = local_mesh.highCorner( Cajita::Own(), 1 );
local_mesh_hi_z = local_mesh.highCorner( Cajita::Own(), 2 );
ghost_mesh_lo_x = local_mesh.lowCorner( Cajita::Ghost(), 0 );
ghost_mesh_lo_y = local_mesh.lowCorner( Cajita::Ghost(), 1 );
ghost_mesh_lo_z = local_mesh.lowCorner( Cajita::Ghost(), 2 );
ghost_mesh_hi_x = local_mesh.highCorner( Cajita::Ghost(), 0 );
ghost_mesh_hi_y = local_mesh.highCorner( Cajita::Ghost(), 1 );
ghost_mesh_hi_z = local_mesh.highCorner( Cajita::Ghost(), 2 );
local_mesh_x = local_mesh.extent( Cajita::Own(), 0 );
local_mesh_y = local_mesh.extent( Cajita::Own(), 1 );
local_mesh_z = local_mesh.extent( Cajita::Own(), 2 );
auto local_mesh = Cabana::Grid::createLocalMesh<t_device>( *local_grid );

local_mesh_lo_x = local_mesh.lowCorner( Cabana::Grid::Own(), 0 );
local_mesh_lo_y = local_mesh.lowCorner( Cabana::Grid::Own(), 1 );
local_mesh_lo_z = local_mesh.lowCorner( Cabana::Grid::Own(), 2 );
local_mesh_hi_x = local_mesh.highCorner( Cabana::Grid::Own(), 0 );
local_mesh_hi_y = local_mesh.highCorner( Cabana::Grid::Own(), 1 );
local_mesh_hi_z = local_mesh.highCorner( Cabana::Grid::Own(), 2 );
ghost_mesh_lo_x = local_mesh.lowCorner( Cabana::Grid::Ghost(), 0 );
ghost_mesh_lo_y = local_mesh.lowCorner( Cabana::Grid::Ghost(), 1 );
ghost_mesh_lo_z = local_mesh.lowCorner( Cabana::Grid::Ghost(), 2 );
ghost_mesh_hi_x = local_mesh.highCorner( Cabana::Grid::Ghost(), 0 );
ghost_mesh_hi_y = local_mesh.highCorner( Cabana::Grid::Ghost(), 1 );
ghost_mesh_hi_z = local_mesh.highCorner( Cabana::Grid::Ghost(), 2 );
local_mesh_x = local_mesh.extent( Cabana::Grid::Own(), 0 );
local_mesh_y = local_mesh.extent( Cabana::Grid::Own(), 1 );
local_mesh_z = local_mesh.extent( Cabana::Grid::Own(), 2 );
}
};

Expand Down

0 comments on commit 6c34446

Please sign in to comment.