Skip to content

makefiles/info-global: speedup info-boards-* targets by using parallel execution#22355

Open
crasbe wants to merge 8 commits into
RIOT-OS:masterfrom
crasbe:pr/speedup_info-global
Open

makefiles/info-global: speedup info-boards-* targets by using parallel execution#22355
crasbe wants to merge 8 commits into
RIOT-OS:masterfrom
crasbe:pr/speedup_info-global

Conversation

@crasbe

@crasbe crasbe commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Contribution description

Currently, make info-boards-supported is raaaather slow.

Instead of calling a subroutine with eval over and over for every board, which is not parallizable, I changed the targets in a way that a new RIOT environment is called for each board, which is perfectly parallizable. But even without multithreading, this is a significant performance boost.

The downside is, that temporary files have to be created to save the results.

The gain is that this will speed up scripts like compile_like_murdock.py significantly

Testing procedure

Current master:

cbuec@W11nMate:~/RIOTstuff/riot-vanillaice/RIOT$ time make -C examples/lang_support/community/micropython info-boards-supported
make: Entering directory '/home/cbuec/RIOTstuff/riot-vanillaice/RIOT/examples/lang_support/community/micropython'
using BOARD="native64" as "native" on a 64-bit system
acd52832 adafruit-clue adafruit-feather-nrf52840-express adafruit-feather-nrf52840-sense adafruit-grand-central-m4-express adafruit-itsybitsy-m4 adafruit-itsybitsy-nrf52 adafruit-metro-m4-express adafruit-pybadge airfy-beacon alientek-pandora arduino-due arduino-mkr1000 arduino-mkrfox1200 arduino-mkrwan1300 arduino-mkrzero arduino-nano-33-ble arduino-nano-33-ble-sense arduino-nano-33-iot arduino-zero avsextrem b-l072z-lrwan1 b-l475e-iot01a b-u585i-iot02a bastwan bitcraze-crazyflie21-main blackpill-stm32f103c8 blackpill-stm32f103cb bluepill-stm32f030c8 bluepill-stm32f103c8 bluepill-stm32f103cb calliope-mini cc1312-launchpad cc1350-launchpad cc1352-launchpad cc1352p-launchpad cc2538dk cc2650-launchpad cc2650stk dwm1001 e104-bt5010a-tb e104-bt5011a-tb e180-zg120b-tb ek-lm4f120xl f4vi1 feather-m0 feather-m0-lora feather-m0-wifi firefly frdm-k22f frdm-k64f frdm-kl43z frdm-kw41z generic-cc2538-cc2592-dk hamilton i-nucleo-lrwan1 ikea-tradfri im880b iotlab-a8-m3 iotlab-m3 limifrog-v1 lobaro-lorabox lora-e5-dev lsn50 maple-mini mbed_lpc1768 mcb2388 microbit microbit-v2 msba2 msbiot mulle native32 native64 nrf51dk nrf51dongle nrf52832-mdk nrf52840-mdk nrf52840-mdk-dongle nrf52840dk nrf52840dongle nrf52dk nrf5340dk-app nrf9160dk nucleo-c031c6 nucleo-c071rb nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 nucleo-f070rb nucleo-f072rb nucleo-f091rc nucleo-f103rb nucleo-f207zg nucleo-f302r8 nucleo-f303k8 nucleo-f303re nucleo-f303ze nucleo-f334r8 nucleo-f401re nucleo-f410rb nucleo-f411re nucleo-f412zg nucleo-f413zh nucleo-f429zi nucleo-f439zi nucleo-f446re nucleo-f446ze nucleo-f722ze nucleo-f746zg nucleo-f767zi nucleo-g070rb nucleo-g071rb nucleo-g431rb nucleo-g474re nucleo-h753zi nucleo-l011k4 nucleo-l031k6 nucleo-l053r8 nucleo-l073rz nucleo-l152re nucleo-l412kb nucleo-l432kc nucleo-l433rc nucleo-l452re nucleo-l476rg nucleo-l496zg nucleo-l4r5zi nucleo-l552ze-q nucleo-u575zi-q nucleo-wl55jc nz32-sc151 olimexino-stm32 omote opencm904 openlabs-kw41z-mini openlabs-kw41z-mini-256kib openmote-b openmote-cc2538 p-l496g-cell02 p-nucleo-wb55 particle-argon particle-boron particle-xenon pba-d-01-kw2x phynode-kw41z pinetime pro-micro-nrf52840 pyboard qn9080dk reel remote-pa remote-reva remote-revb rpi-pico rpi-pico-w ruuvitag sam4s-xpro samd10-xmini samd20-xpro samd21-xpro same51-curiosity-nano same54-xpro saml10-xpro saml11-xpro saml21-xpro samr21-xpro samr30-xpro samr34-xpro seeedstudio-sensecap-t1000e seeedstudio-xiao-nrf52840 seeedstudio-xiao-nrf52840-sense seeeduino_arch-pro seeeduino_xiao sensebox_samd21 serpente slstk3301a slstk3400a slstk3401a slstk3402a slstk3701a sltb001a sltb009a slwstk6000b-slwrb4150a slwstk6000b-slwrb4162a slwstk6220a sodaq-autonomo sodaq-explorer sodaq-one sodaq-sara-aff sodaq-sara-sff spark-core stk3200 stk3600 stk3700 stm32c0116-dk stm32c0316-dk stm32f030f4-demo stm32f0discovery stm32f3discovery stm32f429i-disc1 stm32f429i-disco stm32f469i-disco stm32f4discovery stm32f723e-disco stm32f746g-disco stm32f7508-dk stm32f769i-disco stm32g0316-disco stm32l0538-disco stm32l476g-disco stm32l496g-disco stm32mp157c-dk2 teensy31 thingy52 ublox-c030-u201 udoo usb-kw41z waveshare-nrf52840-eval-kit weact-f401cc weact-f401ce weact-f411ce weact-g030f6 wemos-zero xg23-pk6068a yarm yunjia-nrf51822
make: Leaving directory '/home/cbuec/RIOTstuff/riot-vanillaice/RIOT/examples/lang_support/community/micropython'

