Pyboard D SF6W has double precision in hardware. Is MicroPython pre-installed already supporting double precision as default ?
In MicroPython download page (http://micropython.org/download) I don't see any separate firmware for single and double precision for Pyboard D, only for Pyboard v1.x.
Pyboard D double precision
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Pyboard D double precision
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
Re: Pyboard D double precision
Yes, it would appear so. I don't have an SF6 to confirm, but the config for the boards is below:
Code: Select all
$ grep MICROPY_FLOAT_IMPL boards/PYBD*/mpconfigboard.mk
boards/PYBD_SF2/mpconfigboard.mk:MICROPY_FLOAT_IMPL = single
boards/PYBD_SF3/mpconfigboard.mk:MICROPY_FLOAT_IMPL = single
boards/PYBD_SF6/mpconfigboard.mk:MICROPY_FLOAT_IMPL = double
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Pyboard D double precision
Changing "stm32/boards/PYBD_SF6/mpconfigboard.mk:MICROPY_FLOAT_IMPL = double" to have "single" value allows to compile the firmware for Pyboard D SF6W with FP32 (single precision).
But changing "stm32/boards/PYBD_SF2/mpconfigboard.mk:MICROPY_FLOAT_IMPL = single" to have "double" value gives an error while compiling the firmware for Pyboard D SF2W with FP64 (double precision) :
The same happens for Pyboard D SF3W.
Is this a bug or I'm not doing the right thing to compile firmware with FP64 for Pyboard D SF2W/SF3W ?
But changing "stm32/boards/PYBD_SF2/mpconfigboard.mk:MICROPY_FLOAT_IMPL = single" to have "double" value gives an error while compiling the firmware for Pyboard D SF2W with FP64 (double precision) :
Code: Select all
CC ../../lib/libm_dbl/thumb_vfp_sqrt.c
/tmp/ccrXMM8q.s: Assembler messages:
/tmp/ccrXMM8q.s:30: Error: selected FPU does not support instruction -- `vsqrt.f64 d0,d0'
make: *** [../../py/mkrules.mk:47: build-PYBD_SF2/lib/libm_dbl/thumb_vfp_sqrt.o] Error 1
Is this a bug or I'm not doing the right thing to compile firmware with FP64 for Pyboard D SF2W/SF3W ?
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
Re: Pyboard D double precision
Yeah I think this is a bug (likely my fault in PR #5197... need a better way to detect double-fp support).
In the meantime can you try modifying stm32/Makefile to
instead of the if statement that's currently there.
In the meantime can you try modifying stm32/Makefile to
Code: Select all
SRC_LIBM += lib/libm_dbl/sqrt.c
Re: Pyboard D double precision
Fixed by https://github.com/micropython/micropython/pull/5264 -- sorry about that!
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Pyboard D double precision
Thanks for your (jimmo and dpgeorge) prompt response : the fix is already merged into micropython:master.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Pyboard D double precision
Complementing the "Benchmark comparison of MicroPython boards" topic with SP/DP (Single/Double Precision) calculations :
- hsquare.py (type Ia supernova calculation with float point for 50,000 points), mean time for each calculation in us :
* Pyboard D SF2W with MicroPython SP v1.11-499-gece4e21a5 (2019-10-28) : 82.6 (120 MHz) / 50.2 (216 MHz);
* Pyboard D SF2W with MicroPython DP v1.11-499-gece4e21a5 (2019-10-28) : 177.0 (120 MHz) / 110.3 (216 MHz);
* Pyboard D SF6W with MicroPython SP v1.11-499-gece4e21a5 (2019-10-28) : 60.4 (144 MHz) / 41.2 (216 MHz);
* Pyboard D SF6W with MicroPython DP v1.11-499-gece4e21a5 (2019-10-28) : 63.4 (144 MHz) / 42.8 (216 MHz).
Conclusions, @ 216 MHz (common speed) :
- Pyboard D SF6W is 22% faster than SF2W on SP;
- Pyboard D SF6W is 158% faster than SF2W on DP;
- Pyboard D SF2W is 120% faster on SP than on DP, because its STM32F722IEK MCU doesn't have double precision in hardware;
- Pyboard D SF6W is 4% faster on SP than on DP, because its STM32F767IIK MCU has double precision in hardware.
I've compiled firmwares for Pyboard v1.1/Lite v1.0/D SF2/3/6 with and without double precision and/or threads, which are available in my Pyboard MicroPython firmware repository.
- hsquare.py (type Ia supernova calculation with float point for 50,000 points), mean time for each calculation in us :
* Pyboard D SF2W with MicroPython SP v1.11-499-gece4e21a5 (2019-10-28) : 82.6 (120 MHz) / 50.2 (216 MHz);
* Pyboard D SF2W with MicroPython DP v1.11-499-gece4e21a5 (2019-10-28) : 177.0 (120 MHz) / 110.3 (216 MHz);
* Pyboard D SF6W with MicroPython SP v1.11-499-gece4e21a5 (2019-10-28) : 60.4 (144 MHz) / 41.2 (216 MHz);
* Pyboard D SF6W with MicroPython DP v1.11-499-gece4e21a5 (2019-10-28) : 63.4 (144 MHz) / 42.8 (216 MHz).
Conclusions, @ 216 MHz (common speed) :
- Pyboard D SF6W is 22% faster than SF2W on SP;
- Pyboard D SF6W is 158% faster than SF2W on DP;
- Pyboard D SF2W is 120% faster on SP than on DP, because its STM32F722IEK MCU doesn't have double precision in hardware;
- Pyboard D SF6W is 4% faster on SP than on DP, because its STM32F767IIK MCU has double precision in hardware.
I've compiled firmwares for Pyboard v1.1/Lite v1.0/D SF2/3/6 with and without double precision and/or threads, which are available in my Pyboard MicroPython firmware repository.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Pyboard D double precision
See the topic 'Pyboard D firmwares with single/double precision, threads and ulab module' for MicroPython v1.12 firmwares for Pyboard D boards with single/double precision and 'ulab' module.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).