apaszke:


You never set the PyTorch model to eval() mode, so you pay additional cost for the Dropout layers (they’re no-ops at eval time, but not at training time).



I missed that, sorry for that, but it wouldn’t change the result so much.



 apaszke:


We’re not using cuDNN for MaxPooling.



I didn’t know that, thanks for letting me know.
I tested with disabling cudnn for max_pooling in Chainer, but it wouldn’t change the result much.
Current result is below for both dynamic and static input (with cudnn=False in chainer max_pooling):
Dynamic
With input size change at each forwarding
% ./speedtest.py --dynamic-input
==> Benchmark: gpu=0, times=1000, dynamic_input=True
==> Testing FCN32s with Chainer
Elapsed time: 48.83 [s / 1000 evals]
Hz: 20.48 [hz]
==> Testing FCN32s with PyTorch
Elapsed time: 57.00 [s / 1000 evals]
Hz: 17.55 [hz]

Static
With pytorch cudnn.benchmark=True:
% ./speedtest.py --gpu 1
==> Benchmark: gpu=1, times=1000, dynamic_input=False
==> Testing FCN32s with Chainer
Elapsed time: 48.98 [s / 1000 evals]
Hz: 20.42 [hz]
==> Testing FCN32s with PyTorch
Elapsed time: 45.15 [s / 1000 evals]
Hz: 22.15 [hz]