Ver código fonte

mpi/examples/cholesky/mpi_cholesky_distributed.c: use block distribution

Nathalie Furmento 12 anos atrás
pai
commit
674e3dcca2
1 arquivos alterados com 18 adições e 1 exclusões
  1. 18 1
      mpi/examples/cholesky/mpi_cholesky_distributed.c

+ 18 - 1
mpi/examples/cholesky/mpi_cholesky_distributed.c

@@ -24,7 +24,8 @@
 /* Returns the MPI node number where data indexes index is */
 int my_distrib(int x, int y, int nb_nodes)
 {
-	return (x+y) % nb_nodes;
+	//return (x+y) % nb_nodes;
+	return (x%dblockx)+(y%dblocky)*dblockx;
 }
 
 int main(int argc, char **argv)
@@ -44,6 +45,22 @@ int main(int argc, char **argv)
 	starpu_mpi_initialize_extended(&rank, &nodes);
 	starpu_helper_cublas_init();
 
+	if (dblockx == -1 || dblocky == -1)
+	{
+	     int factor;
+	     dblockx = nodes;
+	     dblocky = 1;
+	     for(factor=sqrt(nodes) ; factor>1 ; factor--)
+	     {
+		  if (nodes % factor == 0)
+		  {
+		       dblockx = nodes/factor;
+		       dblocky = factor;
+		       break;
+		  }
+	     }
+	}
+
 	unsigned i,j,x,y;
 	bmat = malloc(nblocks * sizeof(float *));
 	for(x=0 ; x<nblocks ; x++)