资源简介
CMU大学的CSAPP中实验Code Optimization 的解答,只上传了有用的kernel.c
代码片段和文件信息
/********************************************************
* 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 = {
“5070379044“ /* Team name */
“Wang Qi“ /* First member full name */
“13767230@qq.com“ /* First member email address */
““ /* Second member full name (leave blank if none) */
““ /* 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)
{
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 int b) { return (a < b ? a : b); }
static int max(int a int b) { return (a > b ? a : b); }
/*
* i
- 上一篇:recycleview.zip
- 下一篇:北邮数据结构实验代码及报告
相关资源
- csapp
- 主要针对CPU模拟卡进行了代码优化.注
- CSAPP bomblab实验报告
- csapp第三版蓝光版
- CSAPP课件-中科大
- 深入理解计算机系统 (第三版) 英文
- 深入理解计算机系统-Computer Systems A
- CSAPP
- CSAPP 英文版
- 深入理解计算机系统实验指导及答案
- Computer.Systems.A.Programmers.Perspective.3rd
- CSAPP: malloc lab 文档及解答
- CSAPP_buflab 解答详细过程(内含源程序
- CSAPP笔记PDF
- csapp深入理解计算机系统第三版 实验
- csapp的shlab-handout
- csapp英文第三版官方正式版非扫锚版
- CSAPP 英文 第3版 文字版
- 湖南大学CSAPP课程实验LAB1
- 哈工大csapp课件.rar
- CSAPP性能优化实验
- csapp lab6 malloc lab 96pt
- iOS 编码规范
- ics lab8 perflab性能优化实验
- CSAPP 六个重要实验 lab4 实验指导书
- csapp proxylab
- csapp lab archlab 解答
- 深入理解计算机系统原书第三版中文
- 哈工大计算机系统实验实验八
- 哈工大计算机系统实验PPT
评论
共有 条评论