You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I occasionally receive the following error message when I receive a serialized array with the current MPI version (v1.4):
Unhandled exception: System.Runtime.Serialization.SerializationException: The end of the stream was reached before processing was completed.
at System.Runtime.Serialization.Formatters.Binary .__ BinaryParser.Run ()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize (HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at MPI.BinaryFormatterSerializer.Deserialize [T] (Stream stream)
at MPI.Serialization.ReceiveLarge [T] (Communicator comm, Int32 source, Int32 tag, T & value, CompletedStatus & status)
at MPI.Communicator.Receive [T] (Int32 source, Int32 tag, T & value, CompletedStatus & status)
at MPI.Communicator.Receive [T] (Int32 source, Int32 tag, T & value)
at MPI.Communicator.Receive [T] (Int32 source, Int32 tag)
Sporadically means that the error always contains the receive block of my code in the code line "SendList receivedList = comm.Receive (0, 2);" but always occurs at different times. Sometimes MPI manages to transfer 50% of the data, sometimes only 30% or only 10%. I tested my program on different computers but the error is always the same. Everything worked with the old version of MPI (v1.0). I had to update to the new version because only with this an x64 debugging in Visual Studio 2019 is possible (with the old MPI version the x64 debugging always stops).
Guess:
Due to the error message, it must have something to do with the deserialization of the data. In my opinion, the data was not completely transferred. For other data (smaller and different types) that I send without serialization via MPI (not shown in the code below), there is no error.
Question:
How can I solve the problem or work around it?
Briefly about me:
Sorry for the bad english, I used the google translator, I am not a trained programmer and therefore I lack some background knowledge. I myself would classify myself as a beginner who taught himself a little something.
Here is my code to send:
using MaxPlaceCalculations.MpiCommunication;
using MaxPlaceCalculations.Polygons;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization;
namespace MaxPlaceCalculations.Helper
{
public static class MPISender
{
public static void SendPolygonParts(ICommunicator comm, Polygon[] polygonParts, int i, bool isLast)
{
SendList sendObject = new SendList(polygonParts, isLast);
try
{
if (i != 0)
comm.Send(sendObject, i - 1, 2);
else
comm.Send(sendObject, 0, 2);
}
catch (SerializationException se)
{
if (i != 0)
Logger.Error(string.Format(CultureInfo.CurrentCulture, "Senden des Polygonpaketes Nr. {0} an Node/Soket/Core {1} nicht erfolgreich.", i, i - 1));
else if (i == 0 && polygonParts.Length == 0)
Logger.Error(string.Format(CultureInfo.CurrentCulture, "Senden des leeren Polygonpaketes von der Node/Soket/Core {0} ({2}) an die Hauptnode war nicht erfolgreich. Fehler: {1}", comm.Rank, se, comm.ProcessorName));
else if (i == 0 && polygonParts.Length != 0)
Logger.Error(string.Format(CultureInfo.CurrentCulture, "Senden des durch die Locherkennung analysierten Polygonpaketes mit {1} Polygonen von der Node/Soket/Core {0} ({2}) an die Hauptnode war nicht erfolgreich.", comm.Rank, polygonParts.Length, comm.ProcessorName));
}
}
}
}
using System;
namespace MaxPlaceCalculations.MpiCommunication
{
[Serializable]
public class SendList
{
public bool IsLast { get; private set; }
private Polygon[] polygonList;
public Polygon[] GetPolygonList()
{
return polygonList;
}
private void SetPolygonList(Polygon[] value)
{
polygonList = value;
}
public SendList(Polygon[] liste, bool isLast)
{
SetPolygonList(liste);
IsLast = isLast;
}
}
}
Here is my code to receive:
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace MaxPlace
{
internal static class NativeMethods
{
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool AttachConsole(int ProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool AllocConsole();
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool FreeConsole();
}
static class Program
{
[STAThread]
static void Main(string[] args)
{
using (new MpiEnvironment(ref args))
{
ICommunicator comm = MpiEnvironment.Communicator;
if (comm.Rank == 0)
{
more code.......
}
else
{
while (comm.Receive<int>(0, 0) == 0)
{
Polygon[] polygons = Array.Empty<Polygon>();
bool isNotLast = true;
while (isNotLast)
{
SendList receivedList = comm.Receive<SendList>(0, 2);
List<Polygon> polygonsList = polygons == null ? new List<Polygon>() : polygons.ToList();
polygonsList.AddRange(receivedList.GetPolygonList());
isNotLast = !receivedList.IsLast;
polygons = polygonsList.ToArray();
}
more code....
break; // beende die while-schleife
}
Application.Exit();
}
}
}
}
}
I hope I have given all the necessary information. Please help me, I don't know what to do anymore.
Thanks.
best Frank
The text was updated successfully, but these errors were encountered:
Hi,
I occasionally receive the following error message when I receive a serialized array with the current MPI version (v1.4):
Sporadically means that the error always contains the receive block of my code in the code line "SendList receivedList = comm.Receive (0, 2);" but always occurs at different times. Sometimes MPI manages to transfer 50% of the data, sometimes only 30% or only 10%. I tested my program on different computers but the error is always the same. Everything worked with the old version of MPI (v1.0). I had to update to the new version because only with this an x64 debugging in Visual Studio 2019 is possible (with the old MPI version the x64 debugging always stops).
Guess:
Due to the error message, it must have something to do with the deserialization of the data. In my opinion, the data was not completely transferred. For other data (smaller and different types) that I send without serialization via MPI (not shown in the code below), there is no error.
Question:
How can I solve the problem or work around it?
Briefly about me:
Sorry for the bad english, I used the google translator, I am not a trained programmer and therefore I lack some background knowledge. I myself would classify myself as a beginner who taught himself a little something.
Here is my code to send:
Here is my code to receive:
I hope I have given all the necessary information. Please help me, I don't know what to do anymore.
Thanks.
best Frank
The text was updated successfully, but these errors were encountered: