-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiThreadedExecutor should use assigned CPUs in the process space if possible. #2037
Comments
It would be nice if the new feature included not only the core number but also a configuration set of pinned cores and priorities for each thread. |
i am not sure about this. probably this is out of scope from this issue atm.
So is i might be mistaken. if that so, could you elaborate the scenario with |
Sorry for my misunderstanding. The title includes "Core affinity," so I thought you were also interested in implementing the core affinity settings (pinned core) for each executor thread, not only the number of cores.
Almost totally agree. However, I'm not sure if the controlled unit should be "event," "event chain," or other things, so far.
Thanks for the suggestion, but I have to investigate some more. |
sorry for the confusion. thanks for the information, that can be also discussed.
that could be useful for mission critical application. i believe those topics have been discussed in micro-ROS community as well. |
Besides the fact that the current MultiThreadedExecutor interface does not allow assigning certain events (subscriptions, timers, etc.) to specific threads, priority inheritance on the This querying works as follows: The first thread of the MultiThreadedExecutor that detects that the current Note that since Galactic, callback groups of the same node may be distributed to multiple executor instances using |
Alternative 1: Dispatcher Executor Configuration:
At runtime:
So, the rclc-Executor design is different to rclcpp Executor, that not each thread in the thread pool calls rcl_wait/rcl_take, but only one dedicated thread is responsible for that. The rclc-Executor povides currently a one-to-one correspondence of a worker thread with a (real-time) priority to a particular handle (subscription). This concept could be extended such that one thread is responsible for multiple handles. Limitations:
Further material
Alternative 2: API for callback-groups and real-time threads As a second alternative, one could also design a real-time Executor in rclcpp using multiple callback groups. Each callback group would be executed by a dedicated (multi-threaded) Executor, which runs in a dedicated real-time thread. Then the user could choose the callback group, and thereby, configuring the priority of the thread, in which the callback function will then be processed. Several people in the community have been requesting some real-time configuration in ROS 2. As a first step, we could setup an example with callback-groups and then design a simple API, so that the user only has to specifiy the priority and the organizational stuff (like callback groups, creation of real-time threads is done in the background). |
thank you so much for introducing information and explanation in detail. really informative. currently @smorita-esol hope this helps you. probably we can open the new issue for this discussion. I would like to have this issue dedicated to be a counter part of ros2/rclpy#1031. And adjusted the title a bit. |
FYI
I've created an issue and implemented a proposal code to control the thread OS scheduling parameters as below. If you are interested in the feature, I'd appreciate it if you could make some comments on it. |
Feature request
Feature description
MultiThreadedExecutor
should honor CPU affinity to be set by user application for process space, including inherited affinity.ros2/rclpy#1031 includes this configuration, so the same behavior should go to
rclcpp
.Using single thread with
MultiThreadedExecutor
will print the warning since it is not recommended, to avoid the possible problem which is described #2029.But if the CPU affinity is set by user application, it will honor that configuration.
Implementation considerations
rcutils
so that we can conceal the platform implementation in client libraries.Related PRs
The text was updated successfully, but these errors were encountered: