changing of examples
This commit is contained in:
@@ -60,7 +60,7 @@ using namespace ispc;
|
||||
|
||||
extern void ao_serial(int w, int h, int nsubsamples, float image[]);
|
||||
|
||||
static unsigned int test_iterations;
|
||||
static unsigned int test_iterations[] = {3, 7, 1};
|
||||
static unsigned int width, height;
|
||||
static unsigned char *img;
|
||||
static float *fimg;
|
||||
@@ -106,16 +106,20 @@ savePPM(const char *fname, int w, int h)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 4) {
|
||||
if (argc < 3) {
|
||||
printf ("%s\n", argv[0]);
|
||||
printf ("Usage: ao [num test iterations] [width] [height]\n");
|
||||
printf ("Usage: ao [width] [height] [ispc iterations] [tasks iterations] [serial iterations]\n");
|
||||
getchar();
|
||||
exit(-1);
|
||||
}
|
||||
else {
|
||||
test_iterations = atoi(argv[1]);
|
||||
width = atoi (argv[2]);
|
||||
height = atoi (argv[3]);
|
||||
if (argc == 6) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
test_iterations[i] = atoi(argv[3 + i]);
|
||||
}
|
||||
}
|
||||
width = atoi (argv[1]);
|
||||
height = atoi (argv[2]);
|
||||
}
|
||||
|
||||
// Allocate space for output images
|
||||
@@ -127,13 +131,14 @@ int main(int argc, char **argv)
|
||||
// time for any of them.
|
||||
//
|
||||
double minTimeISPC = 1e30;
|
||||
for (unsigned int i = 0; i < test_iterations; i++) {
|
||||
for (unsigned int i = 0; i < test_iterations[0]; i++) {
|
||||
memset((void *)fimg, 0, sizeof(float) * width * height * 3);
|
||||
assert(NSUBSAMPLES == 2);
|
||||
|
||||
reset_and_start_timer();
|
||||
ao_ispc(width, height, NSUBSAMPLES, fimg);
|
||||
double t = get_elapsed_mcycles();
|
||||
printf("@time of ISPC run:\t\t\t[%.3f] million cycles\n", t);
|
||||
minTimeISPC = std::min(minTimeISPC, t);
|
||||
}
|
||||
|
||||
@@ -147,13 +152,14 @@ int main(int argc, char **argv)
|
||||
// minimum time for any of them.
|
||||
//
|
||||
double minTimeISPCTasks = 1e30;
|
||||
for (unsigned int i = 0; i < test_iterations; i++) {
|
||||
for (unsigned int i = 0; i < test_iterations[1]; i++) {
|
||||
memset((void *)fimg, 0, sizeof(float) * width * height * 3);
|
||||
assert(NSUBSAMPLES == 2);
|
||||
|
||||
reset_and_start_timer();
|
||||
ao_ispc_tasks(width, height, NSUBSAMPLES, fimg);
|
||||
double t = get_elapsed_mcycles();
|
||||
printf("@time of ISPC + TASKS run:\t\t\t[%.3f] million cycles\n", t);
|
||||
minTimeISPCTasks = std::min(minTimeISPCTasks, t);
|
||||
}
|
||||
|
||||
@@ -167,11 +173,12 @@ int main(int argc, char **argv)
|
||||
// minimum time.
|
||||
//
|
||||
double minTimeSerial = 1e30;
|
||||
for (unsigned int i = 0; i < test_iterations; i++) {
|
||||
for (unsigned int i = 0; i < test_iterations[2]; i++) {
|
||||
memset((void *)fimg, 0, sizeof(float) * width * height * 3);
|
||||
reset_and_start_timer();
|
||||
ao_serial(width, height, NSUBSAMPLES, fimg);
|
||||
double t = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t\t[%.3f] million cycles\n", t);
|
||||
minTimeSerial = std::min(minTimeSerial, t);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,10 +62,16 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc != 2) {
|
||||
printf("usage: deferred_shading <input_file (e.g. data/pp1280x720.bin)>\n");
|
||||
if (argc < 2) {
|
||||
printf("usage: deferred_shading <input_file (e.g. data/pp1280x720.bin)> [tasks iterations] [serial iterations]\n");
|
||||
return 1;
|
||||
}
|
||||
static unsigned int test_iterations[] = {5, 3, 500}; //last value is for nframes, it is scale.
|
||||
if (argc == 5) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
test_iterations[i] = atoi(argv[2 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
InputData *input = CreateInputDataFromFile(argv[1]);
|
||||
if (!input) {
|
||||
@@ -81,9 +87,9 @@ int main(int argc, char** argv) {
|
||||
InitDynamicCilk(input);
|
||||
#endif // __cilk
|
||||
|
||||
int nframes = 5;
|
||||
int nframes = test_iterations[2];
|
||||
double ispcCycles = 1e30;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
framebuffer.clear();
|
||||
reset_and_start_timer();
|
||||
for (int j = 0; j < nframes; ++j)
|
||||
@@ -91,6 +97,7 @@ int main(int argc, char** argv) {
|
||||
VISUALIZE_LIGHT_COUNT,
|
||||
framebuffer.r, framebuffer.g, framebuffer.b);
|
||||
double mcycles = get_elapsed_mcycles() / nframes;
|
||||
printf("@time of ISPC + TASKS run:\t\t\t[%.3f] million cycles\n", mcycles);
|
||||
ispcCycles = std::min(ispcCycles, mcycles);
|
||||
}
|
||||
printf("[ispc static + tasks]:\t\t[%.3f] million cycles to render "
|
||||
@@ -98,14 +105,16 @@ int main(int argc, char** argv) {
|
||||
input->header.framebufferWidth, input->header.framebufferHeight);
|
||||
WriteFrame("deferred-ispc-static.ppm", input, framebuffer);
|
||||
|
||||
nframes = 3;
|
||||
#ifdef __cilk
|
||||
double dynamicCilkCycles = 1e30;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
framebuffer.clear();
|
||||
reset_and_start_timer();
|
||||
for (int j = 0; j < nframes; ++j)
|
||||
DispatchDynamicCilk(input, &framebuffer);
|
||||
double mcycles = get_elapsed_mcycles() / nframes;
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", mcycles);
|
||||
dynamicCilkCycles = std::min(dynamicCilkCycles, mcycles);
|
||||
}
|
||||
printf("[ispc + Cilk dynamic]:\t\t[%.3f] million cycles to render image\n",
|
||||
@@ -114,12 +123,13 @@ int main(int argc, char** argv) {
|
||||
#endif // __cilk
|
||||
|
||||
double serialCycles = 1e30;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
framebuffer.clear();
|
||||
reset_and_start_timer();
|
||||
for (int j = 0; j < nframes; ++j)
|
||||
DispatchDynamicC(input, &framebuffer);
|
||||
double mcycles = get_elapsed_mcycles() / nframes;
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", mcycles);
|
||||
serialCycles = std::min(serialCycles, mcycles);
|
||||
}
|
||||
printf("[C++ serial dynamic, 1 core]:\t[%.3f] million cycles to render image\n",
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <algorithm>
|
||||
#include "../timing.h"
|
||||
#include "mandelbrot_ispc.h"
|
||||
#include <string.h>
|
||||
using namespace ispc;
|
||||
|
||||
extern void mandelbrot_serial(float x0, float y0, float x1, float y1,
|
||||
@@ -67,7 +68,8 @@ writePPM(int *buf, int width, int height, const char *fn) {
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
int main(int argc, char *argv[]) {
|
||||
static unsigned int test_iterations[] = {3, 3};
|
||||
unsigned int width = 768;
|
||||
unsigned int height = 512;
|
||||
float x0 = -2;
|
||||
@@ -75,6 +77,19 @@ int main() {
|
||||
float y0 = -1;
|
||||
float y1 = 1;
|
||||
|
||||
if (argc > 1) {
|
||||
if (strncmp(argv[1], "--scale=", 8) == 0) {
|
||||
float scale = atof(argv[1] + 8);
|
||||
width *= scale;
|
||||
height *= scale;
|
||||
}
|
||||
}
|
||||
if ((argc == 3) || (argc == 4)) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
test_iterations[i] = atoi(argv[argc - 2 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
int maxIterations = 256;
|
||||
int *buf = new int[width*height];
|
||||
|
||||
@@ -83,10 +98,11 @@ int main() {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
mandelbrot_ispc(x0, y0, x1, y1, width, height, maxIterations, buf);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minISPC = std::min(minISPC, dt);
|
||||
}
|
||||
|
||||
@@ -102,10 +118,11 @@ int main() {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
mandelbrot_serial(x0, y0, x1, y1, width, height, maxIterations, buf);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minSerial = std::min(minSerial, dt);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,21 +69,20 @@ writePPM(int *buf, int width, int height, const char *fn) {
|
||||
|
||||
|
||||
static void usage() {
|
||||
fprintf(stderr, "usage: mandelbrot [--scale=<factor>]\n");
|
||||
fprintf(stderr, "usage: mandelbrot [--scale=<factor>] [tasks iterations] [serial iterations]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
unsigned int width = 1536 * 8;
|
||||
unsigned int height = 1024 * 8;
|
||||
static unsigned int test_iterations[] = {7, 1};
|
||||
unsigned int width = 1536;
|
||||
unsigned int height = 1024;
|
||||
float x0 = -2;
|
||||
float x1 = 1;
|
||||
float y0 = -1;
|
||||
float y1 = 1;
|
||||
|
||||
if (argc == 1)
|
||||
;
|
||||
else if (argc == 2) {
|
||||
if (argc > 1) {
|
||||
if (strncmp(argv[1], "--scale=", 8) == 0) {
|
||||
float scale = atof(argv[1] + 8);
|
||||
if (scale == 0.f)
|
||||
@@ -94,11 +93,13 @@ int main(int argc, char *argv[]) {
|
||||
width = (width + 0xf) & ~0xf;
|
||||
height = (height + 0xf) & ~0xf;
|
||||
}
|
||||
else
|
||||
usage();
|
||||
}
|
||||
else
|
||||
usage();
|
||||
if ((argc == 3) || (argc == 4)) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
test_iterations[i] = atoi(argv[argc - 2 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int maxIterations = 512;
|
||||
int *buf = new int[width*height];
|
||||
@@ -108,13 +109,14 @@ int main(int argc, char *argv[]) {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
// Clear out the buffer
|
||||
for (unsigned int i = 0; i < width * height; ++i)
|
||||
buf[i] = 0;
|
||||
reset_and_start_timer();
|
||||
mandelbrot_ispc(x0, y0, x1, y1, width, height, maxIterations, buf);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC + TASKS run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minISPC = std::min(minISPC, dt);
|
||||
}
|
||||
|
||||
@@ -127,13 +129,14 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
// Clear out the buffer
|
||||
for (unsigned int i = 0; i < width * height; ++i)
|
||||
buf[i] = 0;
|
||||
reset_and_start_timer();
|
||||
mandelbrot_serial(x0, y0, x1, y1, width, height, maxIterations, buf);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minSerial = std::min(minSerial, dt);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <algorithm>
|
||||
#include "../timing.h"
|
||||
#include "noise_ispc.h"
|
||||
#include <string.h>
|
||||
using namespace ispc;
|
||||
|
||||
extern void noise_serial(float x0, float y0, float x1, float y1,
|
||||
@@ -65,14 +66,27 @@ writePPM(float *buf, int width, int height, const char *fn) {
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
unsigned int width = 768 * 4;
|
||||
unsigned int height = 768 * 4;
|
||||
int main(int argc, char *argv[]) {
|
||||
static unsigned int test_iterations[] = {3, 1};
|
||||
unsigned int width = 768;
|
||||
unsigned int height = 768;
|
||||
float x0 = -10;
|
||||
float x1 = 10;
|
||||
float y0 = -10;
|
||||
float y1 = 10;
|
||||
|
||||
if (argc > 1) {
|
||||
if (strncmp(argv[1], "--scale=", 8) == 0) {
|
||||
float scale = atof(argv[1] + 8);
|
||||
width *= scale;
|
||||
height *= scale;
|
||||
}
|
||||
}
|
||||
if ((argc == 3) || (argc == 4)) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
test_iterations[i] = atoi(argv[argc - 2 + i]);
|
||||
}
|
||||
}
|
||||
float *buf = new float[width*height];
|
||||
|
||||
//
|
||||
@@ -80,10 +94,11 @@ int main() {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
noise_ispc(x0, y0, x1, y1, width, height, buf);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minISPC = std::min(minISPC, dt);
|
||||
}
|
||||
|
||||
@@ -99,10 +114,11 @@ int main() {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
noise_serial(x0, y0, x1, y1, width, height, buf);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minSerial = std::min(minSerial, dt);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,27 +96,27 @@ static void writeImage(int *idImage, float *depthImage, int width, int height,
|
||||
|
||||
|
||||
static void usage() {
|
||||
fprintf(stderr, "rt [--scale=<factor>] <scene name base>\n");
|
||||
fprintf(stderr, "rt <scene name base> [--scale=<factor>] [ispc iterations] [tasks iterations] [serial iterations]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
static unsigned int test_iterations[] = {3, 7, 1};
|
||||
float scale = 1.f;
|
||||
const char *filename = NULL;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (strncmp(argv[i], "--scale=", 8) == 0) {
|
||||
scale = atof(argv[i] + 8);
|
||||
if (scale == 0.f)
|
||||
usage();
|
||||
if (argc < 2) usage();
|
||||
filename = argv[1];
|
||||
if (argc > 2) {
|
||||
if (strncmp(argv[2], "--scale=", 8) == 0) {
|
||||
scale = atof(argv[2] + 8);
|
||||
}
|
||||
}
|
||||
if ((argc == 6) || (argc == 5)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
test_iterations[i] = atoi(argv[argc - 3 + i]);
|
||||
}
|
||||
else if (filename != NULL)
|
||||
usage();
|
||||
else
|
||||
filename = argv[i];
|
||||
}
|
||||
if (filename == NULL)
|
||||
usage();
|
||||
|
||||
#define READ(var, n) \
|
||||
if (fread(&(var), sizeof(var), n, f) != (unsigned int)n) { \
|
||||
@@ -211,11 +211,12 @@ int main(int argc, char *argv[]) {
|
||||
// Run 3 iterations with ispc + 1 core, record the minimum time
|
||||
//
|
||||
double minTimeISPC = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
raytrace_ispc(width, height, baseWidth, baseHeight, raster2camera,
|
||||
camera2world, image, id, nodes, triangles);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minTimeISPC = std::min(dt, minTimeISPC);
|
||||
}
|
||||
printf("[rt ispc, 1 core]:\t\t[%.3f] million cycles for %d x %d image\n",
|
||||
@@ -230,11 +231,12 @@ int main(int argc, char *argv[]) {
|
||||
// Run 3 iterations with ispc + 1 core, record the minimum time
|
||||
//
|
||||
double minTimeISPCtasks = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
raytrace_ispc_tasks(width, height, baseWidth, baseHeight, raster2camera,
|
||||
camera2world, image, id, nodes, triangles);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC + TASKS run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minTimeISPCtasks = std::min(dt, minTimeISPCtasks);
|
||||
}
|
||||
printf("[rt ispc + tasks]:\t\t[%.3f] million cycles for %d x %d image\n",
|
||||
@@ -250,11 +252,12 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minTimeSerial = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[2]; ++i) {
|
||||
reset_and_start_timer();
|
||||
raytrace_serial(width, height, baseWidth, baseHeight, raster2camera,
|
||||
camera2world, image, id, nodes, triangles);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minTimeSerial = std::min(dt, minTimeSerial);
|
||||
}
|
||||
printf("[rt serial]:\t\t\t[%.3f] million cycles for %d x %d image\n",
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "../timing.h"
|
||||
#include "stencil_ispc.h"
|
||||
@@ -66,9 +67,25 @@ void InitData(int Nx, int Ny, int Nz, float *A[2], float *vsq) {
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
int Nx = 256 * 2, Ny = 256 * 2, Nz = 256 * 2;
|
||||
int main(int argc, char *argv[]) {
|
||||
static unsigned int test_iterations[] = {3, 3, 3};//the last two numbers must be equal here
|
||||
int Nx = 256, Ny = 256, Nz = 256;
|
||||
int width = 4;
|
||||
|
||||
if (argc > 1) {
|
||||
if (strncmp(argv[1], "--scale=", 8) == 0) {
|
||||
float scale = atof(argv[1] + 8);
|
||||
Nx *= scale;
|
||||
Ny *= scale;
|
||||
Nz *= scale;
|
||||
}
|
||||
}
|
||||
if ((argc == 4) || (argc == 5)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
test_iterations[i] = atoi(argv[argc - 3 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
float *Aserial[2], *Aispc[2];
|
||||
Aserial[0] = new float [Nx * Ny * Nz];
|
||||
Aserial[1] = new float [Nx * Ny * Nz];
|
||||
@@ -79,18 +96,18 @@ int main() {
|
||||
float coeff[4] = { 0.5, -.25, .125, -.0625 };
|
||||
|
||||
InitData(Nx, Ny, Nz, Aispc, vsq);
|
||||
|
||||
//
|
||||
// Compute the image using the ispc implementation on one core; report
|
||||
// the minimum time of three runs.
|
||||
//
|
||||
double minTimeISPC = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
loop_stencil_ispc(0, 6, width, Nx - width, width, Ny - width,
|
||||
width, Nz - width, Nx, Ny, Nz, coeff, vsq,
|
||||
Aispc[0], Aispc[1]);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minTimeISPC = std::min(minTimeISPC, dt);
|
||||
}
|
||||
|
||||
@@ -103,12 +120,13 @@ int main() {
|
||||
// the minimum time of three runs.
|
||||
//
|
||||
double minTimeISPCTasks = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
loop_stencil_ispc_tasks(0, 6, width, Nx - width, width, Ny - width,
|
||||
width, Nz - width, Nx, Ny, Nz, coeff, vsq,
|
||||
Aispc[0], Aispc[1]);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC + TASKS run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minTimeISPCTasks = std::min(minTimeISPCTasks, dt);
|
||||
}
|
||||
|
||||
@@ -121,12 +139,13 @@ int main() {
|
||||
// minimum time.
|
||||
//
|
||||
double minTimeSerial = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[2]; ++i) {
|
||||
reset_and_start_timer();
|
||||
loop_stencil_serial(0, 6, width, Nx-width, width, Ny - width,
|
||||
width, Nz - width, Nx, Ny, Nz, coeff, vsq,
|
||||
Aserial[0], Aserial[1]);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minTimeSerial = std::min(minTimeSerial, dt);
|
||||
}
|
||||
|
||||
|
||||
@@ -135,10 +135,16 @@ loadVolume(const char *fn, int n[3]) {
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "usage: volume <camera.dat> <volume_density.vol>\n");
|
||||
static unsigned int test_iterations[] = {3, 7, 1};
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "usage: volume <camera.dat> <volume_density.vol> [ispc iterations] [tasks iterations] [serial iterations]\n");
|
||||
return 1;
|
||||
}
|
||||
if (argc == 6) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
test_iterations[i] = atoi(argv[3 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Load viewing data and the volume density data
|
||||
@@ -156,11 +162,12 @@ int main(int argc, char *argv[]) {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
volume_ispc(density, n, raster2camera, camera2world,
|
||||
width, height, image);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minISPC = std::min(minISPC, dt);
|
||||
}
|
||||
|
||||
@@ -176,11 +183,12 @@ int main(int argc, char *argv[]) {
|
||||
// tasks; report the minimum time of three runs.
|
||||
//
|
||||
double minISPCtasks = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
volume_ispc_tasks(density, n, raster2camera, camera2world,
|
||||
width, height, image);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of ISPC + TASKS run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minISPCtasks = std::min(minISPCtasks, dt);
|
||||
}
|
||||
|
||||
@@ -196,11 +204,12 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < test_iterations[2]; ++i) {
|
||||
reset_and_start_timer();
|
||||
volume_serial(density, n, raster2camera, camera2world,
|
||||
width, height, image);
|
||||
double dt = get_elapsed_mcycles();
|
||||
printf("@time of serial run:\t\t\t[%.3f] million cycles\n", dt);
|
||||
minSerial = std::min(minSerial, dt);
|
||||
}
|
||||
|
||||
|
||||
14
perf.ini
14
perf.ini
@@ -8,26 +8,29 @@
|
||||
% #***
|
||||
% [% comment]
|
||||
%****************************************************************************************************
|
||||
% All parameters of iteration number must be at the end of command string. Now all of the, are default (3 7 1).
|
||||
AOBench
|
||||
aobench
|
||||
3 2048 2048
|
||||
% --scale= from parameters
|
||||
2048 2048
|
||||
#***
|
||||
Deferred Shading
|
||||
deferred
|
||||
% --scale= from data and third parameter
|
||||
data/pp1280x720.bin
|
||||
#***
|
||||
Mandelbrot Set
|
||||
mandelbrot
|
||||
|
||||
--scale=1.0
|
||||
#***
|
||||
Mandelbrot Set
|
||||
mandelbrot_tasks
|
||||
|
||||
--scale=8.0
|
||||
^
|
||||
#***
|
||||
Perlin Noise Function
|
||||
noise
|
||||
|
||||
--scale=4.0
|
||||
#***
|
||||
Binomial Options
|
||||
options
|
||||
@@ -45,10 +48,11 @@ sponza --scale=6.0
|
||||
#***
|
||||
3D Stencil
|
||||
stencil
|
||||
|
||||
--scale=2.0
|
||||
#***
|
||||
Volume Rendering
|
||||
volume_rendering
|
||||
% --scale= from data
|
||||
camera.dat density_highres.vol
|
||||
#***
|
||||
Sort
|
||||
|
||||
21
perf.py
21
perf.py
@@ -99,16 +99,19 @@ def analyse_test(c1, c2, test, b_serial, perf_temp_n):
|
||||
j+=1
|
||||
if "million cycles" in line:
|
||||
if j == c1:
|
||||
line = line.replace("]","[")
|
||||
line = line.split("[")
|
||||
number = float(line[3])
|
||||
if "tasks" in line[1]:
|
||||
absolute_tasks.append(number)
|
||||
if line[0] == '@':
|
||||
print_debug(line, True, perf_log)
|
||||
else:
|
||||
if "ispc" in line[1]:
|
||||
absolute_ispc.append(number)
|
||||
if "serial" in line[1]:
|
||||
serial.append(number)
|
||||
line = line.replace("]","[")
|
||||
line = line.split("[")
|
||||
number = float(line[3])
|
||||
if "tasks" in line[1]:
|
||||
absolute_tasks.append(number)
|
||||
else:
|
||||
if "ispc" in line[1]:
|
||||
absolute_ispc.append(number)
|
||||
if "serial" in line[1]:
|
||||
serial.append(number)
|
||||
|
||||
if len(ispc) != 0:
|
||||
if len(tasks) != 0:
|
||||
|
||||
Reference in New Issue
Block a user