For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

MPI Serialization to memory block

AlexChuprunov's picture

Dear collegues!

I have a parallel MPI code that implements Master-Slave approach.
MPI Master reads geometry from BREP file and must send it to MPI Slaves. How can I obtain a single memory block (with whole geometry description)to send it using MPI_Send command?
I need the same geometry on all MPI Slaves.

Roman Lygin's picture

Hi Alex,

I used to think about similar usage model but it always fell below my priority line. Here are some draft thoughts I had, may be will be helpful for you:

1. Just save a .brep file on a shared drive in the master process and read it in all slaves.
2. Save in a string buffer in memory. Create a stream over that buffer and use BRepTools::Write(stream). Then send that string buffer. Read from the received buffer in each slave process.
3. Check the Serialization sample that used to exist in Open CASCADE distribution. I don't remember by heart what it was really about and how it is different from the CSFDB support in import/export example (see ./samples/mfc/Common/ImportExport/ImportExport.cpp CImportExport::SaveCSFDB())
4. Design custom serialization. This will be unavoidable if you need to send some custom data model, not just TopoDS_Shape. Anyway, BRepTools_ShapeSet, etc used by BRepTools::Write()/Read() provide indexing of subshapes, so this should be feasible.

If you end up with some implementation, please share your findings.
Good luck.