Hello Sir,
       hereby I have attached  a program for matrix multiplication using
Alchemi;
The problem with it is that it works fine for small no. dimensions which I
am trying to do for 100 x 100.
When I did ran for 45 x 45 it finished with error

thread #0 finished as:
System.Runtime.Remoting.remotingException

Server stack trace:

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)

at Alchemi.Core.IManager.Executor_GetThread(SecurityCredentials sc,
ThreadIdentifier ti)

at Alchemi.Executor.GExecutor.ExecuteThreadInAppDomain()



Can anyone help in this matter.

is there any limit on no. of threads.

Also once this error occurs then the program doesnt work for
small simensions of matrix (it gives no result only thraeds are created).

Another issue  why anything writtten in overridden Start doent get printed
on console.

bye .

waiting for response.
using System;
using Alchemi.Core;
using Alchemi.Core.Owner;
using System.Collections;

namespace Alchemi.Examples.Tutorial
{
    [Serializable]
    public class MultiplierThread : GThread
    {
        ArrayList _A =  new ArrayList();
        ArrayList _B =  new ArrayList();
         private int _Res ;
    
        public int Result
        {
            get { return _Res; }
        }

        public MultiplierThread(ArrayList a,ArrayList b)
        {
            int temp = 0;
            _A = a;
            _B = b;
            Console.WriteLine("{0} {1}",_A[9],_B[9]);
   
        }        

        public override void Start()
        {
            Console.WriteLine("In Start"); //Doesnt works;
            for (int i = 0; i < 100;i++ )
                _Res += (int)_A[i]*(int)_B[i];
        }
    }
    
    class MultiplierApplication
    {
        static GApplication ga;
        static int d1, d2 ,d3,d4;
        [STAThread]
        static void Main(string[] args)
        {
            Console.WriteLine("[enter] to start grid application ...");
            Console.ReadLine();
               
            // create grid application
            ga = new GApplication(new GConnection("localhost", 9000, "user", 
"user"));
            ga.ApplicationName = "Alchemi Tutorial - Alchemi sample";

            // add GridThread module (this executable) as a dependency
            ga.Manifest.Add(new 
ModuleDependency(typeof(MultiplierThread).Module));

            
            ArrayList[] arr1 = new ArrayList[100];
            for (int i = 0; i < 100; i++)
            {
                arr1[i] = new ArrayList();
            }

           

            ArrayList[] arr2 = new ArrayList[100];
            for (int i = 0; i < 100; i++)
            {
                arr2[i] = new ArrayList();
            }
            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    arr1[j].Add(1); 
                }
            }
            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    arr2[j].Add(i+j);
                }
            }
            
             
                // create and add 10 threads to the application
            for (int i = 0; i < 100; i++)
                for (int j = 0; j < 100; j++ )
                {
                    // create thread
                    MultiplierThread thread = new MultiplierThread(arr1[i], 
arr2[j]);

                    // add thread to application
                    ga.Threads.Add(thread);
                }

            // subscribe to events
            ga.ThreadFinish += new GThreadFinish(ThreadFinished);
            ga.ThreadFailed += new GThreadFailed(ThreadFailed);
            ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);
            
            // start application
            ga.Start();
            Console.WriteLine("Application  has started");

            Console.ReadLine();
        }

        static void ThreadFinished(GThread th)
        {
            // cast GThread back to MultiplierThread
            MultiplierThread thread = (MultiplierThread) th;
            Console.WriteLine("Done        Akshay");
            Console.WriteLine(
                "thread # {0} finished with result {1} ",
                thread.Id,
                thread.Result);
        }


        static void ThreadFailed(GThread th, Exception e)
        {
            Console.WriteLine(
                "thread # {0} finished with error '{1}'",
                th.Id,
                e.Message);
        }

        static void ApplicationFinished()
        {
            Console.WriteLine("\napplication finished");
            Console.WriteLine("\n[enter] to continue ...");
        }
    }
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
alchemi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alchemi-users

Reply via email to