-
Notifications
You must be signed in to change notification settings - Fork 7
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
Parallelize CAN writes #230
Comments
Parallelization could be easily achieved with yarp-devices/tests/testCanBusSharerLib.cpp Line 188 in 05c202c
I'd fancy an abstract |
C++17 introduces execution policies which allow to easily switch between sequential and parallel loops via In C++11, I have to resort to playing with |
The Not sure about enabling thread limits, i.e. fix the max number of parallel tasks this class may start so that additional tasks are enqueued for later. SO Q/A regarding static/shared library performance:
Regarding thread limits: SO, reddit. Two nice blog entries about C++11 move semantics: ref1, ref2. |
Quite interesting links from 8dcd9ec regarding template specialization/instantiation: |
Ready at 3c6efbb.
Using sequential policy by default (single-threaded), an arbitrary large number of threads can be enabled after instantiation via YARP property. |
This is a naive solution, it splits requested callbacks into two groups: those executed asynchronously in threads and the remaining sequential ones. Ideally, freed threads should allocate new tasks. This is achieved with a nice thread pool library I borrowed from https://github.com/vit-vit/CTPL: 403ade0. Results are even superior in equality of conditions (same number of tasks and threads): FutureTask.zip. |
I realized this parallelization is actually meaningless since high frequency commands are further transmitted via TPDO protocol (#232). It only made sense for SDO multi-joint requests due to the confirmed nature of these transfers (every SDO client request/indication awaits a response/confirmation from the SDO server), hence sequentially applying this request-and-wait scheme for several joint commands would result in a linear increase of the overall wait. Cons:
Therefore, I'm definitely disabling this feature for YARP motor commands. However, I found this actually helpful for synchronization of multiple CAN buses (#226): 4745561. |
Note YARP's fakeMotionControl device showcases a similar technique with a sequential implementation, split into specific interfaces: |
Split from #209 (comment):
The text was updated successfully, but these errors were encountered: