Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r556 - in branches/AFR: Engine/Control Engine/Display Engine/ImageTraversers Engine/ImageTraversers/AFR StandAlone
- Date: Sun, 18 Sep 2005 21:56:10 -0600 (MDT)
Author: abe
Date: Sun Sep 18 21:56:08 2005
New Revision: 556
Modified:
branches/AFR/Engine/Control/AFRPipeline.cc
branches/AFR/Engine/Control/RTRT.cc
branches/AFR/Engine/Display/OpenGLDisplay.cc
branches/AFR/Engine/Display/OpenGLDisplay.h
branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc
branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.cc
branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.h
branches/AFR/StandAlone/manta.cc
Log:
Small changes to make reading performance numbers easier.
M Engine/Control/RTRT.cc
M Engine/Control/AFRPipeline.cc
M Engine/ImageTraversers/AFR/kdtree.cc
Output number of samples in terms of millions of thousands.
M Engine/Display/OpenGLDisplay.h
M Engine/Display/OpenGLDisplay.cc
Moved isMaster(int) call inside of GSTAFRImageTraverser from AFRPipeline.cc
M Engine/ImageTraversers/AFImageTraverser.cc
M Engine/ImageTraversers/GSTAFRImageTraverser.cc
M Engine/ImageTraversers/GSTAFRImageTraverser.h
Fixed manta.cc so that it actually uses the normal pipeline instead of the
afr pipeline!
M StandAlone/manta.cc
Modified: branches/AFR/Engine/Control/AFRPipeline.cc
==============================================================================
--- branches/AFR/Engine/Control/AFRPipeline.cc (original)
+++ branches/AFR/Engine/Control/AFRPipeline.cc Sun Sep 18 21:56:08 2005
@@ -290,7 +290,6 @@
bool wait_for_transactions = false;
-
Real last_display_time = 0.0;
Real last_samples = 0.0;
@@ -333,11 +332,10 @@
// Check to see of the barrier is necessary due to a state change.
if ( transactions.size() || pipelineNeedsSetup || firstFrame ) {
-
+
// Re sync after state changes.
wait_for_transactions = true;
-
-
+
outer_loop_barrier.wait( workersRendering );
// Copy over the frame state
@@ -394,7 +392,7 @@
}
wait_for_transactions = false;
-
+
// Wait for all of the other processors to finish setup.
// pipeline_setup_barrier.wait(numProcs);
outer_loop_barrier.wait(numProcs);
@@ -428,7 +426,9 @@
currentImageTraverser->setSamplingRate( (unsigned int)sampling_rate
);
DisplayContext myContext(proc, workersAnimAndImage);
- channel->display->displayImage(myContext, image,
(current_samples-last_samples));
+ channel->display->displayImage(myContext,
+ image,
+ (current_samples-last_samples));
last_samples = current_samples;
}
@@ -447,14 +447,14 @@
// Inner Loop
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
- int inner_iterations = 0;
+ // int inner_iterations = 0;
//cout << "looping: " << SCIRun::Time::currentSeconds()
// << ", inner_loop_time = " << inner_loop_time << endl;
for (double begin_time=SCIRun::Time::currentSeconds();
(SCIRun::Time::currentSeconds()-begin_time)<inner_loop_time;)
{
- //cout << "inner loop, iter# " << inner_iterations << endl;
- ++inner_iterations;
+ // cout << "inner loop, iter# " << inner_iterations << endl;
+ // ++inner_iterations;
for(int index = 0;index < static_cast<int>(channels.size());index++)
{
Channel* channel = channels[index];
@@ -472,29 +472,23 @@
// Update Tiling. (Master task)
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
- if(currentImageTraverser->isMaster(myContext.proc))
- {
- //cout << "calling mastertask" << endl;
- currentImageTraverser->masterTask( myContext, image );
- image->setValid(true);
- }
+ currentImageTraverser->masterTask( myContext, image );
+
+
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Inner Loop: Pipeline Stage 2.
// Sampling / Rendering
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
- {
- //cout << "calling clienttask" << endl;
- currentImageTraverser->clientTask( myContext, image );
+ currentImageTraverser->clientTask( myContext, image );
- //image->setValid(true);
- }
+
}
- // Determine how to break out of inner loop. !!!!!!!!!!!!!!!!!!!!!!!!!!
} // End of inner loop.
+
if(proc==0)
{
if (currentImageTraverser->hasDebugWindow())
Modified: branches/AFR/Engine/Control/RTRT.cc
==============================================================================
--- branches/AFR/Engine/Control/RTRT.cc (original)
+++ branches/AFR/Engine/Control/RTRT.cc Sun Sep 18 21:56:08 2005
@@ -370,9 +370,16 @@
Channel* channel = *iter;
long displayFrame =
(renderFrameState.frameNumber-1)%channel->pipelineDepth;
Image* image = channel->images[displayFrame];
+
if(image && image->isValid()){
+ // Determine image resolution for this channel.
+ bool stereo;
+ int xres, yres;
+ image->getResolution(stereo, xres, yres);
+
+ // Display the image.qq
DisplayContext myContext(proc, workersAnimAndImage);
- channel->display->displayImage(myContext, image);
+ channel->display->displayImage(myContext, image, (xres*yres) );
}
}
Modified: branches/AFR/Engine/Display/OpenGLDisplay.cc
==============================================================================
--- branches/AFR/Engine/Display/OpenGLDisplay.cc (original)
+++ branches/AFR/Engine/Display/OpenGLDisplay.cc Sun Sep 18 21:56:08
2005
@@ -325,7 +325,11 @@
void OpenGLDisplay::display_frame_rate(double framerate) {
// Display textual information on the screen:
char buf[200];
- if (framerate > 1)
+ if (framerate >= 1e6)
+ sprintf( buf, "%3.3lfM samples/second", framerate*1e-6);
+ else if (framerate >= 1e3)
+ sprintf( buf, "%3.3lfk samples/second", framerate*1e-3);
+ else if (framerate >= 1.0)
sprintf( buf, "%3.1lf samples/second", framerate);
else
sprintf( buf, "%2.2lf fps - %3.1lf spf", framerate , 1.0f/framerate);
Modified: branches/AFR/Engine/Display/OpenGLDisplay.h
==============================================================================
--- branches/AFR/Engine/Display/OpenGLDisplay.h (original)
+++ branches/AFR/Engine/Display/OpenGLDisplay.h Sun Sep 18 21:56:08 2005
@@ -18,7 +18,10 @@
OpenGLDisplay(const vector<string>& args);
virtual ~OpenGLDisplay();
virtual void setupDisplayChannel(SetupContext&);
- virtual void displayImage(const DisplayContext& context, const Image*
image, Real performance = 1.0);
+ virtual void displayImage(const DisplayContext& context,
+ const Image* image,
+ Real performance = 1.0);
+
static ImageDisplay* create(const vector<string>& args);
private:
OpenGLDisplay(const OpenGLDisplay&);
Modified: branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc Sun Sep 18
21:56:08 2005
@@ -716,6 +716,9 @@
void AFImageTraverser::masterTask(const RenderContext& context, Image*
image) {
// update kdtree based on previous results from the client threads
+
+ // Every thread does both the master task and the client task,
+ // so there is no need to check.
bool stereo;
int xres, yres;
@@ -724,19 +727,19 @@
chunkTimeStamp[context.proc] = (float)SCIRun::Time::currentSeconds();
//cout << "time (thread = " << context.proc << " ) is now " <<
chunkTimeStamp[context.proc] << endl;
// return during intialization here
- if(!initpass[context.proc])
- {
- if(samples_done[context.proc].value >= (xres*yres)) {
- initpass[context.proc] = true;
- std::cerr << "Thread: " << context.proc << " initialized" << std::endl;
- }
- }
- else
- {
+
+ if(initpass[context.proc]) {
+
// adjust tiles based on current status
adjustTiles(context.proc, (float)chunkTimeStamp[context.proc]);
+
}
-
+ else if (samples_done[context.proc].value >= (xres*yres)) {
+ initpass[context.proc] = true;
+ std::cerr << "Thread: " << context.proc << " initialized" << std::endl;
+ }
+
+ image->setValid( true );
}
///////////////////////////////////////////////////////////////////////////////
Modified: branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc Sun Sep 18 21:56:08
2005
@@ -398,11 +398,13 @@
{
int index = 1;
float rno;
- while(!tile[index].isValid() &&
tile[index].getTileSize()>Tile::min_tile_area)
+ while(!tile[index].isValid() &&
+ (tile[index].getTileSize() > Tile::min_tile_area))
{
rno = rnogen.genfrand();
index *= 2;
- if(rno<0.5)
+
+ if(rno < 0.5f)
index++;
}
//cout << "getting " << index << "th tile of " << numTiles << " tiles" <<
endl;
Modified: branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.cc (original)
+++ branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.cc Sun Sep 18
21:56:08 2005
@@ -697,51 +697,65 @@
///////////////////////////////////////////////////////////////////////////////
void GSTAFRImageTraverser::masterTask(const RenderContext& context, Image*
image) {
- // update kdtree based on previous results from the client threads
+ // Check to see if the master thread called this function.
+ if (isMaster( context.proc )) {
- bool stereo;
- int i, j;
- int xres, yres;
- image->getResolution(stereo, xres, yres);
- // get the masterID
- int masterID;
- masterID = context.proc/avgGroupSize;
- chunkTimeStamp[masterID] = (float)SCIRun::Time::currentSeconds();
+ // update kdtree based on previous results from the client threads
+
+ // Get the current image resolution.
+ bool stereo;
+ int i, j;
+ int xres, yres;
+ image->getResolution(stereo, xres, yres);
+
+ // get the masterID
+ int masterID;
+ masterID = context.proc/avgGroupSize;
+ chunkTimeStamp[masterID] = (float)SCIRun::Time::currentSeconds();
- //cout << "master = " << masterID << ", has " << groupSize[masterID] << "
clients" << endl;
- // for clients context.proc+1 to context.proc+groupSize[masterID]
- // read output queue of all clients and update the kdtree[masterID]
+ //cout << "master = " << masterID << ", has " << groupSize[masterID] <<
" clients" << endl;
+ // for clients context.proc+1 to context.proc+groupSize[masterID]
+ // read output queue of all clients and update the kdtree[masterID]
- for(i=masterID; i<masterID+groupSize[masterID]; i++)
- {
- int qsize = outputQ[i].getN()-1;
- if(qsize>=chunk_size-2)
- for(j=0; j<qsize; j++)
- {
- PartialSampleSet *npss = outputQ[i].seekLast();
- outputQ[i].qDelete();
- if(npss==NULL) break;
- updatecount[masterID]++;
- // add sample to the corresponding kdtree
- //npss->print();
- // if(npss->xgrad>0 || npss->ygrad>0 || npss->tgrad>0)
- // {
- // cout << "grads: ( " << npss->xgrad
- // << ", " << npss->ygrad
- // << ", " << npss->tgrad << " ) " << endl;
- // }
- kdtree[masterID].updateStatsAddPartialSampleSet(npss,
(float)chunkTimeStamp[masterID], samplingrate);
+ for(i=masterID; i<masterID+groupSize[masterID]; i++) {
+ int qsize = outputQ[i].getN()-1;
+ if(qsize>=chunk_size-2) {
+ for(j=0; j<qsize; j++) {
+
+ PartialSampleSet *npss = outputQ[i].seekLast();
+ outputQ[i].qDelete();
+
+ if(npss==NULL) break;
+ updatecount[masterID]++;
+
+ // add sample to the corresponding kdtree
+ //npss->print();
+ // if(npss->xgrad>0 || npss->ygrad>0 || npss->tgrad>0)
+ // {
+ // cout << "grads: ( " << npss->xgrad
+ // << ", " << npss->ygrad
+ // << ", " << npss->tgrad << " ) " << endl;
+ // }
+
+ kdtree[masterID].updateStatsAddPartialSampleSet(npss,
(float)chunkTimeStamp[masterID], samplingrate);
+ }
}
- }
- //cout << "time (thread = " << context.proc << " ) is now " <<
chunkTimeStamp[context.proc] << endl;
- // return during intialization here
- if(updatecount[masterID] >= chunk_size)
- {
- //cout << updatecount[masterID] << " xhairs added to tree " << endl;
- updatecount[masterID] = 0;
- // adjust tiles based on current status
- if(chunkTimeStamp[masterID]>5)
- adjustTiles(masterID, (float)chunkTimeStamp[masterID]);
+ }
+
+ //cout << "time (thread = " << context.proc << " ) is now " <<
chunkTimeStamp[context.proc] << endl;
+ // return during intialization here
+ if(updatecount[masterID] >= chunk_size) {
+
+ //cout << updatecount[masterID] << " xhairs added to tree " << endl;
+ updatecount[masterID] = 0;
+ // adjust tiles based on current status
+ if(chunkTimeStamp[masterID]>5) {
+ adjustTiles(masterID, (float)chunkTimeStamp[masterID]);
+ }
+
+ }
+
+ image->setValid( true );
}
}
@@ -768,6 +782,11 @@
initpass[myID] = true;
std::cerr << "Thread: " << context.proc << " has its queues
initialized" << std::endl;
}
+ // else if (isMaster(myID)) {
+ // initpass[myID] = true;
+ // std::cerr << "Thread: " << context.proc
+ // << " is a master and is initalized by default" <<
std::endl;
+ // }
}
else
{
Modified: branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.h
==============================================================================
--- branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.h (original)
+++ branches/AFR/Engine/ImageTraversers/GSTAFRImageTraverser.h Sun Sep 18
21:56:08 2005
@@ -173,10 +173,15 @@
return total;
};
+ // This method is called by the benchmark helper to determine when to
start
+ // measuring performance.
inline bool allThreadsInitialized() {
bool all = true;
for (int i=0;(i<num_clients)&&all;++i) {
- all = initpass[i] && all;
+
+ // Don't wait for the master to initialize--this takes forever
since the master
+ // is doing a lot more work then the distributed tree case.
+ all = (initpass[i] || isMaster(i)) && all;
}
return all;
Modified: branches/AFR/StandAlone/manta.cc
==============================================================================
--- branches/AFR/StandAlone/manta.cc (original)
+++ branches/AFR/StandAlone/manta.cc Sun Sep 18 21:56:08 2005
@@ -143,7 +143,7 @@
args.push_back(argv[i]);
try {
- RTRTInterface* rtrt = Manta::Afr::createAFRPipeline();
+ RTRTInterface* rtrt = Manta::createRTRT();
if(getenv("MANTA_SCENEPATH"))
rtrt->setScenePath(getenv("MANTA_SCENEPATH"));
- [MANTA] r556 - in branches/AFR: Engine/Control Engine/Display Engine/ImageTraversers Engine/ImageTraversers/AFR StandAlone, abe, 09/18/2005
Archive powered by MHonArc 2.6.16.