daxpy dcopy计算
来源:互联网 发布:首字母大写php 编辑:程序博客网 时间:2024/05/16 04:35
daxpy每秒计算次数:
#include <stdio.h>#include <stdlib.h>#include <time.h>#include "cblas.h"#define ARRAY_LENGTH 1000000void main() { int n; /*! array size */ double da; /*! double constant */ double *dx; /*! input double array */ int incx; /*! input stride */ double *dy; /*! output double array */ int incy; /*! output stride */ int i; int warp_count = 0; int max_warp = 1000; long int count = 0; time_t b_second,l_second; time_t rawtime; struct tm * timeinfo; n = ARRAY_LENGTH; da = 99999; dx = (double*)malloc(sizeof(double)*n); incx = 1; dy = (double*)malloc(sizeof(double)*n); incy = 1; srand((unsigned)time(NULL)); for(i=0;i<n;i++){ dx[i] = rand(); dy[i] = rand(); //printf("%f ",dy[i]); //输出原来的dy } while(1){ b_second = time(NULL); l_second = b_second+1; while ((b_second=time(NULL))<l_second) { cblas_daxpy(n, da, dx,incx, dy, incy); //运行daxpy程序 count++; } time(&rawtime); timeinfo = localtime (&rawtime); printf("Time: %s ", asctime (timeinfo)); printf("%ld\n",count); count=0; warp_count++; if(warp_count==max_warp){ break; } }}
dcopy每秒计算次数:
#include <stdio.h>#include <stdlib.h>#include <time.h>#include "cblas.h"#define ARRAY_LENGTH 100000void main() { int n; /*! array size */ double *dx; /*! input double array */ int incx; /*! input stride */ double *dy; /*! output double array */ int incy; /*! output stride */ int i; int warp_count = 0; int max_warp = 1000; long int count = 0; time_t b_second,l_second; time_t rawtime; struct tm * timeinfo; n = ARRAY_LENGTH; dx = (double*)malloc(sizeof(double)*n); incx = 1; dy = (double*)malloc(sizeof(double)*n); incy = 1; srand((unsigned)time(NULL)); for(i=0;i<n;i++){ dx[i] = rand(); dy[i] = rand(); //printf("%f ",dy[i]); //输出原来的dy } while(1){ b_second = time(NULL); l_second = b_second+1; while ((b_second=time(NULL))<l_second) { cblas_dcopy(n, dx,incx, dy, incy); //运行dcopy程序 count++; } time(&rawtime); timeinfo = localtime (&rawtime); printf("Time: %s ", asctime (timeinfo)); printf("%ld\n",count); count=0; warp_count++; if(warp_count==max_warp){ break; } }}
0 0
- daxpy dcopy计算
- blas daxpy dcopy函数的使用
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算
- 计算计算个人所得税2010
- Java之集合类应用总结
- 第4周、项目1—建立单链表
- 关于寻路算法的一些思考(10):最短路径的用户体验
- [STM32/8经验] STM32 USB数据接收与数据发送
- 第三周项目2 建设“顺序表”算法库
- daxpy dcopy计算
- Processes and Threads 进程与线程
- 拉伸图片:创建一个内容可拉伸,而边角不拉伸的图片
- 第四周 项目3-单链表应用
- IOS解析json报错-[__NSCFString objectFromJSONString]: unrecognized selector sent to 解决办法
- CSS visibility 属性
- Python执行cmd的各种实现方法及优劣(subprocess.Popen, os.system和commands.getstatusoutput)
- 第三周实践项目1--顺序表的基本运算(3)插入.删除数据,初始化.销毁线性表
- Masonry -- 使用纯代码进行iOS应用的autolayout自适应布局