daxpy dcopy计算
2015-09-21 17:17
549 查看
daxpy每秒计算次数:
dcopy每秒计算次数:
[code]#include <stdio.h> #include <stdlib.h> #include <time.h> #include "cblas.h" #define ARRAY_LENGTH 1000000 void 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每秒计算次数:
[code]#include <stdio.h> #include <stdlib.h> #include <time.h> #include "cblas.h" #define ARRAY_LENGTH 100000 void 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; } } }
相关文章推荐
- 关于linux有效用户id的解释
- Linux sed命令解析
- CentOS iSCSI服务器搭建------Target篇
- PopupWindow实现右侧、左侧和底部弹出菜单
- LINUX文件锁定
- apache camle template , Adding Routes dynamically
- apache camle template , Adding Routes dynamically
- setsockopt()用法(参数详细说明)
- nginx+rtmp实现视频直播
- 性能测试监控关键指标说明
- myeclipse部署工程项目到tomcat中
- Linux知识(2)----fcitx输入法安装
- 使用OpenSSL生成证书
- CentOS 6.5上使用gdb调试时出现Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.i686 .
- block_dump观察Linux IO写入的具体文件
- windows远程(xrdp+vnc)连接ubuntu linux
- linux环境变量 export命令详解
- 推荐学习前端知识不错的网站
- OpenDaylight中MD-SAL学习笔记
- nvidia显卡上OpenCL的hello world程序