On Wed, Sep 7, 2022, at 07:55, 腾刘 wrote: > Hello, everyone. I'm a newcomer here and looking forward to > contributing to Numpy core code in the future. > > However, there is an obstacle right ahead of me that I don't know how > to figure out the corresponding relationship between Numpy python code > and its C implementation code. In another word, I really want to know > which part of Numpy core C code implements this simple numpy array > addition: > >>>> a = np.array([1, 2, 3]) >>>> b = np.array([2, 3, 4]) >>>> c = a + b > > I have built Numpy from source in a virtual environment (via conda), > and I know the addition described above might be implemented in loop.c > or something like that from StackOverflow, but I want to find a general > approach to solve all these similar problems like: where are array > transpose implemented? where are array reshape implemented? etc. So I > am seeking some tools like GDB and track python step by step. I *can > *use gdb to track python, but I can't set breakpoint in Numpy because > Numpy's C code isn't part of Python interpreter. > > So all in all, my final question is that, how can I debug and track > Numpy's C code and see which part is executed? I believe there must be > a method because the real developers will certainly need to debug.
Hi, As a first pointer, you might find one of the first videos on the NumPy youtube channel (from a NumPy Newcomers’ Hour panel discussion) useful, in case you haven't seen it yet: "Find your way in the NumPy codebase :: Melissa Mendonca, Sebastian Berg, Tyler Reddy, Matti Picus" https://www.youtube.com/watch?v=mTWpBf1zewc . Others in the channel might also be relevant. András > > Thanks in advance. And I'm quite new here, so I'm not sure whether I > should ask this kind of primitive and naive question here, since the > previous discussions seem to be advanced and I can't understand most of > them. > _______________________________________________ > NumPy-Discussion mailing list -- numpy-discussion@python.org > To unsubscribe send an email to numpy-discussion-le...@python.org > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > Member address: deak.and...@gmail.com _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com