real    0m23.749s
user    0m10.668s
sys     0m12.731s

This PR without multithreading:

cbuec@W11nMate:~/RIOTstuff/riot-vanillaice/RIOT$ time make -C examples/lang_support/community/micropython info-boards-supported
make: Entering directory '/home/cbuec/RIOTstuff/riot-vanillaice/RIOT/examples/lang_support/community/micropython'
using BOARD="native64" as "native" on a 64-bit system
acd52832 adafruit-clue adafruit-feather-nrf52840-express adafruit-feather-nrf52840-sense adafruit-grand-central-m4-express adafruit-itsybitsy-m4 adafruit-itsybitsy-nrf52 adafruit-metro-m4-express adafruit-pybadge airfy-beacon alientek-pandora arduino-due arduino-mkr1000 arduino-mkrfox1200 arduino-mkrwan1300 arduino-mkrzero arduino-nano-33-ble arduino-nano-33-ble-sense arduino-nano-33-iot arduino-zero avsextrem b-l072z-lrwan1 b-l475e-iot01a b-u585i-iot02a bastwan bitcraze-crazyflie21-main blackpill-stm32f103c8 blackpill-stm32f103cb bluepill-stm32f030c8 bluepill-stm32f103c8 bluepill-stm32f103cb calliope-mini cc1312-launchpad cc1350-launchpad cc1352-launchpad cc1352p-launchpad cc2538dk cc2650-launchpad cc2650stk dwm1001 e104-bt5010a-tb e104-bt5011a-tb e180-zg120b-tb ek-lm4f120xl f4vi1 feather-m0 feather-m0-lora feather-m0-wifi firefly frdm-k22f frdm-k64f frdm-kl43z frdm-kw41z generic-cc2538-cc2592-dk hamilton i-nucleo-lrwan1 ikea-tradfri im880b iotlab-a8-m3 iotlab-m3 limifrog-v1 lobaro-lorabox lora-e5-dev lsn50 maple-mini mbed_lpc1768 mcb2388 microbit microbit-v2 msba2 msbiot mulle native32 native64 nrf51dk nrf51dongle nrf52832-mdk nrf52840-mdk nrf52840-mdk-dongle nrf52840dk nrf52840dongle nrf52dk nrf5340dk-app nrf9160dk nucleo-c031c6 nucleo-c071rb nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 nucleo-f070rb nucleo-f072rb nucleo-f091rc nucleo-f103rb nucleo-f207zg nucleo-f302r8 nucleo-f303k8 nucleo-f303re nucleo-f303ze nucleo-f334r8 nucleo-f401re nucleo-f410rb nucleo-f411re nucleo-f412zg nucleo-f413zh nucleo-f429zi nucleo-f439zi nucleo-f446re nucleo-f446ze nucleo-f722ze nucleo-f746zg nucleo-f767zi nucleo-g070rb nucleo-g071rb nucleo-g431rb nucleo-g474re nucleo-h753zi nucleo-l011k4 nucleo-l031k6 nucleo-l053r8 nucleo-l073rz nucleo-l152re nucleo-l412kb nucleo-l432kc nucleo-l433rc nucleo-l452re nucleo-l476rg nucleo-l496zg nucleo-l4r5zi nucleo-l552ze-q nucleo-u575zi-q nucleo-wl55jc nz32-sc151 olimexino-stm32 omote opencm904 openlabs-kw41z-mini openlabs-kw41z-mini-256kib openmote-b openmote-cc2538 p-l496g-cell02 p-nucleo-wb55 particle-argon particle-boron particle-xenon pba-d-01-kw2x phynode-kw41z pinetime pro-micro-nrf52840 pyboard qn9080dk reel remote-pa remote-reva remote-revb rpi-pico rpi-pico-w ruuvitag sam4s-xpro samd10-xmini samd20-xpro samd21-xpro same51-curiosity-nano same54-xpro saml10-xpro saml11-xpro saml21-xpro samr21-xpro samr30-xpro samr34-xpro seeedstudio-sensecap-t1000e seeedstudio-xiao-nrf52840 seeedstudio-xiao-nrf52840-sense seeeduino_arch-pro seeeduino_xiao sensebox_samd21 serpente slstk3301a slstk3400a slstk3401a slstk3402a slstk3701a sltb001a sltb009a slwstk6000b-slwrb4150a slwstk6000b-slwrb4162a slwstk6220a sodaq-autonomo sodaq-explorer sodaq-one sodaq-sara-aff sodaq-sara-sff spark-core stk3200 stk3600 stk3700 stm32c0116-dk stm32c0316-dk stm32f030f4-demo stm32f0discovery stm32f3discovery stm32f429i-disc1 stm32f429i-disco stm32f469i-disco stm32f4discovery stm32f723e-disco stm32f746g-disco stm32f7508-dk stm32f769i-disco stm32g0316-disco stm32l0538-disco stm32l476g-disco stm32l496g-disco stm32mp157c-dk2 teensy31 thingy52 ublox-c030-u201 udoo usb-kw41z waveshare-nrf52840-eval-kit weact-f401cc weact-f401ce weact-f411ce weact-g030f6 wemos-zero xg23-pk6068a yarm yunjia-nrf51822
make: Leaving directory '/home/cbuec/RIOTstuff/riot-vanillaice/RIOT/examples/lang_support/community/micropython'

