[Insight-developers] Thread-safety issues - netlib

Miller, James V (Research) millerjv at crd.ge.com
Mon Jul 11 12:52:54 EDT 2005


Karthik,

Dan Blezek and I are looking at the f2c output.  We might be able to put together an 
awk script to convert the existing code.  I look through the original fortran code
and there are only 3 routines that use COMMON blocks.  So it should be safe to 
replace the statics on the rest of them.

We'll make a pass at converting the files and see if things compile and the current
tests pass.

Jim

-----Original Message-----
From: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com]
Sent: Monday, July 11, 2005 12:08 PM
To: Miller, James V (Research)
Cc: Insight Developers List
Subject: Re: [Insight-developers] Thread-safety issues - netlib


Yes, I am going to weed out some statics and replace them with const 
where appropriate to get at least vnl_svd to work. I was worried about 
going through the code to account for instances where static is really 
needed. (eg a recursive implementation where a function is called 
multiple times, but I don't think that is ever done in netlib).

Thanks
regards
karthik


Miller, James V (Research) wrote:

>Karthik, 
>
>When you use f2c to generate a file without statics, are the differences
>between that file and the one in vxl just the "statics"?  Or is the code
>different in another manner?
>  
>
The code is mostly the same expect for removing statics and some other 
minor changes like
replacing 2.f with (float) 2.0  and variable expansion in places.. etc.

>We should be able to dig up the original fortran.  But if the only difference
>between the f2c generated code with and without statics is to not use the
>keyword static on those lines, when we should just be able to edit them out.
>
>I am not sure how much editting the vxl folks did on the f2c generated code.
>I am aware of one change where they change the mapping of a "long".
>
>Is it possible to run a quick experiment where we edit f2c.h and insert a
>
>#define static
>
>Jim
>
>
>-----Original Message-----
>From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
>[mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On Behalf
>Of Karthik Krishnan
>Sent: Sunday, July 10, 2005 2:31 AM
>To: Insight Developers List
>Subject: [Insight-developers] Thread-safety issues - netlib
>
>
>Hi,
>
>This discussion has cropped up before. I was having some issues with
>thread safety of LAPACK. 
>
>The recently added class itkDiffusionTensor3DReconstructionImageFilter
>is threaded, but the threading does not work (at present). Users of the
>filter need to SetNumberOfThreads(1). Turns out this is because of the
>static defs in dsvdc.c and other related files.
>
>LAPACK's thread safety (therefore vnl's thread safety):
>http://sourceforge.net/mailarchive/forum.php?thread_id=7325117&forum_id=2132
>
>In a recent mail from Andrew Fitzgabbon, he suspects not all statics
>must be removed.
>http://www.itk.org/mailman/private/insight-developers/2005-May/006637.html
>
>The issue has been on vxl's todo list for a while
>http://cvs.sourceforge.net/viewcvs.py/vxl/vxl/TODO.txt?rev=1.12
>
>f2c seems to have some options to generate code without static defs and
>I've been able to compile and generate a few LAPACK C routines from the
>provided FORTRAN files in netlib. 
>
>Invoke f2c with the following options
>f2c -a -C++ file.f
>
>This does produce cleaner code. However some of the vxl folks seem to
>have modified some of the .C files after conversion. Besides I can't
>seem to find all the .f corresponding to the .c files. 
>
>I am wondering if the solution is simply to start weeding out static
>defs from netlib or to look for better faster libraries.. 
>
>Thanks
>Regards
>Karthik
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers
>
>  
>


More information about the Insight-developers mailing list