[Mono-bugs] [Bug 70981][Cri] New - dll import errors in a real multi processor environement

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 4 Jan 2005 09:48:33 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by michael.kaempf@fakt-software.de.

http://bugzilla.ximian.com/show_bug.cgi?id=70981

--- shadow/70981	2005-01-04 09:48:33.000000000 -0500
+++ shadow/70981.tmp.22660	2005-01-04 09:48:33.000000000 -0500
@@ -0,0 +1,174 @@
+Bug#: 70981
+Product: Mono: Runtime
+Version: 1.1
+OS: Red Hat 7.3
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: JIT
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: michael.kaempf@fakt-software.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: dll import errors in a real multi processor environement
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. create source files
+
+--- testlib.c ---
+
+#include <stdio.h>
+#include <string.h>
+
+#include <mpi.h>
+
+int init (char** arg)
+{
+	int argc = 0;
+	char **argv = arg;
+
+	while (argv[0]) {
+		argv++;
+		argc++;
+	}
+
+	return MPI_Init (&argc, &arg);
+}
+
+int rank (void)
+{
+	int t;
+	MPI_Comm_rank (MPI_COMM_WORLD, &t);
+	return t;
+}
+
+int size (void)
+{
+	int t;
+	MPI_Comm_size (MPI_COMM_WORLD, &t);
+	return t;
+}
+
+void send (int value, int dest, int tag)
+{
+	MPI_Send (&value, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
+}
+
+int recv (int source, int tag)
+{
+	int data;
+	MPI_Status status;
+	MPI_Recv (&data, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
+	return data;
+}
+
+void finalize (void)
+{
+	MPI_Finalize ();
+}
+
+--- test.cs ---
+
+using System;
+using System.Runtime.InteropServices;
+
+class Test
+{
+	[DllImport("testlib.so",EntryPoint="init")]
+		private static extern int MPI_Init(string[] arg);
+	
+	[DllImport("testlib.so",EntryPoint="rank")]
+		private static extern int MPI_Comm_rank();
+	
+	[DllImport("testlib.so",EntryPoint="size")]
+		private static extern int MPI_Comm_size();
+	
+	[DllImport("testlib.so",EntryPoint="send")]
+		private static extern void MPI_Send(int value, int dest, 
+int tag);
+	
+	[DllImport("testlib.so",EntryPoint="recv")]
+		private static extern int MPI_Recv(int source, int tag);
+
+	[DllImport("testlib.so",EntryPoint="finalize")]
+		private static extern void MPI_Finalize();
+
+	public static void Main(string[] args)
+	{
+		MPI_Init (args);
+		
+		int rank = MPI_Comm_rank ();
+		int size = MPI_Comm_size ();
+
+		Console.WriteLine("alive on {0}/{1}", rank, size);
+
+		if (rank == 0) {
+			for (int i=1; i<size; i++) {
+				int t = MPI_Recv (i, 0);
+				Console.WriteLine("hello from {0}", t);
+			}
+		} else {
+			MPI_Send (rank, 0, 0);
+		}
+
+		MPI_Finalize ();
+	}
+}
+
+
+
+2. compile it
+
+--- makefile ---
+
+all: test.exe testlib.so
+
+test.exe: test.cs
+	mcs test.cs
+
+testlib.so: testlib.c
+	mpicc -o testlib.so testlib.c -shared
+
+clean:
+	rm -f test.exe testlib.so
+
+
+3. run the result files in a real multi processor environement
+
+lamboot -b -v hosts
+mpirun -np 4 /usr/bin/mono test.exe
+wipe -v
+
+Actual Results:
+
+Unhandled Exception: System.DllNotFoundException: testlib.so
+in <0x00053> (wrapper managed-to-native) Test:MPI_Init (string[])
+in <0x0002b> Test:Main (string[])
+
+or:
+
+The assembly mscorlib.dll was not found or could not be loaded.
+It should have been installed in the `/afs/tu-
+chemnitz.de/project/CAOS/usr/mono-1.0.4/lib' directory.
+
+Expected Results:
+
+Output and no errors.
+
+How often does this happen? 
+
+Every time.
+
+Additional Information:
+
+I'm using a real multi processor environement with MPI and LAM. Till mono 
+version 0.40 their were no such problems. But since mono version 1.0 they 
+occure.