real    0m4.777s
user    0m3.646s
sys     0m0.912s

This PR with multithreading:

cbuec@W11nMate:~/RIOTstuff/riot-vanillaice/RIOT$ time make -C examples/lang_support/community/micropython info-boards-supported -j
make: Entering directory '/home/cbuec/RIOTstuff/riot-vanillaice/RIOT/examples/lang_support/community/micropython'
using BOARD="native64" as "native" on a 64-bit system
acd52832 adafruit-clue adafruit-feather-nrf52840-express adafruit-feather-nrf52840-sense adafruit-grand-central-m4-express adafruit-itsybitsy-m4 adafruit-itsybitsy-nrf52 adafruit-metro-m4-express adafruit-pybadge airfy-beacon alientek-pandora arduino-due arduino-mkr1000 arduino-mkrfox1200 arduino-mkrwan1300 arduino-mkrzero arduino-nano-33-ble arduino-nano-33-ble-sense arduino-nano-33-iot arduino-zero avsextrem b-l072z-lrwan1 b-l475e-iot01a b-u585i-iot02a bastwan bitcraze-crazyflie21-main blackpill-stm32f103c8 blackpill-stm32f103cb bluepill-stm32f030c8 bluepill-stm32f103c8 bluepill-stm32f103cb calliope-mini cc1312-launchpad cc1350-launchpad cc1352-launchpad cc1352p-launchpad cc2538dk cc2650-launchpad cc2650stk dwm1001 e104-bt5010a-tb e104-bt5011a-tb e180-zg120b-tb ek-lm4f120xl f4vi1 feather-m0 feather-m0-lora feather-m0-wifi firefly frdm-k22f frdm-k64f frdm-kl43z frdm-kw41z generic-cc2538-cc2592-dk hamilton i-nucleo-lrwan1 ikea-tradfri im880b iotlab-a8-m3 iotlab-m3 limifrog-v1 lobaro-lorabox lora-e5-dev lsn50 maple-mini mbed_lpc1768 mcb2388 microbit microbit-v2 msba2 msbiot mulle native32 native64 nrf51dk nrf51dongle nrf52832-mdk nrf52840-mdk nrf52840-mdk-dongle nrf52840dk nrf52840dongle nrf52dk nrf5340dk-app nrf9160dk nucleo-c031c6 nucleo-c071rb nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 nucleo-f070rb nucleo-f072rb nucleo-f091rc nucleo-f103rb nucleo-f207zg nucleo-f302r8 nucleo-f303k8 nucleo-f303re nucleo-f303ze nucleo-f334r8 nucleo-f401re nucleo-f410rb nucleo-f411re nucleo-f412zg nucleo-f413zh nucleo-f429zi nucleo-f439zi nucleo-f446re nucleo-f446ze nucleo-f722ze nucleo-f746zg nucleo-f767zi nucleo-g070rb nucleo-g071rb nucleo-g431rb nucleo-g474re nucleo-h753zi nucleo-l011k4 nucleo-l031k6 nucleo-l053r8 nucleo-l073rz nucleo-l152re nucleo-l412kb nucleo-l432kc nucleo-l433rc nucleo-l452re nucleo-l476rg nucleo-l496zg nucleo-l4r5zi nucleo-l552ze-q nucleo-u575zi-q nucleo-wl55jc nz32-sc151 olimexino-stm32 omote opencm904 openlabs-kw41z-mini openlabs-kw41z-mini-256kib openmote-b openmote-cc2538 p-l496g-cell02 p-nucleo-wb55 particle-argon particle-boron particle-xenon pba-d-01-kw2x phynode-kw41z pinetime pro-micro-nrf52840 pyboard qn9080dk reel remote-pa remote-reva remote-revb rpi-pico rpi-pico-w ruuvitag sam4s-xpro samd10-xmini samd20-xpro samd21-xpro same51-curiosity-nano same54-xpro saml10-xpro saml11-xpro saml21-xpro samr21-xpro samr30-xpro samr34-xpro seeedstudio-sensecap-t1000e seeedstudio-xiao-nrf52840 seeedstudio-xiao-nrf52840-sense seeeduino_arch-pro seeeduino_xiao sensebox_samd21 serpente slstk3301a slstk3400a slstk3401a slstk3402a slstk3701a sltb001a sltb009a slwstk6000b-slwrb4150a slwstk6000b-slwrb4162a slwstk6220a sodaq-autonomo sodaq-explorer sodaq-one sodaq-sara-aff sodaq-sara-sff spark-core stk3200 stk3600 stk3700 stm32c0116-dk stm32c0316-dk stm32f030f4-demo stm32f0discovery stm32f3discovery stm32f429i-disc1 stm32f429i-disco stm32f469i-disco stm32f4discovery stm32f723e-disco stm32f746g-disco stm32f7508-dk stm32f769i-disco stm32g0316-disco stm32l0538-disco stm32l476g-disco stm32l496g-disco stm32mp157c-dk2 teensy31 thingy52 ublox-c030-u201 udoo usb-kw41z waveshare-nrf52840-eval-kit weact-f401cc weact-f401ce weact-f411ce weact-g030f6 wemos-zero xg23-pk6068a yarm yunjia-nrf51822
make: Leaving directory '/home/cbuec/RIOTstuff/riot-vanillaice/RIOT/examples/lang_support/community/micropython'

