[vtkusers] threads and vtkSynchronizedTemplates
Dave Semeraro
semeraro at ncsa.uiuc.edu
Tue Apr 16 10:36:57 EDT 2002
Hi Lisa,
So here is the code I am using to test the SynchronizedTemplates code. I
have made the,
possibly wrong, assumption that since I can set the number of threads in
synchronized
templates that it will do what I expect. Maybe it is and I am doing the
timing wrong. The strange
thing is that if I set the number of threads to 1, the program uses only a
single processor. If
I change it to 2 threads it uses both. This is verified by top output. I
wonder if identical work
is being done in both processes so no speedup results. I have only played
around with parallel
vtk in the mpi world where it works fine. This is my first attempt at the
threaded stuff. Thanks for
any help you can give.
Dave
//
// Head tests the vtkSynchronizedTemplates3D class on
// Structured points data. The test does no rendering but
// constructs geometry.
//
#include "vtkStructuredPointsReader.h"
#include "vtkSynchronizedTemplates3D.h"
#include "vtkTimerLog.h"
main( int argc, char** argv) {
vtkStructuredPointsReader *reader;
vtkSynchronizedTemplates3D *iso;
float val;
int numTris;
val =0.05;
reader = vtkStructuredPointsReader::New();
reader->SetFileName("/home/semeraro/head.00699.vol");
reader->Update();
iso = vtkSynchronizedTemplates3D::New();
iso->SetInput(reader->GetOutput());
iso->ComputeScalarsOff();
iso->ComputeGradientsOff();
iso->SetNumberOfThreads(2);
cout << " the number of threads is " << iso->GetNumberOfThreads()
<< endl;
vtkTimerLog *timer = vtkTimerLog::New();
for( val = 0.02; val < 0.1; val = val+0.01 ) {
iso->SetValue(0, val);
timer->StartTimer();
iso->Update();
timer->StopTimer();
numTris = iso->GetOutput()->GetNumberOfCells();
cerr << "Update " << val << " took " <<
timer->GetElapsedTime()
<< " seconds to produce " << numTris << " polygons\n";
}
}
At 05:03 PM 4/15/2002 -0400, Lisa Avila wrote:
>I just did a test with my dual processor Pentium IV Xeon 1.7 GHz system.
>With TestSynchronizedTemplates3D.tcl with 1 processor an update took about
>.151 seconds, and with 2 processors it took about .11 seconds. (wall time
>with tcl)
>
>What method are you using from TimerLog? If you are using CPU time - keep
>in mind that it will ALWAYS take longer when using more processors -
>otherwise you would have better than linear speedup! The CPU time adds up
>the time of all threads (except on Windows where it simply reports wall time).
>
>Lisa
>
>
>
>At 10:32 AM 4/15/2002, Dave Semeraro wrote:
>
>>Hello there,
>>
>>I am using vtkSynchronizedTemplates3D to generate isosurface geometry from a
>>structured points data set. I am running the test on a dual 1.4ghz athlon
>>processor linux system
>>running the 2.4.18-xfs kernel. I am timing the results using the
>>vtkTimerLog class. It seems to
>>make little difference in time whether I use 1 or 2 threads to do the
>>test. In fact the 2 thread
>>case seems to run slightly slower. The isosurface value I choose
>>generates over 800,000
>>polygons and takes about 0.8 seconds to complete so I dont think it is a
>>timer resolution
>>problem. I have verified that setting the number of threads does indeed
>>cause both cpus to
>>be used ( verified via top output). I must be doing something wrong. Why
>>bother with threading
>>if you see no difference in speed? Has anyone else seen similar results?
>>Can anyone explain
>>what I am doing wrong?
>>
>>Best Regards,
>>Dave Semeraro
>>
>>Dave Semeraro Ph.D.
>>Visualization and Virtual Environments Group
>>NCSA University of Illinois
>>605 E. Springfield Ave.
>>Champaign, IL 61820
>>Semeraro at ncsa.uiuc.edu
>>(217) 244-1852
>>
>>_______________________________________________
>>This is the private VTK discussion list. Please keep messages on-topic.
>>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>>Follow this link to subscribe/unsubscribe:
>>http://public.kitware.com/mailman/listinfo/vtkusers
Dave Semeraro Ph.D.
Visualization and Virtual Environments Group
NCSA University of Illinois
605 E. Springfield Ave.
Champaign, IL 61820
Semeraro at ncsa.uiuc.edu
(217) 244-1852
More information about the vtkusers
mailing list