okankop / Efficient-3DCNNs

PyTorch Implementation of "Resource Efficient 3D Convolutional Neural Networks", codes and pretrained models.
MIT License
777 stars 151 forks source link

Fix inaccurate timing with time.time() by using CUDA events for bette… #50

Open Phoenix8215 opened 2 days ago

Phoenix8215 commented 2 days ago

Hi @okankop 🥰 In the current code, the timing of the model's forward pass is measured using time.time(). However, this method is not accurate for measuring GPU operations, as it does not account for GPU-specific delays or synchronization.

I have replaced the time.time() approach with the more accurate torch.cuda.Event timing method. CUDA events are specifically designed for high-precision timing on GPUs and can provide more reliable measurements of GPU operations.

I appreciate your time and effort in reviewing this PR. Thank you!