Hello everyone, I am running multiple nodes in different executables and I would like to use MultiThreadedExecutor. However, how to know which cores are my nodes using ?
The main idea is verify which nodes are working on which computer cores and then after use rclcpp::executors::MultiThreadedExecutor check if they were used in different cores.
Asked by Juan Carlos on 2023-05-31 16:14:21 UTC
Answers
how to know which cores are my nodes using ?
This is decided by your operating system, and usually the cpu cores change from one second to the next. So this is not really a useful question.
If you are trying to compare the behavior of SingleThreadedExecutor to MultiThreadedExecutor, and determine the number of threads that exist for a particular linux process, then (on linux) you can use the /bin/ps
command. If the Process Id (PID) of your ros node is 29969, then:
$ /bin/ps -p 29969 -L -f
UID PID PPID LWP C NLWP STIME TTY TIME CMD
mike 29969 2820 29969 0 3 07:24 pts/0 00:00:00 /usr/bin/python /opt/ros/melodi
mike 29969 2820 29990 0 3 07:24 pts/0 00:00:00 /usr/bin/python /opt/ros/melodi
mike 29969 2820 29991 0 3 07:24 pts/0 00:00:00 /usr/bin/python /opt/ros/melodi
Process 29969 is running 3 threads (the main thread, plus 2 more.)
Asked by Mike Scheutzow on 2023-06-01 06:37:42 UTC
Comments
Thank you for your answer. However, do you know if there is a way to relate ros2 nodes with the process Id. Because as you show me, that is the task and one single task can run two or more nodes.
Asked by Juan Carlos on 2023-06-01 10:47:32 UTC
Comments