pydata/numexpr

How to debug with numexpr?

27rabbitlt opened this issue · 3 comments

Hello~

I'm curious about the implementation of Numexpr and really attracted by the 20x speed up (tested on my machine) compared with Numpy.

I used to dig deep in Numpy's C code to find out how np.sum(a, b) is implemented using gdb but it doesn't work here.

I guess there are two reasons:

  1. I don't know how to build and use Numexpr in-place
  2. I don't know how to add debugging options when compiling Numexpr (the compiling process or compiling flags seem not to be accessible, we could only run python setup.py build)

I believe there must be a method for you guys, developpers and maintainers, to debug with this complicated project. Are there any suggestions or instructions?

We're using the new pyproject.toml based build system with some very minor modifications. To install in-place, just use Pip:

pip install -e .

I don't use gdb, NumExpr is very heavily multi-threaded so I don't see how much use it would be. I use valgrind for locating C++ bugs which is a very different approach.

Another thing that is advisable, because NumExpr 2.8 is full of deeply nested macros, is to use the -E flag with gcc on build once to generate all the expanded source files. This would be added into extra_cflags in setup.py on building the extension.

@robbmcleod So much thanks!
I will use pip install -e ., I didn't know this before.

I use gdb because I used it for Numpy, which is completely not multi-threaded. Now I will try to use valgrind instead.

So much thanks again, though I have another new question, I think I should close this one and open another since they are irrelevant.