[C++-sig] Status of Numpy support in boost python - II

Neal Becker ndbecker2 at gmail.com
Tue Jan 4 14:34:01 CET 2011

I'm interested in the ndarray http://code.google.com/p/ndarray package.

I still need to figure out how to get it to compile against my customized boost 
installation in a non-standard location.

Unfortunately, trying to build the 'test' results in ICE in 
gcc-4.5.1-4.fc14.x86_64 (reported upstream)

g++ -o boost.python/ndarray/libs/python/ndarray/test/ndarray_mod.os -c -O2 -fno-
strict-aliasing -g -pipe -Wall -fexceptions -fstack-protector --param=ssp-
buffer-size=4 -m64 -mtune=generic -fPIC -fwrapv -fPIC -Wp,-D_FORTIFY_SOURCE=2 -
DNDEBUG -D_GNU_SOURCE -Iinclude -I/usr/include/python2.7 -
I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/eigen2 
boost.python/ndarray/libs/python/ndarray/test/ndarray_mod.cpp -I include
In file included from include/ndarray/ArrayTraits.hpp:11:0,
                 from include/ndarray/Array.hpp:11,
                 from include/ndarray.hpp:9,
                 from include/boost/python/ndarray/Array.hpp:5,
                 from include/boost/python/ndarray/ndarray.hpp:4,
include/ndarray/ExpressionTraits.hpp: In instantiation of 
1, 1>, ndarray::Array<double, 1, 1>, 
ndarray::detail::EqualToTag::ScalarFunction<double, double>, 1> >’:
include/ndarray/ExpressionBase.hpp:33:57:   instantiated from 
1, 1>, ndarray::Array<double, 1, 1>, 
ndarray::detail::EqualToTag::ScalarFunction<double, double>, 1> >’
include/ndarray/detail/BinaryOp.hpp:81:108:   instantiated from 
‘ndarray::detail::BinaryOpExpression<ndarray::Array<double, 1, 1>, 
ndarray::Array<double, 1, 1>, 
ndarray::detail::EqualToTag::ScalarFunction<double, double>, 1>’
instantiated from ‘bool acceptArray(const ndarray::Array<T, N, C>&) [with T = 
double, int N = 1, int C = 1]’
instantiated from here
include/ndarray/ExpressionTraits.hpp:88:165: internal compiler error: 
Segmentation fault

Jim Bosch wrote:

> On 01/03/2011 01:44 PM, Ralf W. Grosse-Kunstleve wrote:
>> ----- Original Message ----
>>> From: Neal Becker<ndbecker2 at gmail.com>
>>> To: cplusplus-sig at python.org
>>> Sent: Mon, January 3, 2011 12:31:36 PM
>>> Subject: [C++-sig] Status of Numpy support in boost python - II
>>> I was just re-reading these posts: Status of Numpy support in boost  python
>>> http://web.archiveorange.com/archive/v/YJlerznoeRShLhlurQzC
>>> I  wonder if there are any updates?
> My low-level numpy library (basically a Boost.Python wrapper for the
> Numpy C-API) has received slow but steady updates.  This is similar to
> the built-in Boost.Python numpy support, with a few extra features:
>   - Raw-pointer access to Numpy arrays.
>   - Constructing Numpy arrays from raw C++ pointers.
>   - A C++ dtype object.
>   - Tools to wrap C++ functors to behave like broadcasting numpy
> universal functions.
> This can be found in the boost sandbox:
> https://svn.boost.org/svn/boost/sandbox/numpy
> I have also built Boost.Python converters for my own ndarray library
> (see below) and Eigen 2.  Right now the build system (scons-based) is
> tailored to my own needs, but it should be pretty easy for others to
> tweak as needed.  Feel free to email me if you need help.
> I've included all of those in the ndarray package, though it should be
> possible to separate out the eigen bits and not use ndarray if you'd
> like.  All that's here:
> http://code.google.com/p/ndarray/
>>> Is ndarray working with current (1.45.0)  boost?
> Probably.  I haven't tested 1.45, I compiled recently on 1.44.  I have
> been doing most of my work using 1.40, but I don't think anything has
> changed in Boost.Python since then that would affect ndarray.
>> Boost.Python's existing numpy array support has been working all the time. It
>> sounds like you are expecting new functionality. Could you be more specific?
> <what Stefan Seefeld said>
> I think the low-level API I have in the sandbox fits this need, or at
> least provides some of the basics.  I'd love to see that morph into
> something that we can all use to connect numpy to the C++ template
> library of our choice, since we'll all never agreed on those.
> Jim

More information about the Cplusplus-sig mailing list