Skip to content

Commit

Permalink
Merge pull request #76 from streeve/total_neighbors
Browse files Browse the repository at this point in the history
Write total neighbors to output
  • Loading branch information
streeve authored Jan 16, 2024
2 parents 4edc08f + a13e4d4 commit c09ffe8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
with:
repository: ECP-CoPA/Cabana
# This version is post-release 0.6
ref: b46b5fbec4c18241bcf57ccdc84dbe857e5d489c
ref: f99c7db9d54c57373ada6b16132c20d89d1ebb8e
path: cabana
- name: Build Cabana
working-directory: cabana
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
matrix:
cxx: ['hipcc']
cmake_build_type: ['Release']
kokkos_ver: ['3.6.01']
kokkos_ver: ['3.7.02']
runs-on: ubuntu-20.04
container: ghcr.io/ecp-copa/ci-containers/rocm:latest
steps:
Expand Down Expand Up @@ -158,8 +158,8 @@ jobs:
uses: actions/checkout@v3
with:
repository: ECP-CoPA/Cabana
# This version is post-release 0.5
ref: 31ba70d9e8f8e20f2e55e7e310905f950b21776f
# This version is post-release 0.6
ref: f99c7db9d54c57373ada6b16132c20d89d1ebb8e
path: cabana
- name: Build Cabana
working-directory: cabana
Expand All @@ -172,7 +172,7 @@ jobs:
-DCMAKE_CXX_FLAGS="-I${MPI_LOCATION}/include" \
-DCMAKE_EXE_LINKER_FLAGS="-L${MPI_LOCATION}/lib -lmpi" \
-DCMAKE_SHARED_LINKER_FLAGS="-L${MPI_LOCATION}/lib -lmpi" \
-DCMAKE_DISABLE_FIND_PACKAGE_HDF5=ON \
-DCabana_DISABLE_CAJITA_DEPRECATION_WARNINGS=ON \
-DCabana_REQUIRE_MPI=ON
cmake --build build --parallel 2
cmake --install build
Expand Down Expand Up @@ -200,7 +200,6 @@ jobs:
strategy:
matrix:
cmake_build_type: ['Release']
# 3.7 needed for kokkos_compiler_launcher
kokkos_ver: ['3.7.02']
runs-on: ubuntu-20.04
container: ghcr.io/ecp-copa/ci-containers/cuda:12.2.0
Expand Down Expand Up @@ -241,8 +240,8 @@ jobs:
uses: actions/checkout@v3
with:
repository: ECP-CoPA/Cabana
# This version is post-release 0.5
ref: 31ba70d9e8f8e20f2e55e7e310905f950b21776f
# This version is post-release 0.6
ref: f99c7db9d54c57373ada6b16132c20d89d1ebb8e
path: cabana
- name: Build Cabana
working-directory: cabana
Expand All @@ -251,6 +250,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
-DCMAKE_INSTALL_PREFIX=$HOME/Cabana \
-DCMAKE_PREFIX_PATH="$HOME/kokkos" \
-DCabana_DISABLE_CAJITA_DEPRECATION_WARNINGS=ON \
-DCabana_REQUIRE_MPI=ON
cmake --build build --parallel 2
cmake --install build
Expand Down
15 changes: 12 additions & 3 deletions src/CabanaPD_Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,16 @@ class SolverElastic
neighbors = std::make_shared<neighbor_type>( x, 0, particles->n_local,
force_model.delta, 1.0,
mesh_min, mesh_max );
int max_neighbors =
unsigned max_neighbors;
unsigned max_local_neighbors =
Cabana::NeighborList<neighbor_type>::maxNeighbor( *neighbors );
unsigned long long total_neighbors;
unsigned long long total_local_neighbors =
Cabana::NeighborList<neighbor_type>::totalNeighbor( *neighbors );
MPI_Reduce( &max_local_neighbors, &max_neighbors, 1, MPI_UNSIGNED,
MPI_MAX, 0, MPI_COMM_WORLD );
MPI_Reduce( &total_local_neighbors, &total_neighbors, 1,
MPI_UNSIGNED_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD );

force =
std::make_shared<force_type>( inputs["half_neigh"], force_model );
Expand All @@ -158,7 +166,7 @@ class SolverElastic
if ( print )
{
log( std::cout, "Local particles: ", particles->n_local,
", Maximum local neighbors: ", max_neighbors );
", Maximum neighbors: ", max_neighbors );
log( std::cout, "#Timestep/Total-steps Simulation-time" );

output_file = inputs["output_file"];
Expand All @@ -174,7 +182,8 @@ class SolverElastic
log( out, "Local particles, Ghosted particles, Global particles\n",
particles->n_local, ", ", particles->n_ghost, ", ",
particles->n_global );
log( out, "Maximum local neighbors: ", max_neighbors, "\n" );
log( out, "Maximum neighbors: ", max_neighbors,
", Total neighbors: ", total_neighbors, "\n" );
out.close();
}
init_time += init_timer.seconds();
Expand Down

0 comments on commit c09ffe8

Please sign in to comment.