real    0m0.706s
user    0m5.573s
sys     0m1.953s

Issues/PRs references

None.

Declaration of AI-Tools / LLMs usage:

AI-Tools / LLMs that were used are:

  • none

@crasbe crasbe added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 7, 2026
@github-actions github-actions Bot added Area: doc Area: Documentation Area: build system Area: Build system Area: CI Area: Continuous Integration of RIOT components Area: tools Area: Supplementary tools labels Jun 7, 2026
@crasbe crasbe changed the title Pr/speedup info global makefiles/info-global: speedup info-boards-* targets by using parallel execution Jun 7, 2026
@riot-ci

riot-ci commented Jun 7, 2026

Copy link
Copy Markdown

Murdock results

✔️ PASSED

6ed3ebb fixup! Apply suggestions from code review

Success Failures Total Runtime
11128 0 11130 10m:06s

Artifacts

@crasbe crasbe added the CI: no fast fail don't abort PR build after first error label Jun 7, 2026
@github-actions github-actions Bot added the Area: tests Area: tests and testing framework label Jun 7, 2026
@crasbe

crasbe commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Oh fun, this uncovered a bug in the info-global Makefile too:

The tests/drivers/dose/Makefile has a check if the board is samr21-xpro or same54-xpro and includes the dose_watchdog module if that is the case. Now when the Makefile is called, the default board for tests is selected, which is samr21-xpro and therefore selects the dose_watchdog module.

