Skip to content
Snippets Groups Projects
Commit 63f86177 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Dmitri Naumov
Browse files

[BL/MPI] Reduce ifdef range.

parent b2817c6b
No related branches found
No related tags found
No related merge requests found
...@@ -5,28 +5,28 @@ ...@@ -5,28 +5,28 @@
* Distributed under a Modified BSD License. * Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or * See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
*
*/ */
#pragma once #pragma once
#ifdef USE_PETSC
#include <mpi.h>
#endif
namespace BaseLib::MPI namespace BaseLib::MPI
{ {
#ifdef USE_PETSC static inline int reduceMin(int const val)
// Reduce operations for interprocess communications while using Petsc
static inline int reduceMin(int val)
{ {
#ifdef USE_PETSC
// Reduce operations for interprocess communications while using Petsc
int result; int result;
MPI_Allreduce(&val, &result, 1, MPI_INTEGER, MPI_MIN, PETSC_COMM_WORLD); MPI_Allreduce(&val, &result, 1, MPI_INTEGER, MPI_MIN, PETSC_COMM_WORLD);
return result; return result;
}
#else #else
// Reduce operations for interprocess communications without using Petsc // Reduce operations for interprocess communications without using Petsc
static inline int reduceMin(int val)
{
return val; return val;
}
#endif #endif
}
} // namespace BaseLib::MPI } // namespace BaseLib::MPI
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