00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
00092
00093
00094
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 }