-
Notifications
You must be signed in to change notification settings - Fork 65
PCU: Add nompi stub #425
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
Merged
PCU: Add nompi stub #425
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
72e472d
Add Eric's nompi stub
bobpaw 0ac4fcd
Add MPI stubs and refactor typedefs
bobpaw 1924c52
Add extern C and fix MPI_Init and MPI_Finalize return type
bobpaw ec115cd
Replace MPI_Comm_Split with PCU_Comm_Split
bobpaw 235c4b4
Remove direct MPI calls from tests
bobpaw fd4ae56
Do not use mpirun for tests with SCOREC_NO_MPI
bobpaw df6efc1
Replace stub MPI_Init/Finalize with empty #define
bobpaw 79556cc
Fixed stub unused parameter warnings
bobpaw a29f81f
Fix g++ warnings
bobpaw 1f16b30
Remove spurious pnompi error message
bobpaw 5dda7d0
Only run 1-proc tests with SCOREC_NO_MPI
bobpaw 43d90f9
Set msg peer in pcu_pnompi receive2
bobpaw 98f0659
feat: Implement PCU_Time without MPI_WTime
bobpaw 07727ed
fix: Add pcu_pnompi_types.h to install headers
bobpaw 7db4547
Fix set_test_properties on multiproc tests
bobpaw 4c5db4c
Merge branch 'develop' into apw/nompi
bobpaw 12fc04f
Merge branch 'develop' into apw/nompi
bobpaw b76d8f1
Fix compilation errors and update pcu_pnompi.c
bobpaw 86e7a8d
cleanup pcu::Order
bobpaw 4083386
remove obsolete pmpi functions
bobpaw ca2165d
readd C function arguments in definition
bobpaw 0541cff
indent CMake testing file
bobpaw e1d38cb
Update CMakeLists.txt
bobpaw 74c2617
add example mpi-nompi project
bobpaw 53d2adb
Merge branch 'develop' into apw/nompi
bobpaw c9682f3
fix GitHub actions file
bobpaw 11d50df
ci: run tests for mpi-nompi example
bobpaw 73707dc
ci: add allreduce to mpi-nompi example
bobpaw 36b09bd
remove PCU_Comm_Allreduce
bobpaw d150eb6
remove MPI_Init replacement macro from PCU.h
bobpaw da81781
remove MPI_SUM from pcu_pnompi_types.h
bobpaw ce7c4e8
replace PCU_Comm_Allgather with PCU::Allgather
bobpaw f88e21e
Replace MPI_Comm with PCU_Comm and add PCU::PCU()
bobpaw d4ee513
use default PCU constructor in example project
bobpaw 5cda076
add SCOREC_NO_MPI guards to example doc/myprogramm
bobpaw 3189c08
expand pcu_merge arguments and remove pcu_merge2
bobpaw 28eaa3a
ci: add ctest output on failure
bobpaw 54dc9ce
update example/mpi-nompi print order
bobpaw bac66ad
replace PCU_Comm_Split with PCU::Split
bobpaw 46be470
replace PCU_Comm_Split with PCU::Split in tests
bobpaw 0a65fea
use default PCU constructor in capstone tests
bobpaw 615663d
rename and deprecate GetMPIComm and SwitchMPIComm
bobpaw 153f19b
Revert "update example/mpi-nompi print order"
bobpaw 2100560
add example test file for CTest
bobpaw e4baca1
install headers to GNUInstallDirs variable
bobpaw b0f5bf1
use std::vector in example
bobpaw 437da68
add nodiscard to PCU::SwitchMPIComm and PCU::SwitchComm
bobpaw d6576a9
Revert "remove MPI_Init replacement macro from PCU.h"
bobpaw 953f86f
add pcu::PCU_Init and pcu::PCU_Finalize
bobpaw 6f7ec1a
use static pcu object in capstone tests
bobpaw 9ac70dd
fix bug in example project
bobpaw cdf7e3f
change PCU::Split to return std::unique_ptr
bobpaw 95110eb
add PCU::DupComm
bobpaw 0ce7897
remove PCU original comm and ownership and use Dup
bobpaw 7d6dbd7
add errors when using nompi with Zoltan/CGNS
bobpaw f192d2d
use DupComm in apfZoltan
bobpaw 0069474
fix pumi_mesh switchPCU
bobpaw 07232e8
fix pumi_mesh.cc errors introduced by 36b09bd7c
bobpaw 262a5c9
remove undefined PCU_GetGlobal
bobpaw f11237b
change PCU_Init to avoid re-initializing MPI
bobpaw fa2e70b
change pcu::PCU_Init to pcu::Init
bobpaw 981b20a
bump PUMI to 4.0.0
bobpaw 9aa2271
revert to MPI_Init in sim_countBL
bobpaw f4f79c1
bump SCOREC major version in examples
bobpaw 4895e2d
add const to PCU::Allgather send data
bobpaw 974b2ef
remove direct MPI calls from CGNS code
bobpaw aec006e
quote CMake variable in example/mpi-nompi
bobpaw 75fe494
fix include in sim_countBL test
bobpaw 42c4d6a
fix buffer overflow
bobpaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef SCOREC_CONFIG_H | ||
#define SCOREC_CONFIG_H | ||
|
||
#cmakedefine SCOREC_NO_MPI | ||
|
||
#endif // SCOREC_CONFIG_H | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#include <PCU.h> | ||
#include "mylibrary.h" | ||
int main(int argc, char** argv) { | ||
#ifndef SCOREC_NO_MPI | ||
MPI_Init(&argc,&argv); | ||
pcu::PCU PCUObj = pcu::PCU(MPI_COMM_WORLD); | ||
#endif | ||
pcu::PCU PCUObj; | ||
makeMesh(&PCUObj); | ||
#ifndef SCOREC_NO_MPI | ||
MPI_Finalize(); | ||
#endif | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(mpi-nompi VERSION 1.0.0 LANGUAGES CXX) | ||
|
||
# Allow the user to indicate where they installed SCOREC | ||
# via "-DSCOREC_PREFIX=/home/somewhere" when calling `cmake` | ||
set(SCOREC_PREFIX "" CACHE STRING "Directory where SCOREC is installed") | ||
|
||
# If SCOREC_PREFIX was specified then use only that directory. | ||
if (SCOREC_PREFIX) | ||
find_package(SCOREC 4 REQUIRED CONFIG PATHS "${SCOREC_PREFIX}" NO_DEFAULT_PATH) | ||
else() | ||
find_package(SCOREC 4 REQUIRED CONFIG) | ||
endif() | ||
|
||
add_executable(hello hello.cc) | ||
target_link_libraries(hello PRIVATE SCOREC::core) | ||
add_executable(test_coll test_coll.cc) | ||
target_link_libraries(test_coll PRIVATE SCOREC::core) | ||
|
||
enable_testing() | ||
add_test(NAME coll1 COMMAND mpirun -np 1 $<TARGET_FILE:test_coll>) | ||
add_test(NAME coll2 COMMAND mpirun -np 2 $<TARGET_FILE:test_coll>) | ||
add_test(NAME coll4 COMMAND mpirun -np 4 $<TARGET_FILE:test_coll>) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Example: Using SCOREC_NO_MPI in an MPI application | ||
|
||
This example demonstrates how to combine a SCOREC_NO_MPI build of core with an | ||
application that is using MPI. This is the prime use case for the SCOREC_NO_MPI | ||
option. | ||
|
bobpaw marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#include <iostream> | ||
#include <vector> | ||
|
||
#include <mpi.h> | ||
#include <PCU.h> | ||
#include <gmi_mesh.h> | ||
#include <apf.h> | ||
#include <apfBox.h> | ||
#include <apfMesh2.h> | ||
|
||
template <typename T> | ||
void print_vector(const std::vector<T> &v); | ||
|
||
int main(int argc, char** argv) { | ||
MPI_Init(&argc, &argv); | ||
{ // pcu object scope | ||
pcu::PCU PCUObj; | ||
// Print rank info. | ||
int rank, size; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | ||
MPI_Comm_size(MPI_COMM_WORLD, &size); | ||
if (rank == 0) | ||
std::cout << "MPI size: " << size << "; PCU size: " << | ||
PCUObj.Peers() << std::endl; | ||
for (int i = 0; i < size; ++i) { | ||
if (rank == i) | ||
std::cout << "Hello from MPI rank: " << rank << "; PCU rank: " << | ||
PCUObj.Self() << std::endl; | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
} | ||
// Test SCOREC functions. | ||
gmi_register_mesh(); | ||
apf::Mesh2* m = apf::makeMdsBox(1, 1, 1, 1, 1, 1, 0, &PCUObj); | ||
apf::destroyMesh(m); | ||
// MPI Allreduce | ||
int val = rank + 1, sum; | ||
MPI_Allreduce(&val, &sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); | ||
int pval = rank + 1, psum; | ||
psum = PCUObj.Add(pval); | ||
for (int i = 0; i < size; ++i) { | ||
if (rank == i) | ||
std::cout << "MPI(" << rank << ") sum: " << sum << | ||
"; PCU sum: " << psum << std::endl; | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
} | ||
// Test Allgather | ||
std::vector<int> vals1(size); | ||
MPI_Allgather(&val, 1, MPI_INT, vals1.data(), 1, MPI_INT, MPI_COMM_WORLD); | ||
std::vector<int> pvals1(PCUObj.Peers()); | ||
PCUObj.Allgather(&val, pvals1.data(), 1); | ||
for (int i = 0; i < size; ++i) { | ||
if (rank == i) { | ||
std::cout << "MPI(" << rank << ") gather: "; | ||
print_vector(vals1); | ||
std::cout << "; PCU gather: "; | ||
print_vector(pvals1); | ||
std::cout << std::endl; | ||
} | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
} | ||
int val2[2] = {val, -val}; | ||
std::vector<int> vals2(2 * size); | ||
MPI_Allgather(val2, 2, MPI_INT, vals2.data(), 2, MPI_INT, MPI_COMM_WORLD); | ||
std::vector<int> pvals2(2 * PCUObj.Peers()); | ||
PCUObj.Allgather(val2, pvals2.data(), 2); | ||
for (int i = 0; i < size; ++i) { | ||
if (rank == i) { | ||
std::cout << "MPI(" << rank << ") gather2: "; | ||
print_vector(vals2); | ||
std::cout << "; PCU gather2: "; | ||
print_vector(pvals2); | ||
std::cout << std::endl; | ||
} | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
} | ||
} // pcu object scope | ||
MPI_Finalize(); | ||
return 0; | ||
} | ||
|
||
template <typename T> | ||
void print_vector(const std::vector<T>& v) { | ||
std::cout << "["; | ||
for (int i = 0; i < v.size(); ++i) { | ||
if (i != 0) std::cout << ", "; | ||
std::cout << v[i]; | ||
} | ||
std::cout << "]"; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.