source: CIVL/examples/mpi/seq/matmat_spec.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/* FEVS: A Functional Equivalence Verification Suite for High-Performance
2 * Scientific Computing
3 *
4 * Copyright (C) 2010, Stephen F. Siegel, Timothy K. Zirkel,
5 * University of Delaware
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA.
21 */
22
23
24#include<stdio.h>
25#include<stdlib.h>
26#include<assert.h>
27
28int main(int argc, char* argv[]) {
29 int i, j, k;
30 int L = atoi(argv[1]);
31 int M = atoi(argv[2]);
32 int N = atoi(argv[3]);
33 double A[L][M];
34 double B[M][N];
35 double C[L][N];
36
37 FILE *fp =fopen("data", "r");
38 for (i = 0; i < L; i++)
39 for (j = 0; j < M; j++)
40 fscanf(fp,"%lf", &A[i][j]);
41 for (i = 0; i < M; i++)
42 for (j = 0; j < N; j++)
43 fscanf(fp,"%lf",&B[i][j]);
44 for (i = 0; i < L; i++)
45 for (j = 0; j < N; j++) {
46 C[i][j] = 0.0;
47 for (k = 0; k < M; k++)
48 C[i][j] += A[i][k] * B[k][j];
49 }
50 for (i = 0; i < L; i++) {
51 for (j = 0; j < N; j++)
52 printf("%f ", C[i][j]);
53 printf("\n");
54 }
55 printf("\n");
56 fclose(fp);
57 return 0;
58}
Note: See TracBrowser for help on using the repository browser.