Browse Source

mpi_redux: allocate exactly the comm size

not STARPU_MAXNODES which is completely unrelated to MPI
Samuel Thibault 4 years ago
parent
commit
55b0ad436b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      mpi/src/starpu_mpi_task_insert.c

+ 4 - 2
mpi/src/starpu_mpi_task_insert.c

@@ -621,9 +621,11 @@ int _starpu_mpi_task_postbuild_v(MPI_Comm comm, int xrank, int do_execute, struc
 		{
 			struct _starpu_mpi_data *mpi_data = (struct _starpu_mpi_data *) descrs[i].handle->mpi_data;
 			if (me == starpu_mpi_data_get_rank(descrs[i].handle))
-			{ 
+			{
+				int size;
+				starpu_mpi_comm_size(comm, &size);
 				if (mpi_data->redux_map == NULL)
-					_STARPU_CALLOC(mpi_data->redux_map, STARPU_MAXNODES, sizeof(mpi_data->redux_map[0]));
+					_STARPU_CALLOC(mpi_data->redux_map, size, sizeof(mpi_data->redux_map[0]));
 				mpi_data->redux_map [xrank] = 1;
 			}
 			else if (me == xrank)