Comments (17)
Thanks for your advice and help, I will try to migrate MPPI to Eigen.
from navigation2.
Can you back up that claim or provide any other detail?
from navigation2.
Because my hardware does not support xsimd acceleration, and xtensor does not support gcc-7, while other programs rely on gcc-7, so I want to know whether the performance will be weakened by using Eigen instead of xtensor for the tensor of 2000x50.
from navigation2.
That's not sufficient to prevent us from looking into it as a potential course of action.
from navigation2.
For a 2000*60 array, run following code, it outputs:
dot_product_xt: 240000
xtensor dot product took 0.00535805 seconds.
dot_product_eigen: 240000
Eigen dot product took 0.000759429 seconds.
Code:
#include
#include
#include <xtensor/xarray.hpp>
#include "/usr/include/eigen3/Eigen/Dense"
constexpr int rows = 2000;
constexpr int cols = 60;
int main()
{
xt::xarray<double> A_xt({rows, cols}, 1.0);
xt::xarray<double> B_xt({rows, cols}, 2.0);
Eigen::MatrixXd A_eigen(rows, cols);
Eigen::MatrixXd B_eigen(rows, cols);
A_eigen.setOnes();
B_eigen= B_eigen.setOnes() * 2.0;
double dot_product_xt = 0.0;
double dot_product_eigen = 0.0;
auto start_xtensor = std::chrono::steady_clock::now();
dot_product_xt = xt::sum(A_xt * B_xt)();
std::cout << "dot_product_xt: " << dot_product_xt << std::endl;
auto end_xtensor = std::chrono::steady_clock::now();
std::chrono::duration<double> elapsed_xtensor = end_xtensor - start_xtensor;
std::cout << "xtensor dot product took " << elapsed_xtensor.count() << " seconds." << std::endl;
auto start_eigen = std::chrono::steady_clock::now();
dot_product_eigen = (A_eigen.array() * B_eigen.array()).sum();
std::cout << "dot_product_eigen: " << dot_product_eigen << std::endl;
auto end_eigen = std::chrono::steady_clock::now();
std::chrono::duration<double> elapsed_eigen = end_eigen - start_eigen;
std::cout << "Eigen dot product took " << elapsed_eigen.count() << " seconds." << std::endl;
return 0;
}
from navigation2.
That would seem to evidence that Eigen is faster than xtensor, not slower by a factor of over 7x! That would point to the fact that we should consider using Eigen instead of xtensor - which is why its mentioned in the MPPI ticket as something that we should seriously look to evaluate instead of using xtensor for an acceleration boost.
I don't understand your ticket's claim then that xtensor is slower and shouldn't be analyzed?
from navigation2.
The xtensor should be analyzed. I just want to try to replace the xtensor in MPPI with eigen, and I do not know whether the original control frequency can be maintained.
from navigation2.
That is not what your initial ticket title implies, but OK - maybe just a misunderstanding.
Yes, I definitely support some help in trying to migrate MPPI to Eigen to see if its an improvement.
and I do not know whether the original control frequency can be maintained.
No one knows to be able to tell you for certain. However, metrics I see make me think that its a worthwhile direction to explore and that it might actually make it run faster. Are you interested in spending some time working on this yourself?
from navigation2.
OK. I renamed the ticket to be in line with our discussion.
I'd recommend outright ignoring the critics to get started and focus on the core Optimizer/Noise Generator/utils. I think that should make it clear from benchmarking whether its faster or not than xtensor without going through the more laborious task of migrating the critics (which some are easy, some are not). Also, don't fret if immediately the performance isn't as good; there may be steps we can take to improve things. There were several cycles of optimizations and testing on xtensor to get the performance we have now and I would expect the same from Eigen. However, the benchmark on Eigen views makes me think we can save some compute time.
Do you have a general sense of the priority of this task or when you expect to make some progress? I'd be happy to answer any questions or see how I can help if you work on this on a Nav2 fork that is public.
from navigation2.
Related Issues (20)
- What is the purpose of using the 'next_to_last_length_ratio' in constarint smoother HOT 1
- cloned_multi_tb3_simulation, slam:=true does not create maps HOT 2
- [demo] More 'robotic' behavior demonstration
- Use of Nav2 Stack and Commander API without AMCL , with just odometry data HOT 1
- [mppi] Improve testability to explore parameters for Ackermann steered Polaris HOT 2
- [mppi] Add SpeedCritic to favour trajectories that create velocities closer to target speed. HOT 3
- commander API hangs with amcl/get_state service not available HOT 2
- [humble-MPPI] Bug in path align critic HOT 1
- [mppi] Investigate speed up potential of preallocated noise. HOT 1
- maxRGB - alpha broke color logic HOT 2
- BehaviorTreeEngine HOT 1
- [RPP] Make new deceleration on cancelation an option HOT 1
- Is there a method within the ros2 controller plugin to determine its termination status? HOT 6
- [navfn_planner]Optimizations for the navfn planner in large map scenarios
- Expanding the ~/ to the full home dir of user HOT 2
- Costmap resolution is not match HOT 3
- [SMAC planner] Start and goal are moved to closest cell HOT 3
- BT navigator not recognizing a basic ActionNode HOT 3
- HUMBLE: Undefined symbol when launching bt_navigator HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navigation2.