Skip to content

fix(control): limit native math threads#140

Merged
dvorak0 merged 3 commits into
mainfrom
xiaole/limit-cmd-vel-native-threads
May 15, 2026
Merged

fix(control): limit native math threads#140
dvorak0 merged 3 commits into
mainfrom
xiaole/limit-cmd-vel-native-threads

Conversation

@xiaolefang-dm
Copy link
Copy Markdown
Contributor

@xiaolefang-dm xiaolefang-dm commented May 12, 2026

Summary

  • limit OpenBLAS/OMP/MKL/NumExpr native worker threads to 1 before importing numpy/scipy in cmd_vel_control
  • prevents small matrix operations in the low-rate Python control node from spawning busy native worker threads on Jetson

Testing

  • python3 -m py_compile tinynav/platforms/cmd_vel_control.py
  • tested manually on current integration test machine by applying the same change in-place and restarting nav nodes
  • observed cmd_vel_control CPU drop from ~170-180% to ~3-4% after warm-up while /cmd_vel remained ~12 Hz

before
image

after
image

@github-actions
Copy link
Copy Markdown

cloc github.com/AlDanial/cloc v 2.04 T=0.17 s (254.3 files/s, 37966.0 lines/s)
Language files blank comment code
Python 13 621 265 3469
Markdown 4 155 6 426
C++ 4 60 38 409
Bourne Shell 15 41 9 272
Dockerfile 1 31 30 202
JSON 2 8 0 58
TOML 1 4 0 58
make 1 18 15 55
CMake 1 4 0 17
-------- -------- -------- -------- --------
SUM: 42 942 363 4966

@xiaolefang-dm xiaolefang-dm requested a review from junlinp May 12, 2026 13:42
@dvorak0
Copy link
Copy Markdown
Member

dvorak0 commented May 14, 2026

@xiaolefang-dm let's make it global, by setting single thread by default in Dockerfile.

@github-actions
Copy link
Copy Markdown

cloc github.com/AlDanial/cloc v 2.04 T=0.18 s (235.7 files/s, 35152.6 lines/s)
Language files blank comment code
Python 13 620 262 3464
Markdown 4 155 6 426
C++ 4 60 38 409
Bourne Shell 15 41 9 272
Dockerfile 1 31 30 203
JSON 2 8 0 58
TOML 1 4 0 58
make 1 18 15 55
CMake 1 4 0 17
-------- -------- -------- -------- --------
SUM: 42 941 360 4962

@github-actions
Copy link
Copy Markdown

cloc github.com/AlDanial/cloc v 2.04 T=0.18 s (237.4 files/s, 35405.2 lines/s)
Language files blank comment code
Python 13 620 262 3464
Markdown 4 155 6 426
C++ 4 60 38 409
Bourne Shell 15 41 9 272
Dockerfile 1 31 32 203
JSON 2 8 0 58
TOML 1 4 0 58
make 1 18 15 55
CMake 1 4 0 17
-------- -------- -------- -------- --------
SUM: 42 941 362 4962

@dvorak0 dvorak0 merged commit e35a1d5 into main May 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants