[mpich-discuss] #error "unknown size for unsigned int."

Alejandro Allievi alejandro.allievi at gmail.com
Thu Nov 22 12:34:30 CST 2012


Hi,

The following matrix multiplication code does not execute in my
machine for MATRIX_ORDER greater than 400 or so, and I've got plenty
of memory. Is there anything I need to tweak in MPI.h for this to
work??

Thanks for any help.

Alejandro

#include <stdio.h>
#include "mpi.h"	/* for the Wtime() function only */

#define MATRIX_ORDER 400

typedef float MATRIX_T[MATRIX_ORDER][MATRIX_ORDER];

void serial_matrix_mult(MATRIX_T A, MATRIX_T B, MATRIX_T C, int n);

int main(int argc, char* argv[])
	{
	 MATRIX_T A;
	 MATRIX_T B;
	 MATRIX_T C;
	 int i, j;
	 double start, finish;
	 int p, my_rank;

	 MPI_Init(&argc,&argv);
	 MPI_Comm_size(MPI_COMM_WORLD, &p);
	 MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

	 for (i = 0; i < MATRIX_ORDER; i++)        /* initialize matrices     */
		for (j = 0; j < MATRIX_ORDER; j++) /* to an arbitrary value   */
			{
			 A[i][j] = 5;
			 B[i][j] = 5;
			}

	 start = MPI_Wtime();
	 serial_matrix_mult(A, B, C, MATRIX_ORDER);
	 finish = MPI_Wtime();
	
	 printf("Elapsed time in seconds is %e\n", finish - start );
	
	 MPI_Finalize();

	}



More information about the discuss mailing list