An user defined operation is created inside op::UserOp::op(). It is stored as static and is not currently released via MPI_Op_Free. This is not anything critical, but it would nice to have a way to properly release the registered operations.
One solution I had working was storing the ops inside Environment and using a thin wrapper MOp to create and release the ops. This worked fine with MPICH, but was causing crashes with openmpi. So it seems that releasing the ops before finalize can be tricky.
In boost.mpi they put the UserOp on stack inside the reduction operation, so every time user asks for their own reduce operation, it gets registered, used, and released. This probably works, but seems funny. Better approach is IMO register on first use, release on finalize.
It is 2025, we should be able to do this...
An user defined operation is created inside
op::UserOp::op(). It is stored asstaticand is not currently released viaMPI_Op_Free. This is not anything critical, but it would nice to have a way to properly release the registered operations.One solution I had working was storing the ops inside
Environmentand using a thin wrapperMOpto create and release the ops. This worked fine with MPICH, but was causing crashes with openmpi. So it seems that releasing the ops before finalize can be tricky.In
boost.mpithey put theUserOpon stack inside the reduction operation, so every time user asks for their own reduce operation, it gets registered, used, and released. This probably works, but seems funny. Better approach is IMO register on first use, release on finalize.It is 2025, we should be able to do this...