On Fri, Sep 2, 2016 at 1:16 AM, Peter Creasey <p.e.creasey...@googlemail.com
> wrote:

> > I'm not quite sure which approach is state-of-the-art as of 2016. How
> would
> > you do it if you had to make a C/C++ library available in Python right
> now?
> >
> > In my case, I have a C library with some scientific functions on matrices
> > and vectors. You will typically call a few functions to configure the
> > computation, then hand over some pointers to existing buffers containing
> > vector data, then start the computation, and finally read back the data.
> > The library also can use MPI to parallelize.
>

Cython works really well for this.

ctypes is a better option if you have a "black box" shared lib you want a
call a couple functions in.

Cython works better if you want to write a little "thicker" wrapper around
youe C code -- i.e. it may do a scalar computation, and you want to apply
it to an entire numpy array, at C speed.

Either would work in this case, But I like Cyton better, as long as I don't
have compilation issues.

-Chris




-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to