PTL logo

From: Jean-Michel.Perraud_at_[hidden]
Date: 2014-08-12 18:06:16

A belated reply as I was out of office; I hope this is still of use.

This is hard to say without knowing what your serializable object is. Also, note that marking an object as [Serializable] is not enough to make all objects really binary serializable.
You should not need to specify the length yourself; the broadcast call includes a phase where the root broadcasts the length of the object to everyone, before sending the data.

internal void Broadcast_impl<T>(bool isRoot, ref T value, int root)

                    // Broadcast the size of the serialized data
                    int length = (int)stream.Length;
                        int errorCode = Unsafe.MPI_Bcast(new IntPtr(&length), 1, Unsafe.MPI_INT, root, comm);
                        if (errorCode != Unsafe.MPI_SUCCESS)
                          throw Environment.TranslateErrorIntoException(errorCode);

The tests include a broadcast test (MPI.NET\Tests\BroadcastTest\BroadcastTest.cs) where arrays are used, but the buffers are all the same size upfront. It may be worth starting from these examples, and gradually change these to data that resembles yours. This would help isolate the issue and/or clarify things for you.

        // Broadcast an array of integers
        int[] intArray = new int[7];
        if (world.Rank == root)
            intArray = new int[]{ 1, 1, 2, 3, 5, 8, 13 };
            System.Console.Write("Broadcasting integer array from root " + root + "...");

From: [[hidden]] on behalf of Matt Barron [mattjcbarron_at_[hidden]]
Sent: Friday, July 18, 2014 6:50 PM
To: mpi.net_at_[hidden]
Subject: [MPI.NET] MPI.MessageTruncateException

Hi all,

I'm having what I suspect is a simple problem to solve, but I can't seem to find an answer anywhere. I am attempting to broadcast a serializable object, but I am getting the following exception:

MPI.MessageTruncatedException: Message truncated, error stack:
MPI_Bcast(buf=0x003FEC58, count=1, MPI_INT, root=0, MPI_COMM_WORLD) failed
Message from rank 0 and tag -1996488672 truncated; 88 bytes received but buffer size is 4

Obviously the solution is to increase the size of the buffer, but how? Is this done in MPI.NET<http://MPI.NET> or MS-MPI/mpiexec.exe? Any help would be greatly appriciated. Thank you in advance,