source: CIVL/examples/mpi/seq/adder_spec.c@ bb03188

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