secondtst.c
Go to the documentation of this file.
00001 /* secondtst.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Table of constant values */
00017 
00018 static integer c__1 = 1;
00019 static integer c__100 = 100;
00020 
00021 /* Main program */ int MAIN__(void)
00022 {
00023     /* Format strings */
00024     static char fmt_9999[] = "(\002 Time for 1,000,000 SAXPY ops  = \002,g10"
00025             ".3,\002 seconds\002)";
00026     static char fmt_9998[] = "(\002 SAXPY performance rate        = \002,g10"
00027             ".3,\002 mflops \002)";
00028     static char fmt_9994[] = "(\002 *** Error:  Time for operations was zer"
00029             "o\002)";
00030     static char fmt_9997[] = "(\002 Including SECOND, time        = \002,g10"
00031             ".3,\002 seconds\002)";
00032     static char fmt_9996[] = "(\002 Average time for SECOND       = \002,g10"
00033             ".3,\002 milliseconds\002)";
00034     static char fmt_9995[] = "(\002 Equivalent floating point ops = \002,g10"
00035             ".3,\002 ops\002)";
00036 
00037     /* System generated locals */
00038     real r__1;
00039 
00040     /* Builtin functions */
00041     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00042 
00043     /* Local variables */
00044     integer i__, j;
00045     real x[100], y[100], t1, t2, avg, alpha;
00046     extern /* Subroutine */ int mysub_(integer *, real *, real *);
00047     extern doublereal second_(void);
00048     real tnosec;
00049 
00050     /* Fortran I/O blocks */
00051     static cilist io___8 = { 0, 6, 0, fmt_9999, 0 };
00052     static cilist io___9 = { 0, 6, 0, fmt_9998, 0 };
00053     static cilist io___10 = { 0, 6, 0, fmt_9994, 0 };
00054     static cilist io___12 = { 0, 6, 0, fmt_9997, 0 };
00055     static cilist io___14 = { 0, 6, 0, fmt_9996, 0 };
00056     static cilist io___15 = { 0, 6, 0, fmt_9995, 0 };
00057 
00058 
00059 
00060 /*  -- LAPACK test routine (version 3.2) -- */
00061 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00062 /*     November 2006 */
00063 
00064 /*     .. Parameters .. */
00065 /*     .. */
00066 /*     .. Local Scalars .. */
00067 /*     .. */
00068 /*     .. Local Arrays .. */
00069 /*     .. */
00070 /*     .. External Functions .. */
00071 /*     .. */
00072 /*     .. Intrinsic Functions .. */
00073 /*     .. */
00074 /*     .. Executable Statements .. */
00075 
00076 
00077 /*     Initialize X and Y */
00078 
00079     for (i__ = 1; i__ <= 100; ++i__) {
00080         x[i__ - 1] = 1.f / (real) i__;
00081         y[i__ - 1] = (real) (100 - i__) / 100.f;
00082 /* L10: */
00083     }
00084     alpha = .315f;
00085 
00086 /*     Time 1,000,000 SAXPY operations */
00087 
00088     t1 = second_();
00089     for (j = 1; j <= 5000; ++j) {
00090         for (i__ = 1; i__ <= 100; ++i__) {
00091             y[i__ - 1] += alpha * x[i__ - 1];
00092 /* L20: */
00093         }
00094         alpha = -alpha;
00095 /* L30: */
00096     }
00097     t2 = second_();
00098     s_wsfe(&io___8);
00099     r__1 = t2 - t1;
00100     do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
00101     e_wsfe();
00102     if (t2 - t1 > 0.f) {
00103         s_wsfe(&io___9);
00104         r__1 = 1.f / (t2 - t1);
00105         do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
00106         e_wsfe();
00107     } else {
00108         s_wsfe(&io___10);
00109         e_wsfe();
00110     }
00111     tnosec = t2 - t1;
00112 
00113 /*     Time 1,000,000 SAXPY operations with SECOND in the outer loop */
00114 
00115     t1 = second_();
00116     for (j = 1; j <= 5000; ++j) {
00117         for (i__ = 1; i__ <= 100; ++i__) {
00118             y[i__ - 1] += alpha * x[i__ - 1];
00119 /* L40: */
00120         }
00121         alpha = -alpha;
00122         t2 = second_();
00123 /* L50: */
00124     }
00125 
00126 /*     Compute the time used in milliseconds used by an average call */
00127 /*     to SECOND. */
00128 
00129     s_wsfe(&io___12);
00130     r__1 = t2 - t1;
00131     do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
00132     e_wsfe();
00133     avg = (t2 - t1 - tnosec) * 1e3f / 5e3f;
00134     s_wsfe(&io___14);
00135     do_fio(&c__1, (char *)&avg, (ftnlen)sizeof(real));
00136     e_wsfe();
00137 
00138 /*     Compute the equivalent number of floating point operations used */
00139 /*     by an average call to SECOND. */
00140 
00141     if (tnosec > 0.f) {
00142         s_wsfe(&io___15);
00143         r__1 = avg * 1e3f / tnosec;
00144         do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
00145         e_wsfe();
00146     }
00147 
00148     mysub_(&c__100, x, y);
00149     return 0;
00150 } /* MAIN__ */
00151 
00152 /* Subroutine */ int mysub_(integer *n, real *x, real *y)
00153 {
00154     /* Parameter adjustments */
00155     --y;
00156     --x;
00157 
00158     /* Function Body */
00159     return 0;
00160 } /* mysub_ */
00161 
00162 /* Main program alias */ int test4_ () { MAIN__ (); return 0; }


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:01