Now here comes the bug: The current implementation saves the USEMODULE variable for all boards to use, so instead of the two boards, all boards will have the dose_watchdog module included.

That module requires periph_timer_periodic, which is not provided by all boards. This then hid the one board (the stk3200), which does not have enough memory for the tests/drivers/dose test.

@crasbe crasbe added the CI: full build disable CI build filter label Jun 7, 2026
@crasbe

crasbe commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author
image

That error is wild :D

@github-actions github-actions Bot added the Area: examples Area: Example Applications label Jun 7, 2026
@crasbe crasbe added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 7, 2026
@crasbe

crasbe commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure why .murdock reacts so fragile to the multithreaded approach. It seems to be undeterministic and I can't reproduce it locally.

I'll let /bin/bash -c "QUICK_BUILD=0; set -e; while true; do source .murdock; JOBS=32 get_app_board_toolchain_pairs examples/networking/misc/telnet_server; done; set +e" run for a while and see if it maybe breaks.

Otherwise we'll just set the number of threads to a lower value and live with only a 10-20x improvement over a 30-40x improvement 🤷

Comment thread makefiles/info-global.inc.mk
@crasbe crasbe removed the CI: full build disable CI build filter label Jun 8, 2026
@crasbe crasbe force-pushed the pr/speedup_info-global branch from 04444ed to 0127f23 Compare June 8, 2026 15:14
@crasbe

crasbe commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure why .murdock reacts so fragile to the multithreaded approach. It seems to be undeterministic and I can't reproduce it locally.

I'll let /bin/bash -c "QUICK_BUILD=0; set -e; while true; do source .murdock; JOBS=32 get_app_board_toolchain_pairs examples/networking/misc/telnet_server; done; set +e" run for a while and see if it maybe breaks.

Otherwise we'll just set the number of threads to a lower value and live with only a 10-20x improvement over a 30-40x improvement 🤷

Couldn't trigger it after 4 hours 🤷

@mguetschow mguetschow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you really strive to become our buildsystem maintainer :P

Comment thread makefiles/info-global.inc.mk
Comment thread makefiles/info-global.inc.mk Outdated
@$(MAKE) BOARD=$* INFO_OVERRIDE=1 info-boards-collect --no-print-directory

info-boards-supported: bin/.INFO_BOARDS_SUPPORTED $(BOARD_CANDIDATES)
@cat bin/.INFO_BOARDS_SUPPORTED | sort | xargs echo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@cat bin/.INFO_BOARDS_SUPPORTED | sort | xargs echo
@cat bin/.INFO_BOARDS_SUPPORTED | sort | xargs echo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why don't you sort them in the first place before writing them to the file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the point why I use a file in the first place instead of printing it to stdout: make starts a submake for each board and depending on the complexity of the dependency resolution, it might be faster or slower. With -j1, everything will be done in order (but still not guaranteed), but with -j>1, the order can't be guaranteed anymore.

While it would be possible to specify the target as .NOTPARALLEL, that would defeat the purpose 😅

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, but doesn't that mean that the file is written to from several make instances? I thought you ruled that out in your response to @maribu above.

Comment thread makefiles/info-global.inc.mk Outdated
Comment thread makefiles/info-global.inc.mk Outdated
Comment thread .murdock
Comment on lines +8 to +12
ifneq (,$(filter info-boards-collect, $(MAKECMDGOALS)))
ifneq (1,$(INFO_OVERRIDE))
$(error info-boards-collect should not be called directly!)
endif
endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use your newly introduced PRIVATE_GLOBAL_GOALS variable to check for any such "private global goal", probably outside of this file actually?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess. Do you have any in mind?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any file, you mean? Maybe just in Makefile.include where you added the variable.

crasbe and others added 3 commits June 9, 2026 15:50
Co-authored-by: mguetschow <mikolai.guetschow@tu-dresden.de>
Co-authored-by: crasbe <crasbe@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Area: CI Area: Continuous Integration of RIOT components Area: doc Area: Documentation Area: examples Area: Example Applications Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants