// UPC Matrix multiplication Example // a(N, P) is multiplied by b(P, M). Result is stored in c(N, M) // In this example, a is distributed by rows while b is distributed by columns. // We do use the upc_forall construct in this example #include #include #include "second_cpu.c" #include "conf.h" elem_t a[N/NUM_PROC][P]; elem_t c[N/NUM_PROC][M]; #define NUM_PROC 1 elem_t b[P][M]; int main(int argc, char** argv) { int i,j,l; double sec; elem_t sum; if (N % NUM_PROC) { printf("The number of lines must be a multiple of the number of processor (%d)\n", N, NUM_PROC); exit(1); } if (1!=NUM_PROC) { printf("Please reconfigure for the valid number of processors (%d).\n", NUM_PROC); exit(1); } // Collective arrays initialization for a for(i=0;i