nasa / trick

Trick Simulation Environment. Trick provides a common set of simulation capabilities and utilities to build simulations automatically.
Other
34 stars 19 forks source link

QUESTION: Is there any (developer) docs about how trick handles Sim/Real time ratio or speeds up real time? #1641

Closed yusufcananar closed 7 months ago

yusufcananar commented 8 months ago

I am making simulations that requires real time calculations but also in faster ways. I got few questions:

  1. In the Sim Control Panel GUI there is a throttle which is limited by 10x. I wonder if trick is capable for 10x real time?
  2. In cannonball simulation ratio kept the 10 steady, I believe it would not be the case for bigger(more sim objects and complex models) projects?
  3. I could not find anything in the docs. Maybe you could point out some docs I am missing.
  4. Lastly, where is the code about speeding simulations? I wonder the speeding mechanism? How trick handles speedy real time 😄

(I am searching for a master thesis topic, looking for places to utilize AI.)

hchen99 commented 8 months ago

The max possible value is actually 1000. You can enter the max up to 1000 for Max field of the Throttle.

jmpenn commented 8 months ago

A simulation can only run as fast as the simulation code and the computer hardware allow.

In order to run a simulation in real-time, that simulation must be capable of running fast enough in non-real-time such that simulation-time elapses faster than wall-clock time.

Making a sim run in real-time is a matter of slowing a simulation down so that one second of simulation-time will elapse for every second of wall-clock time.

Suppose for example that a particular simulation, when run in non-real-time runs 10 times faster than real-time. That is, 10 simulation-time seconds elapse for every wall-clock second.

We then constrain that sim to real-time, that is, one simulation-time second will elapse for every wall-clock second. We could in this case throttle the sim up to 10 times faster.

But suppose that another sim, when run in non-real-time runs only 2 times faster than real-time. Then it is not possible for the sim to be throttled to 10 times faster. It is only capable of being throttled to 2 times faster.

yusufcananar commented 8 months ago

Thank you very much, now it's clear.

One more question about hardware usage; does trick uses only cpu or are there any utilization of gpu to accelerate simulation speed? If not is it feasible to implement gpu utilizations?

jmpenn commented 8 months ago

Trick does not have specific support for GPUs, nor is it needed.

GPU jobs can be setup and run within user-defined Trick jobs using a parallel computing model like CUDA , or OpenCL. We do in fact have users who use CUDA/GPUs for performing large matrix operations.

It you’re interested in using a GPU in your sim, and have an NVIDIA GPU then I would suggest going through a CUDA tutorial, at which point It should become clear how, and when it's appropriate to use a GPU in a simulation. It's also fun.

sharmeye commented 7 months ago

Unless any further info is needed, I'm going to close this issue.