资源简介
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
- 下一篇:北邮数据结构实验代码及报告
相关资源
- 哈工大计算机系统实验实验八
- 哈工大计算机系统实验PPT
- 深入理解计算机系统 CSAPP原书第三版
- csapp arch lab 满分原创北大&cmu; 全集
- csapp proxy lab 满分原创北大&cmu; 仅供
- csapp malloc lab 原创北大&cmu; 仅供参考
- csapp.h csapp.c文件
- CSAPPLAB2实验报告
- csapp cache lab 满分原创北大&cmu; 仅供参
- csapp mountain.tar 存储山
- 深入理解计算机系统真题
- 中科大csapp实验4 perflab-handout 代码优化
- CSAPP: shell lab 解答
- 通过485Modbus读取DS18B20温度和控制LED(
- 编译原理实验 中间代码优化 代码 报
- 南京大学CSAPP lab5-9
- csapp中文第三版pdf(深入理解计算机操
- 计算机系统试卷
- 哈工大CSAPP期末考试题目.docx
- 哈工大计算机系统实验6
- CSAPP malloc lab答案满分
- 完整版csapp proxy lab 满分原创北大cmu
- CSAPP习题答案
- csapp lab malloclab
- 哈工大计算机系统实验lab4
- 哈工大计算机系统实验2程序以及实验
- 复旦961考研ppt数据结构 csapp 软件工程
评论
共有 条评论