Skip to content

feat(smp): add SerializableBase for MPI population transfer#85

Open
evvaletov wants to merge 1 commit intonojhan:masterfrom
evvaletov:feat/smp-serializable-base
Open

feat(smp): add SerializableBase for MPI population transfer#85
evvaletov wants to merge 1 commit intonojhan:masterfrom
evvaletov:feat/smp-serializable-base

Conversation

@evvaletov
Copy link

@evvaletov evvaletov commented Feb 17, 2026

Summary

Adds SerializableBase<T>, a template wrapper that makes any type T
serializable via ParadisEO's eoserial::Persistent interface.

Motivation

The MPI island model (#86) needs to transfer eoPop<EOT> between MPI
ranks. ParadisEO's serialization framework (eoserial) provides
pack()/unpack() for converting objects to/from a JSON-like intermediate
representation, but eoPop doesn't directly implement
eoserial::Persistent. SerializableBase bridges this gap — it wraps any
T that has eoserial support and exposes the Persistent interface for
use with eo::mpi's send/recv.

Changes

File Change
smp/src/SerializableBase.h New — class declaration
smp/src/SerializableBase.tpp New — template implementation
smp/src/smp.h Added #include <SerializableBase.h>

@nojhan
Copy link
Owner

nojhan commented Feb 27, 2026

Seems like a good idea.

I don't recall the specifics (I worked on that a... long time ago), but why do we have a JSON serialization, apart from the regular one (the one using printOn & readFrom)? The regular one also seems more compact. And why not using a digital serialization instead of text-based one (which would be faster)?

Template wrapper making any type T serializable via eoserial::Persistent,
required for transferring populations between MPI ranks in the island model.
@evvaletov evvaletov force-pushed the feat/smp-serializable-base branch from 2bb2158 to 6d4909c Compare March 1, 2026 00:55
@evvaletov
Copy link
Author

Rebased onto HEAD.

On the serialization choice: printOn/readFrom is flat text I/O without structural metadata, so reconstructing nested types (populations of multi-objective individuals with objective vectors, fitness values, and diversity metrics) would require reimplementing what eoserial already handles recursively through Persistent::pack/unpack.

On binary vs text: fair point. The eoserial module only has a JSON backend, so adding binary would mean either extending eoserial or building a parallel serialization path, both larger changes than this PR warrants. In practice, the migrated populations are small (a few individuals per event, not the full population), so the overhead is modest relative to evaluation cost. That said, a binary serialization path for MPI transfers would be a worthwhile future improvement.

@nojhan
Copy link
Owner

nojhan commented Mar 2, 2026

I see, I forgot about the recursive part, that's a killer feature. This seems good to me. Ask for review when you're ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants