kaiyun717 / danaus_ros_ws

0 stars 0 forks source link

Computation Time #1

Open kaiyun717 opened 1 month ago

kaiyun717 commented 1 month ago

CPU Computation Time

One sample

Time taken for torch: 0.7624025344848633
Time taken for numpy: 0.003352642059326172
Phi computation time: 0.002916097640991211
x_next computation time: 0.0007834434509277344
Next phi computation time: 0.002794027328491211
STATUS: Inside
Time taken for compute control for inside: 0.006603717803955078
Phi computation time: 0.002815723419189453
x_next computation time: 0.0007405281066894531
Next phi computation time: 0.0027844905853271484
STATUS: Outside
f_x computation time: 0.00013947486877441406
g_x computation time: 8.440017700195312e-05
Phi grad computation time: 0.00640106201171875
QP solve time: 0.0020837783813476562
Time taken for compute control for outside: 0.015387296676635742

1000 samples

Time taken for torch: 0.007326841354370117
phi_torch.shape=torch.Size([1000, 3])
Time taken for numpy: 0.005339622497558594
phi_numpy.shape=(1000, 3)

100,000 samples

Time taken for torch: 0.037696123123168945
phi_torch.shape=torch.Size([100000, 3])
Time taken for numpy: 0.05141091346740723
phi_numpy.shape=(100000, 3)
kaiyun717 commented 1 month ago

GPU Computation Time

One sample

Time taken for torch: 0.6370642185211182
Time taken for numpy: 0.006148815155029297
Phi computation time: 0.005672454833984375
x_next computation time: 0.0008361339569091797
Next phi computation time: 0.005527019500732422
STATUS: Inside
Time taken for compute control for inside: 0.0122528076171875
Phi computation time: 0.00552058219909668
x_next computation time: 0.0007758140563964844
Next phi computation time: 0.00564122200012207
STATUS: Outside
f_x computation time: 0.00014400482177734375
g_x computation time: 8.368492126464844e-05
Phi grad computation time: 0.013029098510742188
QP solve time: 0.0020928382873535156
Time taken for compute control for outside: 0.027651309967041016

1000 samples

Time taken for torch: 0.6307542324066162
phi_torch.shape=torch.Size([1000, 3])
Time taken for numpy: 0.006203174591064453
phi_numpy.shape=(1000, 3)

100,000 samples



```Time taken for torch: 0.6502704620361328
phi_torch.shape=torch.Size([100000, 3])
Time taken for numpy: 0.03185391426086426
phi_numpy.shape=(100000, 3)
kaiyun717 commented 1 month ago

image

kaiyun717 commented 1 month ago

The data above are incorrect!

You need to run the inference once before testing the actual speed.

New results

image

Log-scale:

image