程序性能调优.doc

程序性能调优.doc

ID:59142087

大小:403.50 KB

页数:23页

时间:2020-09-11

程序性能调优.doc_第1页
程序性能调优.doc_第2页
程序性能调优.doc_第3页
程序性能调优.doc_第4页
程序性能调优.doc_第5页
资源描述:

《程序性能调优.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、实验题目:程序性能调优实验要求:本次实验,要求针对每个函数、每个人均至少写出3种优化版本、并根据driver报告的结果进行性能分析实验目的:理解编译器,学习程序优化,从优化程序代码和程序执行速度两方面着手。实验环境:WIN764位、ubuntu,VMwareworkstation,实验内容及操作步骤:将下载下来的kernels.c中的rotate、smooth函数进行优化。本实验的实验原理是通过循环展开、cache友好、替换变量等手段来实现程序优化。实验过程及分析:由于优化代码较长,就不进行截图。1.Naive_rotate1)原代码charnaive_rota

2、te_descr[]="naive_rotate:Naivebaselineimplementation";voidnaive_rotate(intdim,pixel*src,pixel*dst){inti,j;for(i=0;i

3、是从cache友好性来分析,这个代码的效率机会很低,所以按照cache的大小,应在存储的时候进行32个像素依次存储(列存储)。做到cache友好这样就可以可以大幅度提高效率。#include#include#include"defs.h"team_tteam={"8",/*队名*/"8",/*序号*/"@qq.com",/*邮箱*/"",/*Secondmemberfullname(leaveblankifnone)*/""/*Secondmemberemailaddr(leaveblankifnone)*/};/**nai

4、ve_rotate-Thenaivebaselineversionofrotate*/charnaive_rotate_descr[]="naive_rotate:Naivebaselineimplementation";voidnaive_rotate(intdim,pixel*src,pixel*dst){inti,j;for(i=0;i

5、ate*IMPORTANT:Thisistheversionyouwillbegradedon*/charrotate_descr[]="rotate:Currentworkingversion,usingpointerratherthancomputingaddress";voidrotate(intdim,pixel*src,pixel*dst){inti;intj;inttmp1=dim*dim;inttmp2=dim*31;inttmp3=tmp1-dim;inttmp4=tmp1+32;inttmp5=dim+31;dst+=tmp3;for(i=0;

6、i

7、st=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;dst++;src+=dim;*dst=*src;d

8、st++;src+=di

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。