Skip to content
Snippets Groups Projects
Commit 0c4b7291 authored by Christian Engwer's avatar Christian Engwer
Browse files

[!733] Update generic mpi op

Merge branch 'update-generic-mpi-op' into 'master'

See merge request [!733]

  [!733]: Nonecore/dune-common/merge_requests/733
parents 7877ca25 12432474
No related branches found
No related tags found
1 merge request!733Update generic mpi op
Pipeline #22966 passed
......@@ -43,7 +43,11 @@ namespace Dune
{
if (!op)
{
op = std::shared_ptr<MPI_Op>(new MPI_Op);
op = std::make_unique<MPI_Op>();
// The following line leaks an MPI operation object, because the corresponding
//`MPI_Op_free` is never called. It is never called because there is no easy
// way to call it at the right moment: right before the call to MPI_Finalize.
// See https://gitlab.dune-project.org/core/dune-istl/issues/80
MPI_Op_create((void (*)(void*, void*, int*, MPI_Datatype*))&operation,true,op.get());
}
return *op;
......@@ -61,12 +65,12 @@ namespace Dune
}
Generic_MPI_Op () {}
Generic_MPI_Op (const Generic_MPI_Op& ) {}
static std::shared_ptr<MPI_Op> op;
static std::unique_ptr<MPI_Op> op;
};
template<typename Type, typename BinaryFunction, typename Enable>
std::shared_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction, Enable>::op = std::shared_ptr<MPI_Op>(static_cast<MPI_Op*>(0));
std::unique_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction, Enable>::op;
#define ComposeMPIOp(func,op) \
template<class T, class S> \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment