projectchrono / chrono

High-performance C++ library for multiphysics and multibody dynamics simulations
http://projectchrono.org
BSD 3-Clause "New" or "Revised" License
2.22k stars 465 forks source link

FEA demos much slower on v9 than v6 #523

Closed JasGarnier closed 4 days ago

JasGarnier commented 2 weeks ago

I downloaded the v6 pre-compiled package then I downloaded v9 source and compiled with visual C 2022. All fea demos are much slower in v9. I see that with the v6 visualisation demo the cpu is at 100% all the time and the gpu is at 12%. With v9 cpu usage fluctuates between 50 and 70% which gpu usage is 1 to 2%. I read a previous query where it was recommened to add the sys.SetNumThreads() command which I did but it made zero difference. What else might be the trouble?

rserban commented 1 week ago

Things have changed significantly from version 6 to now. This also includes the various demos which now may use different settings and parameters, as well as different defaults for various Chrono settings. It is quite likely that you end up comparing apples to oranges. Did you check that you are using the same compiler and compiler options, problem definitions, number of threads, solver and integrator, solver and integrator settings, etc.?

JasGarnier commented 1 week ago

Thanks for the reply. I am in the process of checking such things. I have now used the v6 version of the visualisation demo code (from V6 documentation) with the v6 binaries/libs/includes and it works ok. I notice blaze was used for V6 but not now. Also corotational elements are now used. However, I had hoped someone else noticed this major slowdown when compiling under VC (even with the intel compiler btw). I'll investigate v8 since the fea source code seemed to change between v8 and v9.

rserban commented 1 week ago

Of course we monitor performance implications when we change code or add features.

You never mentioned which FEA demos you are looking at.

There are several FEA formulations available in Chrono. Corotational was also available in 6.0. Blaze was used in 6.0 and continues to be used only for the Chrono::Multicore module.

For FEA demos, Chrono does not use the GPU. Any GPU usage is due only to the run-time visualization. That usage may have changed because of changes in the frequency with which demos render a simulation.

Until you can confirm that you are comparing performance of the exact same physics problem, solved with the same (or equivalent) solver settings, we cannot draw any conclusions.

You can get the source code for the 6.0.0 release by checking out the release/6.0 branch.

JasGarnier commented 1 week ago

Thanks that helped. I hadn't noticed the use_eigen_openmp switch in cmake before. It works fine now.

rserban commented 1 week ago

Great!

By the way, ENABLE_OPENMP and USE_EIGEN_OPENMP should be enabled by default if your compiler supports OpenMP. Did you manually disable them?