资源简介
中科大程序设计与计算机系统,实验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
相关资源
- 中科大首次实现全光量子中继
- csapp203483
- 中科大软院软件测试3
- 中科大软院软侧实验1
- 2-数理统计学教程陈希孺编著2009中科
- 概率论与数理统计陈希孺编著2009中科
- 中科大信号与系统辅导课笔记
- 2.5 SDNv2.pdf-中科大高级计算机网络课件
- CSAPP bomblab实验报告
- csapp第三版蓝光版
- 华中科大组成原理课件
- 中科大834考研微机原理与接口技术周
- 多速率数字信号处理_中科大
- 中科大2019智能控制考试试卷.docx
- 近世代数引论(第3版) 冯克勤 李尚
- 中科大多速率数字信号处理课件及作
- 中科大历年软件工程考研真题
- 中科大计算机模式识别读书报告作业
- 偏微分方程:第二版_中科大_陈祖墀编
- CSAPP课件-中科大
- 软件体系结构作业和答案 2019级中科大
- 中科大算法导论期末考试试卷
- 深入理解计算机系统 (第三版) 英文
- 中科大密码学
- 华中科大先进光通信系统课件
- 中科大并行计算经典课件
- 中科大自然语言理解课程ppt含往年试
- 中国科学技术大学-研究生组合数学
- 算法导论的教学配套ppt——中科大
- 中科大软院软件体系结构笔记Basic C
评论
共有 条评论