Eliminated MSVC warnings
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#define NOMINMAX
|
||||
#pragma warning (disable: 4244)
|
||||
#pragma warning (disable: 4305)
|
||||
// preventing MSVC fopen() deprecation complaints
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "instrument.h"
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
@@ -46,7 +48,7 @@ struct CallInfo {
|
||||
|
||||
static std::map<std::string, CallInfo> callInfo;
|
||||
|
||||
int countbits(int i) {
|
||||
int countbits(uint64_t i) {
|
||||
int ret = 0;
|
||||
while (i) {
|
||||
if (i & 0x1)
|
||||
@@ -61,13 +63,12 @@ int countbits(int i) {
|
||||
// command-line flag is given while compiling.
|
||||
void
|
||||
ISPCInstrument(const char *fn, const char *note, int line, uint64_t mask) {
|
||||
char sline[16];
|
||||
sprintf(sline, "%04d", line);
|
||||
std::string s = std::string(fn) + std::string("(") + std::string(sline) +
|
||||
std::string(") - ") + std::string(note);
|
||||
std::stringstream s;
|
||||
s << fn << "(" << std::setfill('0') << std::setw(4) << line << ") - "
|
||||
<< note;
|
||||
|
||||
// Find or create a CallInfo instance for this callsite.
|
||||
CallInfo &ci = callInfo[s];
|
||||
CallInfo &ci = callInfo[s.str()];
|
||||
|
||||
// And update its statistics...
|
||||
++ci.count;
|
||||
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
int nframes = test_iterations[2];
|
||||
double ispcCycles = 1e30;
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[0]; ++i) {
|
||||
framebuffer.clear();
|
||||
reset_and_start_timer();
|
||||
for (int j = 0; j < nframes; ++j)
|
||||
@@ -123,7 +123,7 @@ int main(int argc, char** argv) {
|
||||
#endif // __cilk
|
||||
|
||||
double serialCycles = 1e30;
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[1]; ++i) {
|
||||
framebuffer.clear();
|
||||
reset_and_start_timer();
|
||||
for (int j = 0; j < nframes; ++j)
|
||||
|
||||
@@ -99,7 +99,7 @@ int main(int argc, char *argv[]) {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
for (unsigned 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();
|
||||
@@ -119,7 +119,7 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
for (unsigned 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();
|
||||
|
||||
@@ -110,7 +110,7 @@ int main(int argc, char *argv[]) {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[0]; ++i) {
|
||||
// Clear out the buffer
|
||||
for (unsigned int i = 0; i < width * height; ++i)
|
||||
buf[i] = 0;
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[1]; ++i) {
|
||||
// Clear out the buffer
|
||||
for (unsigned int i = 0; i < width * height; ++i)
|
||||
buf[i] = 0;
|
||||
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char *argv[]) {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
for (unsigned 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();
|
||||
@@ -115,7 +115,7 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
for (unsigned 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();
|
||||
|
||||
@@ -211,7 +211,7 @@ 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 < test_iterations[0]; ++i) {
|
||||
for (uint i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
raytrace_ispc(width, height, baseWidth, baseHeight, raster2camera,
|
||||
camera2world, image, id, nodes, triangles);
|
||||
@@ -231,7 +231,7 @@ 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 < test_iterations[1]; ++i) {
|
||||
for (uint i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
raytrace_ispc_tasks(width, height, baseWidth, baseHeight, raster2camera,
|
||||
camera2world, image, id, nodes, triangles);
|
||||
@@ -252,7 +252,7 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minTimeSerial = 1e30;
|
||||
for (int i = 0; i < test_iterations[2]; ++i) {
|
||||
for (uint i = 0; i < test_iterations[2]; ++i) {
|
||||
reset_and_start_timer();
|
||||
raytrace_serial(width, height, baseWidth, baseHeight, raster2camera,
|
||||
camera2world, image, id, nodes, triangles);
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <iomanip>
|
||||
#include "../timing.h"
|
||||
@@ -61,9 +63,9 @@ static void progressBar(const int x, const int n, const int width = 50)
|
||||
bstr += "]";
|
||||
|
||||
// print percentage
|
||||
char pstr0[32];
|
||||
sprintf(pstr0, " %2d %c ", static_cast<int>(f*100.0),'%');
|
||||
const std::string pstr(pstr0);
|
||||
std::stringstream pstr0;
|
||||
pstr0 << " " << static_cast<int>(f*100.0) << " % ";
|
||||
const std::string pstr(pstr0.str());
|
||||
std::copy(pstr.begin(), pstr.end(), bstr.begin() + (width/2-2));
|
||||
|
||||
std::cout << bstr;
|
||||
|
||||
@@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
|
||||
// the minimum time of three runs.
|
||||
//
|
||||
double minTimeISPC = 1e30;
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
for (unsigned 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,
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char *argv[]) {
|
||||
// the minimum time of three runs.
|
||||
//
|
||||
double minTimeISPCTasks = 1e30;
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
for (unsigned 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,
|
||||
@@ -140,7 +140,7 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minTimeSerial = 1e30;
|
||||
for (int i = 0; i < test_iterations[2]; ++i) {
|
||||
for (unsigned 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,
|
||||
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char *argv[]) {
|
||||
// time of three runs.
|
||||
//
|
||||
double minISPC = 1e30;
|
||||
for (int i = 0; i < test_iterations[0]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[0]; ++i) {
|
||||
reset_and_start_timer();
|
||||
volume_ispc(density, n, raster2camera, camera2world,
|
||||
width, height, image);
|
||||
@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) {
|
||||
// tasks; report the minimum time of three runs.
|
||||
//
|
||||
double minISPCtasks = 1e30;
|
||||
for (int i = 0; i < test_iterations[1]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[1]; ++i) {
|
||||
reset_and_start_timer();
|
||||
volume_ispc_tasks(density, n, raster2camera, camera2world,
|
||||
width, height, image);
|
||||
@@ -205,7 +205,7 @@ int main(int argc, char *argv[]) {
|
||||
// minimum time.
|
||||
//
|
||||
double minSerial = 1e30;
|
||||
for (int i = 0; i < test_iterations[2]; ++i) {
|
||||
for (unsigned int i = 0; i < test_iterations[2]; ++i) {
|
||||
reset_and_start_timer();
|
||||
volume_serial(density, n, raster2camera, camera2world,
|
||||
width, height, image);
|
||||
|
||||
Reference in New Issue
Block a user