Are there any tricks to speed up the simulation with API?
Hi,
I have introduced a contact model in EDEM, but the calculation speed became very slow as number of contacts increase(CPU computation), but I can't figure out which part of my code casues the problem, Are there any tips for optimizing the computing speed?
Thanks
Raheem
Best Answer
-
Hi Raheem,
The contact detection takes most time on an EDEM Simulation and this shouldn't be influenced by the API, as the in-built and API models work the same way. The contact detection is influenced by the particle contact radii however, so if your API model uses particles with a contact radius larger than physical radius then this would slow the simulation down.For the API specifically you should make sure you compiled it in 'Release' mode not debug as debug mode for API's is slow.
Any For loops can be slow and any searching by Name (particle name, geometry name, custom property name) can be slow. Doing this once and assigning an integer to each name search can help.
If you are writing data out via the API model then this is also slow as anything that is accessing the disk drive will slow down the model as it waits for this to happen.
You could also consider enabling GPU support for your model Intro to GPU API
Regards
Stephen
0
Answers
-
Hi Raheem,
The contact detection takes most time on an EDEM Simulation and this shouldn't be influenced by the API, as the in-built and API models work the same way. The contact detection is influenced by the particle contact radii however, so if your API model uses particles with a contact radius larger than physical radius then this would slow the simulation down.For the API specifically you should make sure you compiled it in 'Release' mode not debug as debug mode for API's is slow.
Any For loops can be slow and any searching by Name (particle name, geometry name, custom property name) can be slow. Doing this once and assigning an integer to each name search can help.
If you are writing data out via the API model then this is also slow as anything that is accessing the disk drive will slow down the model as it waits for this to happen.
You could also consider enabling GPU support for your model Intro to GPU API
Regards
Stephen
0 -
Stephen Cole_21117 said:
Hi Raheem,
The contact detection takes most time on an EDEM Simulation and this shouldn't be influenced by the API, as the in-built and API models work the same way. The contact detection is influenced by the particle contact radii however, so if your API model uses particles with a contact radius larger than physical radius then this would slow the simulation down.For the API specifically you should make sure you compiled it in 'Release' mode not debug as debug mode for API's is slow.
Any For loops can be slow and any searching by Name (particle name, geometry name, custom property name) can be slow. Doing this once and assigning an integer to each name search can help.
If you are writing data out via the API model then this is also slow as anything that is accessing the disk drive will slow down the model as it waits for this to happen.
You could also consider enabling GPU support for your model Intro to GPU API
Regards
Stephen
Hi Stephen,
Thanks, as you said, the new model I introduced with contact radius, but no loops or writing data out in the code, compared with bondingV2, I only added some new contact custom properties which searched by integer as example of bondingV2 and some new equations based on the position and orientation of particles, but I used the "debug" version, I will try with release version later. Anyway, thank you very much and it gave me a lot of inspiration.
Best regards!
Raheem
0 -
Stephen Cole_21117 said:
Hi Raheem,
The contact detection takes most time on an EDEM Simulation and this shouldn't be influenced by the API, as the in-built and API models work the same way. The contact detection is influenced by the particle contact radii however, so if your API model uses particles with a contact radius larger than physical radius then this would slow the simulation down.For the API specifically you should make sure you compiled it in 'Release' mode not debug as debug mode for API's is slow.
Any For loops can be slow and any searching by Name (particle name, geometry name, custom property name) can be slow. Doing this once and assigning an integer to each name search can help.
If you are writing data out via the API model then this is also slow as anything that is accessing the disk drive will slow down the model as it waits for this to happen.
You could also consider enabling GPU support for your model Intro to GPU API
Regards
Stephen
Hi Stephen,
It works well when I generated "dll" with release mode, the speed is completely different.
Thank you very much.
Regards!
Raheem
1