-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cffbb1e
commit 24ca9c1
Showing
14 changed files
with
127 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
_gen* |
This file contains 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,16 @@ | ||
|
||
// DO NOT INCLUDE MPI MANUALLY! USE THIS FILE! | ||
|
||
#if __has_include("core/def/_gen_mpi.hpp") | ||
#include "core/def/_gen_mpi.hpp" | ||
#else | ||
// Not always an issue, but not recommended | ||
#endif | ||
|
||
#include "core/def/pragma_disable.hpp" | ||
|
||
// clang-format off | ||
DISABLE_WARNING(cast-function-type, bad-function-cast, 42) | ||
#include "mpi.h" | ||
ENABLE_WARNING(cast-function-type, bad-function-cast, 42) | ||
// clang-format on |
File renamed without changes.
This file contains 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 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 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
2 changes: 1 addition & 1 deletion
2
tests/amr/multiphysics_integrator/test_multiphysics_integrator.cpp
This file contains 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,5 +1,5 @@ | ||
|
||
#include <mpi.h> | ||
#include "core/def/mpi.hpp" | ||
|
||
#include "tests/simulator/per_test.hpp" | ||
|
||
|
This file contains 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,5 +1,5 @@ | ||
|
||
#include <mpi.h> | ||
#include "core/def/mpi.hpp" | ||
|
||
#include "test_diagnostics.ipp" | ||
|
||
|
This file contains 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,5 +1,5 @@ | ||
|
||
#include <mpi.h> | ||
#include "core/def/mpi.hpp" | ||
|
||
#include "test_diagnostics.ipp" | ||
|
||
|
This file contains 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,27 @@ | ||
|
||
project(phare_configurator) | ||
|
||
cmake_minimum_required (VERSION 3.22) | ||
|
||
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
# set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..) | ||
|
||
|
||
find_package(MPI REQUIRED) | ||
foreach(LIB ${MPI_LIBRARY}) | ||
get_filename_component(MPI_LIBRARY_PATH ${LIB} DIRECTORY) | ||
endforeach() | ||
|
||
include_directories(${MPI_C_HEADER_DIR}) | ||
|
||
add_executable(${PROJECT_NAME} main.cpp) | ||
target_link_libraries(${PROJECT_NAME} mpi mpi_cxx) | ||
target_link_directories(${PROJECT_NAME} PUBLIC ${MPI_LIBRARY_PATH}) | ||
|
||
## probably should do something to check if mpi_cxx is even available, cause deprecated. | ||
# get_cmake_property(_variableNames VARIABLES) | ||
# list (SORT _variableNames) | ||
# foreach (_variableName ${_variableNames}) | ||
# message(STATUS "${_variableName}=${${_variableName}}") | ||
# endforeach() | ||
|
This file contains 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,12 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" && cd "$CWD" | ||
ROOT_DIR=$(cd ../.. && pwd) | ||
[ -f "${ROOT_DIR}/res/cmake/def.cmake" ] || (echo "Corruption detected" && exit 1) # confirm correct directory | ||
|
||
[ -d build ] || ( | ||
mkdir -p build && cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release .. -G Ninja 2>&1 > /dev/null | ||
ninja && ./phare_configurator | ||
) | ||
python3 config.py |
This file contains 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,45 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
FILE_DIR = Path(os.path.dirname(os.path.realpath(__file__))) | ||
ROOT_DIR = Path(os.path.realpath(FILE_DIR / ".." / "..")) | ||
if not os.path.exists(ROOT_DIR / "src" / "core" / "def"): | ||
raise RuntimeError("Corruption detected") | ||
FILES = [f for f in Path(FILE_DIR).glob("build/PHARE_*")] | ||
|
||
|
||
def local_file_format(filename): | ||
return filename[6:-4] | ||
|
||
|
||
def create_file(f): | ||
with open(f, "a") as file: | ||
file.truncate(0) | ||
|
||
|
||
def config_mpi_version(txtfile, h_file): | ||
with open(txtfile) as f: | ||
version = f.readline() | ||
out_buff = "\n" | ||
if "OpenMPI" in version: | ||
out_buff += "// avoids default including mpicxx \n" | ||
out_buff += "#define OMPI_SKIP_MPICXX 1 \n\n" | ||
with open(h_file, "w") as f: | ||
f.write(out_buff) | ||
|
||
|
||
def config_mpi(): | ||
h_file = ROOT_DIR / "src" / "core" / "def" / "_gen_mpi.hpp" | ||
create_file(h_file) | ||
operatators = dict(MPI_Get_library_version=config_mpi_version) | ||
for f in FILES: | ||
fn = operatators.get(local_file_format(f.name), lambda x, y: 0) | ||
fn(f, h_file) | ||
|
||
|
||
def main(): | ||
config_mpi() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains 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,20 @@ | ||
|
||
#include "mpi.h" | ||
|
||
#include <fstream> | ||
#include <exception> | ||
|
||
void config_mpi() | ||
{ | ||
char version[MPI_MAX_LIBRARY_VERSION_STRING]; | ||
int resultlen = 0; | ||
auto ret = MPI_Get_library_version(version, &resultlen); | ||
if (ret) | ||
throw std::runtime_error("error calling MPI_Get_library_version"); | ||
std::ofstream{"PHARE_MPI_Get_library_version.txt", std::ios::out} << version << std::endl; | ||
} | ||
|
||
int main() | ||
{ | ||
config_mpi(); | ||
} |