[Insight-developers] Cygwin and Multiple processors

Lydia Ng lng@insightful.com
Tue, 14 Aug 2001 17:48:50 -0700


Here is an update on the Cygwin/multi-processor issue
on my two-proc machine:

1) I forced the use of pthread by modifying CMakeCache.txt

//Use the pthreads library
CMAKE_USE_PTHREADS:BOOL=1

By default, it uses the win32 library


2) Everything compiles fine. However, itkMultiThreader wasn't
able to work out the number of processor - so the default number
of threads was set to 1.
Test will build and run but just not multi-thread.


3) To test the multi-threading, I added 

  itk::MultiThreader::SetGlobalDefaultNumberOfThreads(2);

to one of the failing test. It compiled, ran and passed.
When I set the number of threads to greater than 2
then I segmentation violation errors.


So, it would be nice if CMake was able to detect that 
a Cygwin-gcc build and use pthread by default.
itkMultiThreader needs to be modified to so it can
work out the number of processors somehow ....


Cheers,
Lydia


> -----Original Message-----
> From: insight-developers-admin@public.kitware.com
> [mailto:insight-developers-admin@public.kitware.com]On Behalf 
> Of Miller,
> James V (CRD)
> Sent: Friday, July 27, 2001 5:51 PM
> To: 'insight-developers@public.kitware.com'
> Subject: [Insight-developers] Cygwin and Multiple processors
> 
> 
> I did a little investigation on the problem with cygwin and 
> multiple processor machines.  My original
> thought was that itk::MultiThreader did not work under 
> cygwin.  However, on a single processor
> machine I added a line to one of the tests that is failing on 
> multiple processor systems.
> 
> itk::MultiThreader::SetGlobalDefaultNumberOfThreads(4);
> 
> Running the modified test, 4 threads are created and the test 
> passed.  So the problem in creating and
> destroying threads.  
> 
> Rather, it appears as though the problem is in running 
> threads on multiple processors. This is
> something that I will not be able to check into further until 
> I get back from vacation.
> 
> The documentation on cygwin and pthreads is rather spotty.  
> Most pages found by google simply state
> that pthread support is experimental.
> 
> Lydia, if you are looking for something to try: 
> itkMultiThreader.cxx has a number of calls to
> pthread_attr_setscope().  But these calls are all bypassed 
> (ifdef'd out) if we are running under
> Win32.  You might want to enable these calls (there are 
> several of them in the MultiThreader.cxx
> code).  Perhaps we need them for pthread on cygwin but not 
> for pthreads on standard win32.
> 
> I'll be back in the office a week from Monday (maybe Tuesday, 
> maybe Wednesday).
> 
> Jim
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers