资源简介
中科大程序设计与计算机系统,实验4,代码优化,亲测可用,版本优化相当高
代码片段和文件信息
/********************************************************
* Kernels to be optimized for the CS:APP Performance Lab
********************************************************/
#include
#include
#include “defs.h“
/*
* Please fill in the following team struct
*/
team_t team = {
“Seventh“ /* Team name */
“SA15226148“ /* First member full name */
“sa615148@mail.ustc.edu.cn“ /* First member email address */
“JG15225019“ /* Second member full name (leave blank if none) */
“909241007@qq.com“ /* Second member email addr (leave blank if none) */
};
/***************
* ROTATE KERNEL
***************/
/******************************************************
* Your different versions of the rotate kernel go here
******************************************************/
/*
* naive_rotate - The naive baseline version of rotate
*/
char naive_rotate_descr[] = “naive_rotate: Naive baseline implementation“;
void naive_rotate(int dim pixel *src pixel *dst)
{
int i j;
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
dst[RIDX(dim-1-j i dim)] = src[RIDX(i j dim)];
}
/*
* rotate - Your current working version of rotate
* IMPORTANT: This is the version you will be graded on
*/
char rotate_descr[] = “rotate: Current working version“;
void rotate(int dim pixel *src pixel *dst)
{
//change here
int ijk;
int stride = 32;
int count = dim >> 5;
src += dim - 1;
for (i=0; i for (j=0; j for (k=0; k *dst++ = *src;
src += dim;
}
src -= dim *stride + 1;
dst += dim - stride;
}
src += dim * (stride + 1);
dst -= dim * dim - stride;
}
}
/*********************************************************************
* register_rotate_functions - Register all of your different versions
* of the rotate kernel with the driver by calling the
* add_rotate_function() for each test function. When you run the
* driver program it will test and report the performance of each
* registered test function.
*********************************************************************/
void register_rotate_functions()
{
add_rotate_function(&naive_rotate naive_rotate_descr);
add_rotate_function(&rotate rotate_descr);
/* ... Register additional test functions here */
}
/***************
* SMOOTH KERNEL
**************/
/***************************************************************
* Various typedefs and helper functions for the smooth function
* You may modify these any way you like.
**************************************************************/
/* A struct used to compute averaged pixel value */
typedef struct {
int red;
int green;
int blue;
int num;
} pixel_sum;
/* Compute min and max of two integers respectively */
static int min(int a
相关资源
- CSAPP: shell lab 解答
- 中科大robotcup 2d底层整体代码介绍
- 无线自组织网络论文.rar
- 南京大学CSAPP lab5-9
- 中科大软院软件系统测试实验报告2
- csapp中文第三版pdf(深入理解计算机操
- perflab实验报告
- ustc组合数学试题
- 现代信号处理 姚天任华中科大出版
- 中科大数据库实现代码
- 保研中科大、北大、清华学长的保研
- 华中科大《电机学》课后习题答案
- 中科大人工智能总结+19年春季原题.
- 计算机系统试卷
- 中科大组合数学课后作业答案 许胤龙
- 哈工大CSAPP期末考试题目.docx
- 中科大高级计算机网络实验1 含代码实
- 中科大软院高图13级期末考试考前试卷
- 中科大软件学院软件系统建模复习资
- 哈工大计算机系统实验6
- 中科大算法导论答案1-13次全部 中科大
- 中科大软件工程考研408书和答案
- CSAPP malloc lab答案满分
- 中科大算法设计与分析课堂作业答案
- 中科大软院软件体系结构作业题目及
- 完整版csapp proxy lab 满分原创北大cmu
- 中科大软件学院高级网络作业答案
- CSAPP习题答案
- csapp lab malloclab
- 中科大 高网 实验3 代码+实验报告
评论
共有 条评论