java - Matrix Multiplication MPI not compiling -
im trying compile below code in jdk doesnt seem compile, getting error not statement on line 41 though is.
the line causing error is:
long endtime = system.currenttimemillis();
here code:
import mpi.*; public class multidimmatrix { public static final int n = 10; public static void main (string args[]){ mpi.init(args); long starttime = system.currenttimemillis(); int rank = mpi.comm_world.rank(); int size = mpi.comm_world.size(); int tag = 10, peer = (rank==0) ? 1:0; if(rank == 0) { double [][] = new double [n][n]; for(int = 0; < n; i++) for(int j = 0; j < n; j++) a[i][j] = 10.0; object[] sendobjectarray = new object[1]; sendobjectarray[0] = (object) a; mpi.comm_world.send(sendobjectarray, 0, 1, mpi.object, peer, tag); } else if(rank == 1){ double [][] b = new double [n][n]; for(int = 0; < n; i++) for(int j = 0; j < n; i++) b[i][j] = 0; object[] recvobjectarray = new object[1]; mpi.comm_world.recv(recvobjectarray, 0, 1, mpi.object, peer, tag); b = (double[][]) recvobjectarray[0]; for(int = 0; < 4; i++){ for(int j = 0; j < n; i++) long endtime = system.currenttimemillis(); system.out.print(b[i][j]+"\t"); system.out.println("\n"); system.out.println("calculated in " + (endtime - starttime) + " milliseconds"); } } mpi.finalize() ; } }
any appreciated!
you have
for(int j = 0; j < n; i++)
should
for(int j = 0; j < n; i++) {
you should keep source formatted - ide's can automatically (on save or keyboard command). problem obvious after formatting.
Comments
Post a Comment