I am trying to build a distributed application with C++11 and MPI. I would like to send a lambda closure, to another computer on my cluster over a MPI_send()
call.
For example, say I had the following lambda
auto x = [x, y] () { return x + y; };
I would like to define a function, say pack()
so that I could call the MPI send -
MPI_Send(pack(f_xy), SOMESIZE, MPI_CHAR, 1, 0, MPI_COMM_WORLD);
Could someone tell me how I could define the pack
function (Also an unpack
function at the receivers end?). I have been looking around online, but have not been successful in finding any way to do this.