+added wc-timer
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
EXAMPLE=mandelbrot_tasks3d
|
EXAMPLE=mandelbrot_tasks3d
|
||||||
CPP_SRC=mandelbrot_tasks3d.cpp mandelbrot_tasks_serial.cpp
|
CPP_SRC=mandelbrot_tasks3d.cpp mandelbrot_tasks_serial.cpp
|
||||||
ISPC_SRC=mandelbrot_tasks3d.ispc
|
ISPC_SRC=mandelbrot_tasks3d.ispc
|
||||||
ISPC_IA_TARGETS=avx,sse2,sse4
|
ISPC_IA_TARGETS=avx
|
||||||
ISPC_ARM_TARGETS=neon
|
ISPC_ARM_TARGETS=neon
|
||||||
|
|
||||||
include ../common.mk
|
include ../common.mk
|
||||||
|
|||||||
@@ -43,6 +43,21 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../timing.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 <iostream>
|
||||||
#include <cuda.h>
|
#include <cuda.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -361,15 +376,18 @@ int main(int argc, char *argv[]) {
|
|||||||
// time of three runs.
|
// time of three runs.
|
||||||
//
|
//
|
||||||
double minISPC = 1e30;
|
double minISPC = 1e30;
|
||||||
|
#if 1
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
// Clear out the buffer
|
// Clear out the buffer
|
||||||
for (unsigned int i = 0; i < width * height; ++i)
|
for (unsigned int i = 0; i < width * height; ++i)
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
|
const double t0 = rtc();
|
||||||
mandelbrot_ispc(x0, y0, x1, y1, width, height, maxIterations, (int*)d_buf);
|
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);
|
minISPC = std::min(minISPC, dt);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
memcpyD2H(buf, d_buf, bufsize);
|
memcpyD2H(buf, d_buf, bufsize);
|
||||||
deviceFree(d_buf);
|
deviceFree(d_buf);
|
||||||
@@ -388,8 +406,9 @@ int main(int argc, char *argv[]) {
|
|||||||
for (unsigned int i = 0; i < width * height; ++i)
|
for (unsigned int i = 0; i < width * height; ++i)
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
|
const double t0 = rtc();
|
||||||
mandelbrot_serial(x0, y0, x1, y1, width, height, maxIterations, buf);
|
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);
|
minSerial = std::min(minSerial, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -49,6 +49,20 @@ using namespace ispc;
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cuda.h>
|
#include <cuda.h>
|
||||||
#include "drvapi_error_string.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__)
|
#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
|
||||||
// These are the inline versions for all of the SDK helper functions
|
// These are the inline versions for all of the SDK helper functions
|
||||||
@@ -272,6 +286,7 @@ int main() {
|
|||||||
// the minimum time of three runs.
|
// the minimum time of three runs.
|
||||||
//
|
//
|
||||||
double minTimeISPC = 1e30;
|
double minTimeISPC = 1e30;
|
||||||
|
#if 0
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
loop_stencil_ispc(0, 6, width, Nx - width, width, Ny - width,
|
loop_stencil_ispc(0, 6, width, Nx - width, width, Ny - width,
|
||||||
@@ -280,6 +295,7 @@ int main() {
|
|||||||
double dt = get_elapsed_mcycles();
|
double dt = get_elapsed_mcycles();
|
||||||
minTimeISPC = std::min(minTimeISPC, dt);
|
minTimeISPC = std::min(minTimeISPC, dt);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("[stencil ispc 1 core]:\t\t[%.3f] million cycles\n", minTimeISPC);
|
printf("[stencil ispc 1 core]:\t\t[%.3f] million cycles\n", minTimeISPC);
|
||||||
|
|
||||||
@@ -296,10 +312,11 @@ int main() {
|
|||||||
double minTimeISPCTasks = 1e30;
|
double minTimeISPCTasks = 1e30;
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
|
const double t0 = rtc();
|
||||||
loop_stencil_ispc_tasks(0, 6, width, Nx - width, width, Ny - width,
|
loop_stencil_ispc_tasks(0, 6, width, Nx - width, width, Ny - width,
|
||||||
width, Nz - width, Nx, Ny, Nz, (double*)d_coeff, (double*)d_vsq,
|
width, Nz - width, Nx, Ny, Nz, (double*)d_coeff, (double*)d_vsq,
|
||||||
(double*)d_Aispc0, (double*)d_Aispc1);
|
(double*)d_Aispc0, (double*)d_Aispc1);
|
||||||
double dt = get_elapsed_mcycles();
|
double dt = rtc() - t0; //get_elapsed_mcycles();
|
||||||
minTimeISPCTasks = std::min(minTimeISPCTasks, dt);
|
minTimeISPCTasks = std::min(minTimeISPCTasks, dt);
|
||||||
}
|
}
|
||||||
memcpyD2H(Aispc[1], d_Aispc1, bufsize);
|
memcpyD2H(Aispc[1], d_Aispc1, bufsize);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
EXAMPLE=volume
|
EXAMPLE=volume
|
||||||
CPP_SRC=volume.cpp volume_serial.cpp
|
CPP_SRC=volume.cpp volume_serial.cpp
|
||||||
ISPC_SRC=volume.ispc
|
ISPC_SRC=volume1.ispc
|
||||||
ISPC_IA_TARGETS=avx
|
ISPC_IA_TARGETS=avx
|
||||||
|
|
||||||
include ../common.mk
|
include ../common.mk
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
896 1184
|
1792 2368
|
||||||
|
|
||||||
0.000155 0.000000 0.000000 -0.069927
|
0.000155 0.000000 0.000000 -0.069927
|
||||||
0.000000 -0.000155 0.000000 0.093236
|
0.000000 -0.000155 0.000000 0.093236
|
||||||
|
|||||||
@@ -44,6 +44,21 @@
|
|||||||
#include "volume_ispc.h"
|
#include "volume_ispc.h"
|
||||||
using namespace ispc;
|
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],
|
extern void volume_serial(float density[], int nVoxels[3],
|
||||||
const float raster2camera[4][4],
|
const float raster2camera[4][4],
|
||||||
const float camera2world[4][4],
|
const float camera2world[4][4],
|
||||||
@@ -156,6 +171,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// time of three runs.
|
// time of three runs.
|
||||||
//
|
//
|
||||||
double minISPC = 1e30;
|
double minISPC = 1e30;
|
||||||
|
#if 0
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
volume_ispc(density, n, raster2camera, camera2world,
|
volume_ispc(density, n, raster2camera, camera2world,
|
||||||
@@ -163,6 +179,7 @@ int main(int argc, char *argv[]) {
|
|||||||
double dt = get_elapsed_mcycles();
|
double dt = get_elapsed_mcycles();
|
||||||
minISPC = std::min(minISPC, dt);
|
minISPC = std::min(minISPC, dt);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("[volume ispc 1 core]:\t\t[%.3f] million cycles\n", minISPC);
|
printf("[volume ispc 1 core]:\t\t[%.3f] million cycles\n", minISPC);
|
||||||
writePPM(image, width, height, "volume-ispc-1core.ppm");
|
writePPM(image, width, height, "volume-ispc-1core.ppm");
|
||||||
@@ -178,9 +195,10 @@ int main(int argc, char *argv[]) {
|
|||||||
double minISPCtasks = 1e30;
|
double minISPCtasks = 1e30;
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
|
const double t0 = rtc();
|
||||||
volume_ispc_tasks(density, n, raster2camera, camera2world,
|
volume_ispc_tasks(density, n, raster2camera, camera2world,
|
||||||
width, height, image);
|
width, height, image);
|
||||||
double dt = get_elapsed_mcycles();
|
double dt = rtc() - t0; //get_elapsed_mcycles();
|
||||||
minISPCtasks = std::min(minISPCtasks, dt);
|
minISPCtasks = std::min(minISPCtasks, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,19 @@
|
|||||||
#include "volume_ispc.h"
|
#include "volume_ispc.h"
|
||||||
using namespace ispc;
|
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 <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cuda.h>
|
#include <cuda.h>
|
||||||
@@ -414,6 +427,7 @@ int main(int argc, char *argv[]) {
|
|||||||
double minISPCtasks = 1e30;
|
double minISPCtasks = 1e30;
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
|
const double t0 = rtc();
|
||||||
volume_ispc_tasks(
|
volume_ispc_tasks(
|
||||||
(float*)d_density,
|
(float*)d_density,
|
||||||
(int*)d_n,
|
(int*)d_n,
|
||||||
@@ -421,7 +435,7 @@ int main(int argc, char *argv[]) {
|
|||||||
(float(*)[4])d_camera2world,
|
(float(*)[4])d_camera2world,
|
||||||
width, height,
|
width, height,
|
||||||
(float*)d_image);
|
(float*)d_image);
|
||||||
double dt = get_elapsed_mcycles();
|
double dt = rtc() - t0; //get_elapsed_mcycles();
|
||||||
minISPCtasks = std::min(minISPCtasks, dt);
|
minISPCtasks = std::min(minISPCtasks, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user