00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static integer c__1 = 1;
00019 static integer c__100 = 100;
00020
00021 int MAIN__(void)
00022 {
00023
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
00038 real r__1;
00039
00040
00041 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00042
00043
00044 integer i__, j;
00045 real x[100], y[100], t1, t2, avg, alpha;
00046 extern int mysub_(integer *, real *, real *);
00047 extern doublereal second_(void);
00048 real tnosec;
00049
00050
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
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
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
00083 }
00084 alpha = .315f;
00085
00086
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
00093 }
00094 alpha = -alpha;
00095
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
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
00120 }
00121 alpha = -alpha;
00122 t2 = second_();
00123
00124 }
00125
00126
00127
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
00139
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 }
00151
00152 int mysub_(integer *n, real *x, real *y)
00153 {
00154
00155 --y;
00156 --x;
00157
00158
00159 return 0;
00160 }
00161
00162 int test4_ () { MAIN__ (); return 0; }