ulab, or what you will - numpy on bare metal

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
v923z
Posts: 168
Joined: Mon Dec 28, 2015 6:19 pm

Re: ulab, or what you will - numpy on bare metal

Post by v923z » Mon Aug 03, 2020 6:03 pm

rcolistete wrote:
Mon Aug 03, 2020 5:59 pm
v923z wrote:
Mon Aug 03, 2020 5:51 pm
rcolistete wrote:
Mon Aug 03, 2020 5:45 pm
I think it is better (less limitation) to document 'argsort' explaining that it deals with arrays with size up to 65535, due to the internal number types of ulab (uint16 is the maximum integer).
OK, so if the length > 65535, we simply bail out with a ValueError? Could be done.
Yeah, error message and warning in the docs.
OK, will do that. Can you hold off with the firmware files, then? I will try to merge the changes tonight, but it might be tomorrow.

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: ulab, or what you will - numpy on bare metal

Post by rcolistete » Mon Aug 03, 2020 6:08 pm

Yeah, I was planning some days between firmware releases. I'll try to submmit 'linalg.cross()' and 'linalg.norm()' with more features during this wees.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

v923z
Posts: 168
Joined: Mon Dec 28, 2015 6:19 pm

Re: ulab, or what you will - numpy on bare metal

Post by v923z » Mon Aug 03, 2020 6:46 pm

rcolistete wrote:
Mon Aug 03, 2020 6:08 pm
Yeah, I was planning some days between firmware releases. I'll try to submmit 'linalg.cross()' and 'linalg.norm()' with more features during this wees.
Well, actually I managed to merge this now: https://github.com/v923z/micropython-ulab/pull/165

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: ulab, or what you will - numpy on bare metal

Post by rcolistete » Fri Aug 07, 2020 3:35 pm

Some news :
- my new MicroPython Firmwares repository currently have 60 firmware files with ulab (v0.54.0 or v0.54.2) included, for :
* Pyboard Lite v1.0 and Pyboard v1.1;
* Pyboard D SF2 / SF3 / SF6;
* ESP8266;
* ESP32 (with or without PSRAM);
* Pycom boards FiPy / GPy / LoPy v1 / LoPy4 / SiPy / WiPy 2 / WiPy 3;
- Pycom MicroPython firmwares (yeah, I'll announce in Pycom Forum) including :
* 24 firmwares without ulab, in combinations of 6 xxPy boards, Pybytes or not, single/double precision;
* 21 firmwares with ulab, in combinations of 6 xxPy boards, Pybytes or not, single/double precision. 3 LoPy/SiPy/WiPy firmwares with ulab and Pybytes combinations are not possible due to the small firmware partition size of these boards. These firmwares with ulab have 'MICROPY_PY_REVERSE_SPECIAL_METHODS' enabled to allow '1 + np.arange(10)', for example.

Pycom MicroPython firmwares with ulab was not simple at all : some backporting was needed from MicroPython v1.12 to Pycom MicroPython (based in v1.11).
Last edited by rcolistete on Fri Aug 07, 2020 6:14 pm, edited 2 times in total.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

v923z
Posts: 168
Joined: Mon Dec 28, 2015 6:19 pm

Re: ulab, or what you will - numpy on bare metal

Post by v923z » Fri Aug 07, 2020 4:04 pm

rcolistete wrote:
Fri Aug 07, 2020 3:35 pm
Some news :
- my new MicroPython Firmwares repository, where currently there are 60 firmware files with ulab (v0.54.0 or v0.54.2)
Thanks! I have updated the link.

thiagofe
Posts: 1
Joined: Fri Jul 24, 2020 9:18 pm

Re: ulab, or what you will - numpy on bare metal

Post by thiagofe » Thu Aug 13, 2020 1:38 am

ulab Samples is a repository with links, examples, benchmarks, etc, about ulab module, a NumPy-like array manipulation library for MicroPython and CircuitPython.

Most interesting is the ulab FFT benchmark for 1024 points, where you can see many MicroPython and CircuitPython boards compared, with calculations in single precision (SP/FP32) and double precision (DP/FP64) for floating point numbers, when possible (due to availabity of firmware with support for FP32/FP64).

The OpenMV Cam H7 board and OpenMV firmware supporting only single precision (FP32) is the clear winner in FP32 FFT.

While Sipeed MAix BiT with RISC-V 64bit Kendryte K210 is the winner in double precision (FP64) FFT when using the MicroPython for K210 Lobo firmware (supporting only FP64).

Pyboard D SF6 with ARM Cortex-M7 STM32F767VIT has dual precision hardware support (FP64), is 2nd in FP64 FFT and 3rd in FP32 FFT;

Pyboard D SF2 with ARM Cortex-M7 STM32F722IEK and only FP32 hardware support, it is in 4th place and almost the same performance as Pyboard D SF6 in FP32 FFT, and in 3rd place in FP64 FFT;

See more comments in ulab Samples repository.

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: ulab, or what you will - numpy on bare metal

Post by rcolistete » Mon Aug 17, 2020 11:34 pm

Some teasing : 8-) :mrgreen:

Code: Select all

MicroPython v1.12-670-gf55324882 on 2020-08-17; micro:bit with NRF51822
Type "help()" for more information.
import gc
gc.collect()
gc.mem_free()
    10416
1/3
    0.3333333
import ulab as np
np.__version__
    '0.54.2'
np.
    __class__       __name__        __version__     approx
    arange          array           compare         eye
    fft             filter          float           get_printoptions
    int16           int8            linalg          linspace
    numerical       ones            poly            set_printoptions
    uint16          uint8           user            vector
    zeros
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

zaord
Posts: 96
Joined: Fri Jan 31, 2020 3:56 pm

Re: ulab, or what you will - numpy on bare metal

Post by zaord » Mon Aug 30, 2021 10:29 am

Hi, i am looking for a way to make a hilbert transform in micropython.
Is it normally a part of scipy module.
Is it possible to do that in micropython ?
Best ;)

v923z
Posts: 168
Joined: Mon Dec 28, 2015 6:19 pm

Re: ulab, or what you will - numpy on bare metal

Post by v923z » Mon Aug 30, 2021 11:02 am

zaord wrote:
Mon Aug 30, 2021 10:29 am
Hi, i am looking for a way to make a hilbert transform in micropython.
Is it normally a part of scipy module.
In order to get the Hilbert transform, do you need anything beyond a combination of the Fourier and inverse Fourier transforms, and standard array operations?
zaord wrote:
Mon Aug 30, 2021 10:29 am
Is it possible to do that in micropython ?
If you think a feature is missing, you would have better luck raising an issue here https://github.com/v923z/micropython-ulab/issues

Post Reply