Added log printing for debug

This commit is contained in:
doinachiroiu 2020-08-20 08:58:30 +00:00
parent 94fcf82dd3
commit 257e87e076

View File

@ -1,4 +1,5 @@
#include <assert.h> #include <assert.h>
#include <glog/logging.h>
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -61,6 +62,11 @@ void show_output(const char* name, int N, int cplx, float flops, float t0,
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
/*
* Initialize Google's logging library.
*/
google::InitGoogleLogging(argv[0]);
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
/* /*
* Nvalues is a vector keeping the values by which iterates N, its value * Nvalues is a vector keeping the values by which iterates N, its value
@ -75,12 +81,12 @@ int main(int argc, char* argv[]) {
16384, 32768, 256 * 1024, 1024 * 1024, -1}; 16384, 32768, 256 * 1024, 1024 * 1024, -1};
int i; int i;
printf("initializing sandbox...\n"); VLOG(1) << "Initializing sandbox...\n";
pffftSapiSandbox sandbox; pffftSapiSandbox sandbox;
sandbox.Init().IgnoreError(); sandbox.Init().IgnoreError();
printf("Initialization: %s\n", sandbox.Init().ToString().c_str()); VLOG(1) << "Initialization: " << sandbox.Init().ToString().c_str() << "\n";
pffftApi api(&sandbox); pffftApi api(&sandbox);
@ -88,6 +94,7 @@ int main(int argc, char* argv[]) {
cplx = 0; cplx = 0;
do {
for (i = 0; i < 23; i++) { for (i = 0; i < 23; i++) {
N = Nvalues[i]; N = Nvalues[i];
@ -116,9 +123,9 @@ int main(int argc, char* argv[]) {
double t0, t1, flops; double t0, t1, flops;
int max_iter = 5120000 / N * 4; int max_iter = 5120000 / N * 4;
#ifdef __arm__ #ifdef __arm__
max_iter /= 4; max_iter /= 4;
#endif #endif
int iter; int iter;
for (k = 0; k < Nfloat; ++k) { for (k = 0; k < Nfloat; ++k) {
@ -165,7 +172,7 @@ int main(int argc, char* argv[]) {
sapi::StatusOr<PFFFT_Setup*> s = sapi::StatusOr<PFFFT_Setup*> s =
api.pffft_new_setup(N, cplx ? PFFFT_COMPLEX : PFFFT_REAL); api.pffft_new_setup(N, cplx ? PFFFT_COMPLEX : PFFFT_REAL);
printf("Setup status is: %s\n", s.status().ToString().c_str()); VLOG(1) << "Setup status is: " << s.status().ToString().c_str() << "\n";
if (s.ok()) { if (s.ok()) {
sapi::v::RemotePtr s_reg(s.value()); sapi::v::RemotePtr s_reg(s.value());
@ -187,9 +194,13 @@ int main(int argc, char* argv[]) {
(max_iter * 2) * ((cplx ? 5 : 2.5) * N * log((double)N) / M_LN2); (max_iter * 2) * ((cplx ? 5 : 2.5) * N * log((double)N) / M_LN2);
show_output("PFFFT", N, cplx, flops, t0, t1, max_iter); show_output("PFFFT", N, cplx, flops, t0, t1, max_iter);
} }
printf("\n\n");
VLOG(1) << "N = " << N << " SUCCESSFULLY\n\n";
} }
} }
cplx = !cplx;
} while (cplx);
return 0; return 0;
} }