Im trying to create a distributed MPI class in java which will do some computations for me. Unfortunately, MPI.Init seems to need argv,argc which are in main class. Would there be a way to initialize MPI in this class?
public class distributed {
public distributed(int mat[][],int n,int m) throws MPIException {
MPI.Init(argv); // issue is here,i dont have "argv" to initialize with,causing null pointer exceptions in variables like "myrank"
final int myrank = MPI.COMM_WORLD.Rank();
final int size = MPI.COMM_WORLD.Size();
final int rows = n;
final int rowChunk = (rows+size-1)/size;
final int startRow = myrank *rowChunk;
int endRow = (myrank+1)*rowChunk;
int[] newRow = new int[m];
}
}