Python Forum
compiling numpy, getting C source
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
compiling numpy, getting C source
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
https://github.com/numpy/numpy

git clone https://github.com/numpy/numpy.git
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
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
ndc85430 likes this post
Reply
#4
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.
Gribouillis likes this post
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
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.
Reply
#6
@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?
Reply
#7
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).
Gribouillis likes this post
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#8
(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.
Skaperen likes this post
Reply
#9
Why Fortran 77? Don't you think it is more likely Fortran 2018 or 2008?
Reply
#10
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  compiling with an undefined variable Skaperen 0 977 Nov-10-2022, 11:59 PM
Last Post: Skaperen
  compiling but not running source code Skaperen 1 1,296 Jun-05-2022, 10:47 PM
Last Post: Gribouillis
  python compiling and sql? abrogard 2 2,232 Oct-27-2020, 06:37 AM
Last Post: buran
  compiling to python-- should ; be used or not? ezdev 4 3,724 Jan-03-2018, 07:31 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020