-
Notifications
You must be signed in to change notification settings - Fork 0
#56: implement parallel meshes as smaller instances of a global mesh #57
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
base: master
Are you sure you want to change the base?
Changes from all commits
6fd0bea
291f6b9
d0de73b
7f5157b
54f64c4
9948566
9aff73e
5cf7505
61f391f
e4af7ea
d6bc27e
b480eeb
34c3efa
2755bcd
9f14167
9337874
641adca
e3b505d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) | |
|
|
||
| # Setting options | ||
| option(OUTPUT_VTK_FILES "When OFF allows for a non-VTK build" OFF) | ||
| option(USE_MPI "When OFF allows for a non-MPI build" OFF) | ||
|
|
||
| # Find required dependencies | ||
| find_package(Kokkos REQUIRED) | ||
|
|
@@ -18,6 +19,10 @@ if(OUTPUT_VTK_FILES) | |
| find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkIOXML) | ||
| endif() | ||
|
|
||
| if(USE_MPI) | ||
| find_package(MPI REQUIRED) | ||
| endif() | ||
|
|
||
| find_package(GTest CONFIG REQUIRED) | ||
|
|
||
| # Try to find ccache to speed up compilation | ||
|
|
@@ -40,10 +45,22 @@ add_executable(allTests allTests.cpp) | |
| message(STATUS "VTK libraries: ${VTK_LIBRARIES}") | ||
|
|
||
| # Link targets to libraries | ||
| target_link_libraries(mesh_chunk Kokkos::kokkos ${VTK_LIBRARIES}) | ||
| target_link_libraries(parallel_mesh Kokkos::kokkos ${VTK_LIBRARIES}) | ||
| if (${USE_MPI} AND MPI_FOUND) | ||
| MESSAGE(STATUS "MPI found. Enabling MPI.") | ||
| target_link_libraries(mesh_chunk MPI::MPI_CXX) | ||
| target_link_libraries(parallel_mesh MPI::MPI_CXX) | ||
| target_link_libraries(boundary_conditions MPI::MPI_CXX) | ||
| target_link_libraries(solver MPI::MPI_CXX) | ||
| target_link_libraries(test MPI::MPI_CXX) | ||
| target_link_libraries(parallel_test MPI::MPI_CXX) | ||
| target_link_libraries(allTests MPI::MPI_CXX) | ||
| elseif(${USE_MPI} AND NOT MPI_FOUND) | ||
| MESSAGE(WARNING "MPI not found. Disabling MPI.") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as MPI is marked as |
||
| endif() | ||
| target_link_libraries(mesh_chunk boundary_conditions Kokkos::kokkos ${VTK_LIBRARIES}) | ||
| target_link_libraries(parallel_mesh mesh_chunk Kokkos::kokkos ${VTK_LIBRARIES}) | ||
| target_link_libraries(boundary_conditions Kokkos::kokkos ${VTK_LIBRARIES}) | ||
| target_link_libraries(solver Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES}) | ||
| target_link_libraries(test Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES}) | ||
| target_link_libraries(parallel_test Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES}) | ||
| target_link_libraries(allTests Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES} GTest::gtest) | ||
| target_link_libraries(solver parallel_mesh Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES}) | ||
| target_link_libraries(test solver mesh_chunk Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES}) | ||
| target_link_libraries(parallel_test solver Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES}) | ||
| target_link_libraries(allTests solver parallel_mesh Kokkos::kokkos Kokkos::kokkoskernels ${VTK_LIBRARIES} GTest::gtest) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| #pragma once | ||
| #cmakedefine OUTPUT_VTK_FILES | ||
| #cmakedefine USE_MPI |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,20 +7,24 @@ | |
|
|
||
| #include <Kokkos_Core.hpp> | ||
|
|
||
| #ifdef USE_MPI | ||
| #include <mpi.h> | ||
| #endif | ||
|
|
||
| #ifdef OUTPUT_VTK_FILES | ||
| #include <vtkSmartPointer.h> | ||
| #endif | ||
|
|
||
| enum struct PointIndexEnum : int8_t { | ||
| CORNER_0 = 0, | ||
| CORNER_1 = 1, | ||
| CORNER_2 = 2, | ||
| CORNER_3 = 3, | ||
| EDGE_0 = 4, | ||
| EDGE_1 = 5, | ||
| EDGE_2 = 6, | ||
| EDGE_3 = 7, | ||
| INTERIOR = 8 | ||
| CORNER_0 = 0, // Bottom Left | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider changing the names instead of adding comments. |
||
| CORNER_1 = 1, // Bottom Right | ||
| CORNER_2 = 2, // Top Right | ||
| CORNER_3 = 3, // Top Left | ||
| EDGE_0 = 4, // Bottom | ||
| EDGE_1 = 5, // Right | ||
| EDGE_2 = 6, // Top | ||
| EDGE_3 = 7, // Left | ||
| INTERIOR = 8 // Interior | ||
| }; | ||
|
|
||
| enum struct PointTypeEnum : int8_t { | ||
|
|
@@ -31,6 +35,13 @@ enum struct PointTypeEnum : int8_t { | |
| INVALID = 4 | ||
| }; | ||
|
|
||
| enum struct Border : int8_t { | ||
| BOTTOM = 0, | ||
| LEFT = 1, | ||
| RIGHT = 2, | ||
| TOP = 3 | ||
| }; | ||
|
|
||
| #ifdef OUTPUT_VTK_FILES | ||
| class vtkUniformGrid; | ||
| #endif | ||
|
|
@@ -70,6 +81,16 @@ class MeshChunk | |
| // setter to assign new mesh cell data | ||
| void set_pressure(Kokkos::View<double*> p) { this->pressure = p; } | ||
|
|
||
| #ifdef USE_MPI | ||
| // mpi sends to other mesh chunk | ||
| void mpi_send_border_velocity_x(double border_velocity_x, uint64_t pos_x, uint64_t pos_y, uint64_t dest_rank, uint8_t border); | ||
| void mpi_send_border_velocity_y(double border_velocity_y, uint64_t pos_x, uint64_t pos_y, uint64_t dest_rank, uint8_t border); | ||
|
|
||
| // mpi receive from other mesh chunk | ||
| void mpi_receive_border_velocity_x(double border_velocity_x, uint64_t pos_x, uint64_t pos_y, uint64_t source_rank, uint8_t border, MPI_Status status); | ||
| void mpi_receive_border_velocity_y(double border_velocity_y, uint64_t pos_x, uint64_t pos_y, uint64_t source_rank, uint8_t border, MPI_Status status); | ||
| #endif | ||
|
|
||
| // converter to VTK uniform grid | ||
| #ifdef OUTPUT_VTK_FILES | ||
| vtkSmartPointer<vtkUniformGrid> make_VTK_uniform_grid() const; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this being
OFFby default, this feature will not get tested in CI.Long-term it would be really good to have that configuration tested as well.