/***************************************************************************Copyright (c) 2014, The OpenBLAS ProjectAll rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:1. Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer inthe documentation and/or other materials provided with thedistribution.3. Neither the name of the OpenBLAS project nor the names ofits contributors may be used to endorse or promote productsderived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THEUSE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*****************************************************************************/#include "bench.h"#undef DOT#ifdef DOUBLE#define DOT BLASFUNC(zdotu)#else#define DOT BLASFUNC(cdotu)#endifint main(int argc, char *argv[]){FLOAT *x, *y;FLOAT _Complex result;blasint m, i;blasint inc_x=1,inc_y=1;int loops = 1;int l;char *p;int from = 1;int to = 200;int step = 1;double time1,timeg;argc--;argv++;if (argc > 0) { from = atol(*argv); argc--; argv++;}if (argc > 0) { to = MAX(atol(*argv), from); argc--; argv++;}if (argc > 0) { step = atol(*argv); argc--; argv++;}if ((p = getenv("OPENBLAS_LOOPS"))) loops = atoi(p);if ((p = getenv("OPENBLAS_INCX"))) inc_x = atoi(p);if ((p = getenv("OPENBLAS_INCY"))) inc_y = atoi(p);fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Inc_y = %d Loops = %d\n", from, to, step,inc_x,inc_y,loops);if (( x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL){fprintf(stderr,"Out of Memory!!\n");exit(1);}if (( y = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_y) * COMPSIZE)) == NULL){fprintf(stderr,"Out of Memory!!\n");exit(1);}#ifdef __linuxsrandom(getpid());#endiffprintf(stderr, " SIZE Flops\n");for(m = from; m <= to; m += step){timeg=0;fprintf(stderr, " %6d : ", (int)m);for (l=0; l<loops; l++){for(i = 0; i < m * COMPSIZE * abs(inc_x); i++){x[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;}for(i = 0; i < m * COMPSIZE * abs(inc_y); i++){y[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;}begin();#ifdef RETURN_BY_STACKDOT (&result , &m, x, &inc_x, y, &inc_y );#elseresult = DOT (&m, x, &inc_x, y, &inc_y );#endifend();time1 = getsec();timeg += time1;}timeg /= loops;fprintf(stderr," %10.2f MFlops %10.6f sec\n",COMPSIZE * COMPSIZE * 2. * (double)m / timeg * 1.e-6, timeg);}return 0;}// void main(int argc, char *argv[]) __attribute__((weak, alias("MAIN__")));
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。