[SciPy-dev] distutils, mtrand, Monte Carlo

Robert Kern robert.kern at gmail.com
Tue Apr 18 13:41:02 CDT 2006


Ed Schofield wrote:
> Hi all,
> 
> I've now modified the Monte Carlo package (still in the sandbox) to use
> the RNG from RandomKit that comes with numpy.  It builds and works fine
> for me, but only with two directories hard-coded into the setup.py
> file.  I have some questions (e.g. for Pearu) on how to use numpy
> distutils to do this portably.
> 
> 1. Currently the add_headers method of distutils.misc_util.Configuration
> installs headers to $PREFIX/include/python2.4/numpy.  This doesn't
> bother me, but do we want this?  All other header files are installed
> into $PREFIX/lib/python2.4/site-packages/numpy or scipy/.

What headers are you trying to install?

> 2. The add_library method creates a static library under
> build/temp.linux-etc/.  Is it possible to use distutils to install this
> (e.g. librandomkit.a) to a system-wide location?  (This is necessary to
> prevent scipy having a build dependency on the numpy source files.)

No, distutils does not handle this, and probably cannot do so in any portable way.

> 3. Does distutils support dynamic libraries?  But randomkit is a small
> library, so I suppose static linking is fine here.

Not particularly. But, of course, the approach below is probably the best way:

> I also have a question for Robert K:
> 
> A while ago you offered to work on exporting the mtrand functions so
> other packages could link with them.  Could you please export the
> function prototypes as a separate header file?  This would probably
> require a modification the generate_mtrand_c.py script.  I'd appreciate
> this; then I could modify the montecarlo package to accept a RandomState
> object.

Yes, I've started working on exporting an array all of the functions in
randomkit and distributions.c as a CObject. It will be difficult to expose the
functions that are created by Pyrex since it is generated code, though.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Scipy-dev mailing list