[SciPy-Dev] How to compile Scipy without optimisations -O0?

Ralf Gommers ralf.gommers at gmail.com
Tue Sep 29 06:45:27 EDT 2020


On Tue, Sep 29, 2020 at 7:43 AM Matti Picus <matti.picus at gmail.com> wrote:

>
> On 9/29/20 1:15 AM, Blair Azzopardi wrote:
> > On Sun, 27 Sep 2020 at 21:49, Ralf Gommers <ralf.gommers at gmail.com
> > <mailto:ralf.gommers at gmail.com>> wrote:
> >
> >
> >     On Sun, Sep 27, 2020 at 6:26 PM Blair Azzopardi <blairuk at gmail.com
> >     <mailto:blairuk at gmail.com>> wrote:
> >
> >
> >         Short of sifting through the numpy distutils package and
> >         hacking the flags in, I was wondering if there's a recommended
> >         way to do this in Scipy? I'm sure I'm just being daft.
> >
> >
> >     No you got it, this is just badly designed - editing the flags in
> >     numpy.distutils is the best we have unfortunately.
> >
> >
> > Thanks.
> >
> > Eventually I resorted to creating a wrapper around gcc, ie
> >
> > >> ~/bin/cc_no_opt
> > #!/bin/bash
> > declare -a new_args
> > for i in "${@:1}"
> > do new_args+=("$i")
> > done
> > new_args+=("-g" "-O0")
> > gcc ${new_args[@]}
> >
> > Then calling:
> >
> > CC=~/bin/cc_no_opt python setup.py build_ext --inplace
>
>
>
> In NumPy, I can do (on Ubuntu) ``CFLAGS='-O0 -g' gdb --args runtests.py
> ...`` to get a debug build. That doesn't work on SciPy?
>

This may depend on the compiler; we have hardcoded -O3 flags in some
compiler classes, so your line will give `-O0 -O3` or vice versa (not
sure). IIRC gcc takes the last flag when there's conflicting flags, but I'm
not sure this will work the same between compilers and platforms.

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20200929/d503f4e6/attachment.html>


More information about the SciPy-Dev mailing list