Skip to content

Commit

Permalink
Changed log frequency to be based on time since last save instead of …
Browse files Browse the repository at this point in the history
…iterations
  • Loading branch information
zpzim committed Jun 3, 2016
1 parent 55ff6d6 commit dbf8574
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions STOMP.cu
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,9 @@ void* doThreadSTOMP(void* argsp){
printf("Copying QTtrunc\n");

time_t start2, now2;
time_t lastLogged;
time(&start2);
time(&lastLogged);
bool usingSecondary = true;
bool fileOne = true;
// cudaProfilerInitialize();
Expand All @@ -916,10 +918,14 @@ void* doThreadSTOMP(void* argsp){
{
reducemain(D, i+1, 2048, 1024, n-i-1, profile, profileIdxs, i, reduced_result, reduced_loc);
}

if(LOG_FREQ != 0 && (i - start) % LOG_FREQ == 1){
time(&now2);
printf("Thread %d Spent %lf seconds since last save\n", tid, difftime(now2, start2));
time(&now2);
if((int) difftime(now2, start2) % 60 == 0 && difftime(now2,lastLogged) > 2){
printf("Thread %d finished iteration %u, %f percent iterations done: current total time taken = %lf seconds\n", tid, i, (i - start)/((float)(end - start)), difftime(now2, START) + oldTime);
time(&lastLogged);
}
if(LOG_FREQ != 0 && difftime(now2, start2) > LOG_FREQ){

//printf("Thread %d Spent %lf seconds since last save\n", tid, difftime(now2, start2));
writeProgressToDisk(tid, profile, profileIdxs, QTtrunc2, i, difftime(now2, START) + oldTime);
time(&start2);
}
Expand All @@ -932,10 +938,15 @@ void* doThreadSTOMP(void* argsp){
{
reducemain(D, i+1, 2048, 1024, n-i-1, profile, profileIdxs, i, reduced_result, reduced_loc);
}
time(&now2);

if(LOG_FREQ != 0 && (i - start) % LOG_FREQ == 1){
time(&now2);
printf("Thread %d Spent %lf seconds since last save\n",tid, difftime(now2, start2));
if((int) difftime(now2, start2) % 60 == 0 && difftime(now2,lastLogged) > 2){
printf("Thread %d finished iteration %u, %f percent iterations done: current total time taken = %lf seconds\n", tid, i, (i - start)/((float)(end - start)), difftime(now2, START) + oldTime);
time(&lastLogged);
}
if(LOG_FREQ != 0 && difftime(now2, start2) > LOG_FREQ){
//time(&now2);
//printf("Thread %d Spent %lf seconds since last save\n",tid, difftime(now2, start2));
writeProgressToDisk(tid, profile, profileIdxs, QTtrunc, i, difftime(now2, START) + oldTime);
time(&start2);
}
Expand Down Expand Up @@ -1058,7 +1069,7 @@ int main(int argc, char** argv) {
STOMP(Th,window_size,profile, profIdxs);
time(&now);

printf("Finished STOMP on %u data points in %f seconds.\n", size, difftime(now, START));
printf("Finished STOMP on %u data points in %f seconds.\n", size, difftime(now, START) + );
printf("Now writing result to files\n");
//thrust::host_vector<DATA_TYPE> p = profile;
//printf("Copied profile back to host\n");
Expand Down

0 comments on commit dbf8574

Please sign in to comment.