+added wc-timer

This commit is contained in:
Evghenii
2013-11-08 15:27:51 +01:00
parent ce5f8cd46f
commit eb8e1a2160
9 changed files with 309 additions and 241 deletions

View File

@@ -2,7 +2,7 @@
EXAMPLE=mandelbrot_tasks3d
CPP_SRC=mandelbrot_tasks3d.cpp mandelbrot_tasks_serial.cpp
ISPC_SRC=mandelbrot_tasks3d.ispc
ISPC_IA_TARGETS=avx,sse2,sse4
ISPC_IA_TARGETS=avx
ISPC_ARM_TARGETS=neon
include ../common.mk

View File

@@ -43,6 +43,21 @@
#include <string.h>
#include "../timing.h"
#include <sys/time.h>
double rtc(void)
{
struct timeval Tvalue;
double etime;
struct timezone dummy;
gettimeofday(&Tvalue,&dummy);
etime = (double) Tvalue.tv_sec +
1.e-6*((double) Tvalue.tv_usec);
return etime;
}
#include <iostream>
#include <cuda.h>
#include <vector>
@@ -361,15 +376,18 @@ int main(int argc, char *argv[]) {
// time of three runs.
//
double minISPC = 1e30;
#if 1
for (int i = 0; i < 3; ++i) {
// Clear out the buffer
for (unsigned int i = 0; i < width * height; ++i)
buf[i] = 0;
reset_and_start_timer();
const double t0 = rtc();
mandelbrot_ispc(x0, y0, x1, y1, width, height, maxIterations, (int*)d_buf);
double dt = get_elapsed_mcycles();
double dt = rtc() - t0; //get_elapsed_mcycles();
minISPC = std::min(minISPC, dt);
}
#endif
memcpyD2H(buf, d_buf, bufsize);
deviceFree(d_buf);
@@ -388,8 +406,9 @@ int main(int argc, char *argv[]) {
for (unsigned int i = 0; i < width * height; ++i)
buf[i] = 0;
reset_and_start_timer();
const double t0 = rtc();
mandelbrot_serial(x0, y0, x1, y1, width, height, maxIterations, buf);
double dt = get_elapsed_mcycles();
double dt = rtc() - t0; //get_elapsed_mcycles();
minSerial = std::min(minSerial, dt);
}

Binary file not shown.

View File

@@ -49,6 +49,20 @@ using namespace ispc;
#include <iostream>
#include <cuda.h>
#include "drvapi_error_string.h"
#include <sys/time.h>
double rtc(void)
{
struct timeval Tvalue;
double etime;
struct timezone dummy;
gettimeofday(&Tvalue,&dummy);
etime = (double) Tvalue.tv_sec +
1.e-6*((double) Tvalue.tv_usec);
return etime;
}
#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
// These are the inline versions for all of the SDK helper functions
@@ -272,6 +286,7 @@ int main() {
// the minimum time of three runs.
//
double minTimeISPC = 1e30;
#if 0
for (int i = 0; i < 3; ++i) {
reset_and_start_timer();
loop_stencil_ispc(0, 6, width, Nx - width, width, Ny - width,
@@ -280,6 +295,7 @@ int main() {
double dt = get_elapsed_mcycles();
minTimeISPC = std::min(minTimeISPC, dt);
}
#endif
printf("[stencil ispc 1 core]:\t\t[%.3f] million cycles\n", minTimeISPC);
@@ -296,10 +312,11 @@ int main() {
double minTimeISPCTasks = 1e30;
for (int i = 0; i < 3; ++i) {
reset_and_start_timer();
const double t0 = rtc();
loop_stencil_ispc_tasks(0, 6, width, Nx - width, width, Ny - width,
width, Nz - width, Nx, Ny, Nz, (double*)d_coeff, (double*)d_vsq,
(double*)d_Aispc0, (double*)d_Aispc1);
double dt = get_elapsed_mcycles();
double dt = rtc() - t0; //get_elapsed_mcycles();
minTimeISPCTasks = std::min(minTimeISPCTasks, dt);
}
memcpyD2H(Aispc[1], d_Aispc1, bufsize);

View File

@@ -1,7 +1,7 @@
EXAMPLE=volume
CPP_SRC=volume.cpp volume_serial.cpp
ISPC_SRC=volume.ispc
ISPC_SRC=volume1.ispc
ISPC_IA_TARGETS=avx
include ../common.mk

View File

@@ -1,4 +1,4 @@
896 1184
1792 2368
0.000155 0.000000 0.000000 -0.069927
0.000000 -0.000155 0.000000 0.093236

View File

@@ -44,6 +44,21 @@
#include "volume_ispc.h"
using namespace ispc;
#include <sys/time.h>
static inline double rtc(void)
{
struct timeval Tvalue;
double etime;
struct timezone dummy;
gettimeofday(&Tvalue,&dummy);
etime = (double) Tvalue.tv_sec +
1.e-6*((double) Tvalue.tv_usec);
return etime;
}
extern void volume_serial(float density[], int nVoxels[3],
const float raster2camera[4][4],
const float camera2world[4][4],
@@ -156,6 +171,7 @@ int main(int argc, char *argv[]) {
// time of three runs.
//
double minISPC = 1e30;
#if 0
for (int i = 0; i < 3; ++i) {
reset_and_start_timer();
volume_ispc(density, n, raster2camera, camera2world,
@@ -163,6 +179,7 @@ int main(int argc, char *argv[]) {
double dt = get_elapsed_mcycles();
minISPC = std::min(minISPC, dt);
}
#endif
printf("[volume ispc 1 core]:\t\t[%.3f] million cycles\n", minISPC);
writePPM(image, width, height, "volume-ispc-1core.ppm");
@@ -178,9 +195,10 @@ int main(int argc, char *argv[]) {
double minISPCtasks = 1e30;
for (int i = 0; i < 3; ++i) {
reset_and_start_timer();
const double t0 = rtc();
volume_ispc_tasks(density, n, raster2camera, camera2world,
width, height, image);
double dt = get_elapsed_mcycles();
double dt = rtc() - t0; //get_elapsed_mcycles();
minISPCtasks = std::min(minISPCtasks, dt);
}

View File

@@ -44,6 +44,19 @@
#include "volume_ispc.h"
using namespace ispc;
#include <sys/time.h>
static inline double rtc(void)
{
struct timeval Tvalue;
double etime;
struct timezone dummy;
gettimeofday(&Tvalue,&dummy);
etime = (double) Tvalue.tv_sec +
1.e-6*((double) Tvalue.tv_usec);
return etime;
}
#include <cassert>
#include <iostream>
#include <cuda.h>
@@ -414,6 +427,7 @@ int main(int argc, char *argv[]) {
double minISPCtasks = 1e30;
for (int i = 0; i < 3; ++i) {
reset_and_start_timer();
const double t0 = rtc();
volume_ispc_tasks(
(float*)d_density,
(int*)d_n,
@@ -421,7 +435,7 @@ int main(int argc, char *argv[]) {
(float(*)[4])d_camera2world,
width, height,
(float*)d_image);
double dt = get_elapsed_mcycles();
double dt = rtc() - t0; //get_elapsed_mcycles();
minISPCtasks = std::min(minISPCtasks, dt);
}