Skip to content
Snippets Groups Projects
Commit 2e695e58 authored by Marcel Koch's avatar Marcel Koch
Browse files

[!334] adds option for fake mpi

Merge branch 'feature/no-mpi-option' into 'master'

ref:extensions/dune-codegen Useful for performance measuring with Intel SDE.

See merge request [extensions/dune-codegen!334]

  [extensions/dune-codegen!334]: gitlab.dune-project.org/extensions/dune-codegen/merge_requests/334
parents 5cd4ac44 e59f2fa6
No related branches found
No related tags found
No related merge requests found
...@@ -116,6 +116,11 @@ function(dune_add_generated_executable) ...@@ -116,6 +116,11 @@ function(dune_add_generated_executable)
message(FATAL_ERROR "Unrecognized arguments in dune_add_generated_executable. This usually indicates a typo.") message(FATAL_ERROR "Unrecognized arguments in dune_add_generated_executable. This usually indicates a typo.")
endif() endif()
set(MPI_OPTION "0")
if(MPI_FOUND)
set(MPI_OPTION "1")
endif()
# Apply defaults and enforce requirements # Apply defaults and enforce requirements
if(NOT GEN_TARGET) if(NOT GEN_TARGET)
message(FATAL_ERROR "Need to specify the TARGET parameter for dune_add_generated_executable") message(FATAL_ERROR "Need to specify the TARGET parameter for dune_add_generated_executable")
...@@ -139,6 +144,7 @@ function(dune_add_generated_executable) ...@@ -139,6 +144,7 @@ function(dune_add_generated_executable)
--target-name ${GEN_TARGET} --target-name ${GEN_TARGET}
--driver-file ${GEN_SOURCE} --driver-file ${GEN_SOURCE}
--project-basedir ${CMAKE_BINARY_DIR} --project-basedir ${CMAKE_BINARY_DIR}
--with-mpi ${MPI_OPTION}
${GEN_FORM_COMPILER_ARGS} ${GEN_FORM_COMPILER_ARGS}
DEPENDS ${GEN_UFLFILE} ${UFL2PDELAB_SOURCES} ${GEN_DEPENDS} ${DUNE_CODEGEN_ADDITIONAL_PYTHON_SOURCES} DEPENDS ${GEN_UFLFILE} ${UFL2PDELAB_SOURCES} ${GEN_DEPENDS} ${DUNE_CODEGEN_ADDITIONAL_PYTHON_SOURCES}
COMMENT "Generating driver for the target ${GEN_TARGET}" COMMENT "Generating driver for the target ${GEN_TARGET}"
...@@ -199,6 +205,7 @@ function(dune_add_generated_executable) ...@@ -199,6 +205,7 @@ function(dune_add_generated_executable)
--ini-file ${GEN_INIFILE} --ini-file ${GEN_INIFILE}
--target-name ${GEN_TARGET} --target-name ${GEN_TARGET}
--operator-to-build ${op} --operator-to-build ${op}
--with-mpi ${MPI_OPTION}
${ANALYZE_GRID_OPTION} ${ANALYZE_GRID_OPTION}
DEPENDS ${GEN_UFLFILE} ${UFL2PDELAB_SOURCES} ${GEN_DEPENDS} ${DUNE_CODEGEN_ADDITIONAL_PYTHON_SOURCES} ${ANALYZE_GRID_FILE} DEPENDS ${GEN_UFLFILE} ${UFL2PDELAB_SOURCES} ${GEN_DEPENDS} ${DUNE_CODEGEN_ADDITIONAL_PYTHON_SOURCES} ${ANALYZE_GRID_FILE}
COMMENT "Generating operator file ${depdata___${op}} for the target ${GEN_TARGET}" COMMENT "Generating operator file ${depdata___${op}} for the target ${GEN_TARGET}"
......
...@@ -58,6 +58,7 @@ class CodegenGlobalOptionsArray(ImmutableRecord): ...@@ -58,6 +58,7 @@ class CodegenGlobalOptionsArray(ImmutableRecord):
debug_interpolate_input = CodegenOption(default=False, helpstr="Should the input for printresidual and printmatix be interpolated (instead of random input).") debug_interpolate_input = CodegenOption(default=False, helpstr="Should the input for printresidual and printmatix be interpolated (instead of random input).")
use_likwid = CodegenOption(default=False, helpstr="Use likwid instead of own performance measurements.") use_likwid = CodegenOption(default=False, helpstr="Use likwid instead of own performance measurements.")
autotune_google_benchmark = CodegenOption(default=False, helpstr="Use google-benchmark library for autotuning (when autotuning is activated).") autotune_google_benchmark = CodegenOption(default=False, helpstr="Use google-benchmark library for autotuning (when autotuning is activated).")
with_mpi = CodegenOption(default=True, helpstr="The module was configured with mpi")
# Arguments that are mainly to be set by logic depending on other options # Arguments that are mainly to be set by logic depending on other options
max_vector_width = CodegenOption(default=256, helpstr=None) max_vector_width = CodegenOption(default=256, helpstr=None)
......
...@@ -215,7 +215,10 @@ def name_initree(): ...@@ -215,7 +215,10 @@ def name_initree():
@preamble(section="init") @preamble(section="init")
def define_mpihelper(name): def define_mpihelper(name):
include_file("dune/common/parallel/mpihelper.hh", filetag="driver") include_file("dune/common/parallel/mpihelper.hh", filetag="driver")
return "Dune::MPIHelper& {} = Dune::MPIHelper::instance(argc, argv);".format(name) if get_option("with_mpi"):
return "Dune::MPIHelper& {} = Dune::MPIHelper::instance(argc, argv);".format(name)
else:
return "Dune::FakeMPIHelper& {} = Dune::FakeMPIHelper::instance(argc, argv);".format(name)
def name_mpihelper(): def name_mpihelper():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment