home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume21 / cloops / part01 / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-25  |  2.6 KB  |  123 lines

  1. /*
  2.  * This file is part of the Livermore Loops transliteration into C.
  3.  * Copyright (C) 1991 by Martin Fouts
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 1, or (at your option)
  8.  * any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. /*
  21.  * LLNL Fortran kernels, transliterated into C
  22.  */
  23.  
  24. #define PASSES 100
  25.  
  26. #include <stdio.h>
  27. #include "types.h"
  28. #include "data.h"
  29. #include "patchlevel.h"
  30.  
  31. long int DoTest = 0xFFFFFF;    /* Default: Run tests 1-24 */
  32. #ifdef COMPUTER
  33. Charp komput = COMPUTER;
  34. #else
  35. Charp komput = "Generic";
  36. #endif
  37. #ifdef COMPILER
  38. Charp kompil = COMPILER;
  39. #else
  40. Charp kompil = "Generic";
  41. #endif
  42.  
  43. Void kernel();
  44. Void report();
  45.  
  46. main(argc,argv)
  47. int argc;
  48. Charp argv[];
  49. {
  50.   Int iout = 6;
  51.   Int lset;
  52.   int i;
  53.   int cerr = 0;
  54.   int pflag = 0;
  55.   int tflag = 0;
  56.   long int tests = 0;
  57.   Float tock, tick();
  58.  
  59.   in_lp = PASSES;
  60.  
  61.   fprintf(stderr, "lloops: version 0.%d\n", PATCHLEVEL);
  62.  
  63.   for (i = 1; i < argc; i++) {
  64.     if (argv[i][0] != '-') {
  65.       fprintf(stderr,"Extra argument (%s) ignored.\n", argv[i]);
  66.       cerr++;
  67.       continue;
  68.     }
  69.     switch (argv[i][1]) {
  70.     case 'p':
  71.       if (pflag) {
  72.     fprintf(stderr,"Multiple -p ignored.\n");
  73.     cerr++;
  74.       } else {
  75.     pflag++;
  76.     if (i == argc - 1) {
  77.       fprintf(stderr,"-p takes argument\n");
  78.       cerr++;
  79.     } else {
  80.       in_lp = atoi(argv[++i]);
  81.       if (in_lp < 1) {
  82.         fprintf(stderr,"Nonpositive pass count!\n");
  83.         cerr++;
  84.       }
  85.     }
  86.       }
  87.       break;
  88.     case 't':
  89.       if (tflag) {
  90.     fprintf(stderr,"Multiple -t ignored.\n");
  91.     cerr++;
  92.       } else {
  93.     tflag++;
  94.     if (i == argc - 1) {
  95.       fprintf(stderr,"-t takes argument\n");
  96.       cerr++;
  97.     } else {
  98.       sscanf(argv[++i],"%x",&tests);
  99.       DoTest = tests;
  100.     }
  101.       }
  102.       break;
  103.     default:
  104.       fprintf(stderr,"Illegal option (%s) ignored.\n", argv[i]);
  105.       cerr++;
  106.       break;
  107.     }
  108.   }
  109.     
  110.   if (cerr) {
  111.     fprintf(stderr,"Usage: %s [-p passes] [-t tests]\n", argv[0]);
  112.     exit(1);
  113.   }
  114.       
  115.   for (lset = 0; lset < 3; lset++) {
  116.     tock = tick(iout, lset);
  117.     kernel();
  118.     report(iout, (Int)24, tock, komput, kompil);
  119.   }
  120.  
  121.   exit(0);
  122. }
  123.