haiscale.timer¶
用来统计 haiscale 中不同部分的时间开销 |
- class haiscale.timer.CudaTimer[source]¶
用来统计 haiscale 中不同部分的时间开销
Examples:
from haiscale.pipeline import PipeDream from haiscale.timer cuda_timer gpt = PipeDream(...) cuda_timer.start() for i in range(steps): loss, _ = gpt.forward_backward(x, criterion=criterion, labels=(x,)) cuda_timer.stop() cuda_timer.print_statistics()
打印出来的结果如下:
name ncals time (ms) -------------- ------- ----------- backward_chunk 3200 18298 forward_chunk 3200 7798 recv 100 8050 recv_meta 100 8032 send 100 43 send_meta 100 16 sendrecv 3100 15425 sendrecv_meta 3100 14474