org/objectweb/proactive/ext/security/test/jacobi/Jacobi.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.ext.security.test.jacobi;
00032 
00033 import org.objectweb.proactive.ActiveObjectCreationException;
00034 import org.objectweb.proactive.ProActive;
00035 import org.objectweb.proactive.core.ProActiveException;
00036 import org.objectweb.proactive.core.descriptor.data.ProActiveDescriptor;
00037 import org.objectweb.proactive.core.descriptor.data.VirtualNode;
00038 import org.objectweb.proactive.core.group.spmd.ProSPMD;
00039 import org.objectweb.proactive.core.mop.ClassNotReifiableException;
00040 import org.objectweb.proactive.core.node.NodeException;
00041 
00042 
00046 public class Jacobi {
00047 
00051     public static final int WIDTH = 4;
00052 
00056     public static final int HEIGHT = 4;
00057 
00061     public static final int ITERATIONS = 100;
00062 
00066     public static final double MINDIFF = 0.01;
00067 
00071     public static final double DEFAULT_BORDER_VALUE = 0;
00072 
00073     public static void main(String[] args) {
00074         ProActiveDescriptor proActiveDescriptor = null;
00075         String[] nodes = null;
00076         try {
00077             proActiveDescriptor = ProActive.getProactiveDescriptor("file:" +
00078                     args[0]);
00079         } catch (ProActiveException e) {
00080             System.err.println("** ProActiveException **");
00081             e.printStackTrace();
00082         }
00083         proActiveDescriptor.activateMappings();
00084         VirtualNode vn = proActiveDescriptor.getVirtualNode("matrixNode");
00085         try {
00086             nodes = vn.getNodesURL();
00087         } catch (NodeException e) {
00088             System.err.println("** NodeException **");
00089         }
00090 
00091         //              String[] nodes = { "//crusoe:1243/node1", "//crusoe:1244/node2", "//crusoe:1246/node4",
00092         //                                                                         "//crusoe:1246/node4", "//crusoe:1245/node3", "//crusoe:1246/node4",
00093         //                                                                         "//crusoe:1246/node4", "//crusoe:1246/node4", "//crusoe:1246/node4" };
00094         //              String[] nodes = { "//tuba:6512/node1", "//scurra:6512/node2", "//lo:6512/node3", "//wapiti:6512/node4" };
00095         Object[][] params = new Object[Jacobi.WIDTH * Jacobi.HEIGHT][];
00096         for (int i = 0; i < params.length; i++) {
00097             params[i] = new Object[1];
00098             params[i][0] = "SubMatrix" + i;
00099         }
00100 
00101         SubMatrix matrix = null;
00102         try {
00103             matrix = (SubMatrix) ProSPMD.newSPMDGroup(SubMatrix.class.getName(),
00104                     params, nodes);
00105         } catch (ClassNotFoundException e) {
00106             System.err.println("** ClassNotFoundException **");
00107         } catch (ClassNotReifiableException e) {
00108             System.err.println("** ClassNotReifiableException **");
00109         } catch (ActiveObjectCreationException e) {
00110             e.printStackTrace();
00111             System.err.println("** ActiveObjectCreationException **");
00112         } catch (NodeException e) {
00113             System.err.println("** NodeException **");
00114         }
00115 
00116         matrix.compute();
00117     }
00118 }

Generated on Mon Jan 22 15:16:11 2007 for ProActive by  doxygen 1.5.1