Skip to content

Commit

Permalink
Don't pass hidden rows to postprocessing modules
Browse files Browse the repository at this point in the history
This resulted in substantial (~4-5x) speed up of FITS output.
  • Loading branch information
mjuric committed May 20, 2010
1 parent 2f0706f commit 524c421
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/skygen/skyconfig_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ size_t skygenHost<T>::drawSources(otable &in, osink *nextlink, float &runtime)
generated_all = this->stars_generated < this->stopstars;

{
stopwatch sort_sw;
sort_sw.reset();
sort_sw.start();

//
// sort the generated stars by l,b,DM,M
//
Expand Down Expand Up @@ -499,15 +503,24 @@ size_t skygenHost<T>::drawSources(otable &in, osink *nextlink, float &runtime)
#undef SWAP
#undef SWAP1
}

// find the first star that is hidden, and truncate the table there
int *h0 = std::upper_bound(sc.hidden.ptr, sc.hidden.ptr + in.size(), 0);
size_t size = h0 - sc.hidden.ptr;
DLOG(verb1) << "Truncating table to " << size << " elements (others are hidden).";
in.set_size(size);

sort_sw.stop();
DLOG(verb1) << "Sort time: " << sort_sw.getTime();
}

DLOG(verb1) << "Skygen generated " << this->stars_generated << " stars ";
//DLOG(verb1) << "Kernel runtime: " << swatch.getAverageTime();

swatch.stop();
totalGenerated += this->stars_generated;
if(in.size())
{
totalGenerated += in.size();
totalStored += nextlink->process(in, 0, in.size(), *cpurng);
}
swatch.start();
Expand Down

0 comments on commit 524c421

Please sign in to comment.