Python Forum
compiling numpy, getting C source - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: compiling numpy, getting C source (/thread-35565.html)

Pages: 1 2


compiling numpy, getting C source - Skaperen - Nov-17-2021

i read that some of numpy is written in C. i want to compile that code myself. i could not find C source code within numpy (installed via pip). where can i get the full compilable numpy source code?

i hope it follows PEP 7. i am investigating doing Mandelbrot and Julia sets in numpy.


RE: compiling numpy, getting C source - DeaD_EyE - Nov-17-2021

https://github.com/numpy/numpy

git clone https://github.com/numpy/numpy.git



RE: compiling numpy, getting C source - Gribouillis - Nov-17-2021

Skaperen Wrote:i am investigating doing Mandelbrot and Julia sets in numpy.
In the 1980's, I knew Adrien Douady, a very good french mathematician who investigated the Mandelbrot set. The Douady rabbit is named after him.

At that time, he was producing postcards representing fractal sets. He did that on an IBM 4341. I was a young student and these were great times. Big Grin


RE: compiling numpy, getting C source - Skaperen - Nov-18-2021

my first fractal code was written in assembler on a 4341. soon after that i changed jobs and ran it on a dual processor 3081 and a 4361. it was around 1986.


RE: Issue with program not passing to other elif condition - ghoul - Nov-18-2021

Not sure this would qualify as a fractal.

[Image: 13984d1426315597-patterns-produce-meanin...timage-jpg]

If yes, then that was my first fractal, written in C++, from just six years ago.


RE: compiling numpy, getting C source - Gribouillis - Nov-18-2021

@ghoul I think it does qualify as a fractal because each of the squares it is infinitely self-similar. Can you rewrite it in Python?


RE: compiling numpy, getting C source - Skaperen - Nov-19-2021

i agree, it qualifies as a fractal. i am looking forward to the Python version. i have rewritten a few of my C programs into Python. a few more to go. all my old mainframe code is gone. it was on a stack of about 20 6250 BPI 2400 ft (731.5 m) tapes long gone in some trash dump somewhere. even if i had them, i have no way to read them (yeah, i know, there is a little SCSI tape unit that one could get).


RE: compiling numpy, getting C source - snippsat - Nov-19-2021

(Nov-17-2021, 08:29 PM)Skaperen Wrote: i read that some of numpy is written in C. i want to compile that code myself
There are a mix also use some FORTRAN code used,so need a FORTRAN 77 compiler installed.
There is documentation about this if you had search Building NumPy from source

Numba is also really good,eg just add parallel=True and it will use all your CPU cores or GPU cores.
Portable Compilation Wrote:Ship high performance Python applications without the headache of binary compilation and packaging.
Your source code remains pure Python while Numba handles the compilation at runtime.
We test Numba continuously in more than 200 different platform configurations.

Numba supports Intel and AMD x86, POWER8/9, and ARM CPUs, NVIDIA and AMD GPUs, Python 3.6-3.9, as well as Windows/macOS/Linux.
Precompiled Numba binaries for most systems are available as conda packages and pip-installable wheels.



RE: compiling numpy, getting C source - Gribouillis - Nov-19-2021

Why Fortran 77? Don't you think it is more likely Fortran 2018 or 2008?


RE: compiling numpy, getting C source - snippsat - Nov-19-2021

(Nov-19-2021, 12:55 PM)Gribouillis Wrote: Why Fortran 77? Don't you think it is more likely Fortran 2018 or 2008?
If you look at link i posted.
Building from source Wrote:2. Compilers

To build any extension modules for Python, you’ll need a C compiler.
Various NumPy modules use FORTRAN 77 libraries, so you’ll also need a FORTRAN 77 compiler installed.