Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autograd.functional.vjp #10356

Merged
merged 17 commits into from
Dec 21, 2023
Merged

autograd.functional.vjp #10356

merged 17 commits into from
Dec 21, 2023

Conversation

marigoold
Copy link
Contributor

@marigoold marigoold commented Nov 22, 2023

文档:
image

Copy link
Contributor

Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally.

@marigoold marigoold requested review from oneflow-ci-bot and removed request for oneflow-ci-bot November 24, 2023 02:58
@doombeaker doombeaker requested review from levi131 and removed request for doombeaker November 24, 2023 03:09
Copy link
Contributor

Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.8ms (= 4384.2ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 57.1ms (= 5714.8ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.30 (= 57.1ms / 43.8ms)

OneFlow resnet50 time: 26.4ms (= 2642.7ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 38.2ms (= 3815.7ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.44 (= 38.2ms / 26.4ms)

OneFlow resnet50 time: 18.5ms (= 3697.8ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 36.0ms (= 7195.3ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.95 (= 36.0ms / 18.5ms)

OneFlow resnet50 time: 17.6ms (= 3529.7ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 32.4ms (= 6480.2ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.84 (= 32.4ms / 17.6ms)

OneFlow resnet50 time: 17.1ms (= 3416.9ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 28.8ms (= 5769.0ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.69 (= 28.8ms / 17.1ms)

OneFlow swin dataloader time: 0.201s (= 40.143s / 200, num_workers=1)
PyTorch swin dataloader time: 0.127s (= 25.485s / 200, num_workers=1)
Relative speed: 0.635 (= 0.127s / 0.201s)

OneFlow swin dataloader time: 0.056s (= 11.219s / 200, num_workers=4)
PyTorch swin dataloader time: 0.033s (= 6.684s / 200, num_workers=4)
Relative speed: 0.596 (= 0.033s / 0.056s)

OneFlow swin dataloader time: 0.031s (= 6.238s / 200, num_workers=8)
PyTorch swin dataloader time: 0.016s (= 3.281s / 200, num_workers=8)
Relative speed: 0.526 (= 0.016s / 0.031s)

❌ OneFlow resnet50 time: 47.9ms (= 4787.0ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 64.0ms (= 6395.6ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.34 (= 64.0ms / 47.9ms)

OneFlow resnet50 time: 31.7ms (= 3174.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 45.0ms (= 4503.6ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.42 (= 45.0ms / 31.7ms)

OneFlow resnet50 time: 23.6ms (= 4717.8ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.9ms (= 8172.3ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.73 (= 40.9ms / 23.6ms)

OneFlow resnet50 time: 21.4ms (= 4274.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 36.8ms (= 7351.9ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.72 (= 36.8ms / 21.4ms)

OneFlow resnet50 time: 20.6ms (= 4111.8ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 34.8ms (= 6954.2ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.69 (= 34.8ms / 20.6ms)

Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.8ms (= 4382.5ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 63.0ms (= 6299.6ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.44 (= 63.0ms / 43.8ms)

OneFlow resnet50 time: 26.1ms (= 2609.2ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 37.3ms (= 3725.8ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.43 (= 37.3ms / 26.1ms)

OneFlow resnet50 time: 18.9ms (= 3773.6ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 35.8ms (= 7163.2ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.90 (= 35.8ms / 18.9ms)

OneFlow resnet50 time: 18.0ms (= 3609.4ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 31.3ms (= 6255.7ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.73 (= 31.3ms / 18.0ms)

OneFlow resnet50 time: 17.6ms (= 3514.7ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 29.1ms (= 5829.4ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.66 (= 29.1ms / 17.6ms)

OneFlow swin dataloader time: 0.201s (= 40.202s / 200, num_workers=1)
PyTorch swin dataloader time: 0.129s (= 25.777s / 200, num_workers=1)
Relative speed: 0.641 (= 0.129s / 0.201s)

OneFlow swin dataloader time: 0.054s (= 10.818s / 200, num_workers=4)
PyTorch swin dataloader time: 0.032s (= 6.453s / 200, num_workers=4)
Relative speed: 0.597 (= 0.032s / 0.054s)

OneFlow swin dataloader time: 0.032s (= 6.316s / 200, num_workers=8)
PyTorch swin dataloader time: 0.017s (= 3.380s / 200, num_workers=8)
Relative speed: 0.535 (= 0.017s / 0.032s)

❌ OneFlow resnet50 time: 47.9ms (= 4789.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 63.1ms (= 6309.5ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.32 (= 63.1ms / 47.9ms)

OneFlow resnet50 time: 32.2ms (= 3218.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 44.4ms (= 4443.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.38 (= 44.4ms / 32.2ms)

OneFlow resnet50 time: 23.9ms (= 4780.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 41.5ms (= 8298.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.74 (= 41.5ms / 23.9ms)

OneFlow resnet50 time: 20.8ms (= 4160.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 36.8ms (= 7358.4ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.77 (= 36.8ms / 20.8ms)

OneFlow resnet50 time: 20.5ms (= 4100.9ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 34.5ms (= 6899.0ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.68 (= 34.5ms / 20.5ms)

Copy link
Contributor

Speed stats:

Copy link
Contributor

github-actions bot commented Dec 4, 2023

Copy link
Contributor

github-actions bot commented Dec 4, 2023

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.2ms (= 4321.7ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 61.3ms (= 6133.0ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.42 (= 61.3ms / 43.2ms)

OneFlow resnet50 time: 26.5ms (= 2645.7ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 37.4ms (= 3738.8ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.41 (= 37.4ms / 26.5ms)

OneFlow resnet50 time: 17.6ms (= 3514.1ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 34.2ms (= 6832.9ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.94 (= 34.2ms / 17.6ms)

OneFlow resnet50 time: 16.1ms (= 3218.7ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 33.7ms (= 6746.5ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 2.10 (= 33.7ms / 16.1ms)

OneFlow resnet50 time: 17.1ms (= 3429.4ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 31.0ms (= 6194.2ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.81 (= 31.0ms / 17.1ms)

OneFlow swin dataloader time: 0.214s (= 42.820s / 200, num_workers=1)
PyTorch swin dataloader time: 0.129s (= 25.811s / 200, num_workers=1)
Relative speed: 0.603 (= 0.129s / 0.214s)

OneFlow swin dataloader time: 0.056s (= 11.138s / 200, num_workers=4)
PyTorch swin dataloader time: 0.033s (= 6.562s / 200, num_workers=4)
Relative speed: 0.589 (= 0.033s / 0.056s)

OneFlow swin dataloader time: 0.031s (= 6.246s / 200, num_workers=8)
PyTorch swin dataloader time: 0.017s (= 3.338s / 200, num_workers=8)
Relative speed: 0.534 (= 0.017s / 0.031s)

❌ OneFlow resnet50 time: 49.1ms (= 4907.5ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 65.4ms (= 6542.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.33 (= 65.4ms / 49.1ms)

OneFlow resnet50 time: 36.4ms (= 3644.9ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 49.5ms (= 4952.0ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.36 (= 49.5ms / 36.4ms)

OneFlow resnet50 time: 30.1ms (= 6027.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 41.4ms (= 8284.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.37 (= 41.4ms / 30.1ms)

OneFlow resnet50 time: 27.3ms (= 5456.7ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.5ms (= 8092.8ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.48 (= 40.5ms / 27.3ms)

OneFlow resnet50 time: 24.8ms (= 4965.8ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 35.8ms (= 7151.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.44 (= 35.8ms / 24.8ms)

Copy link
Contributor

Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.2ms (= 4316.0ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 61.1ms (= 6111.3ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.42 (= 61.1ms / 43.2ms)

OneFlow resnet50 time: 26.3ms (= 2634.9ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 37.3ms (= 3728.0ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.41 (= 37.3ms / 26.3ms)

OneFlow resnet50 time: 17.7ms (= 3546.7ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 35.9ms (= 7177.0ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 2.02 (= 35.9ms / 17.7ms)

OneFlow resnet50 time: 15.3ms (= 3057.5ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 31.7ms (= 6347.1ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 2.08 (= 31.7ms / 15.3ms)

OneFlow resnet50 time: 15.9ms (= 3175.4ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 29.9ms (= 5981.8ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.88 (= 29.9ms / 15.9ms)

OneFlow swin dataloader time: 0.210s (= 41.942s / 200, num_workers=1)
PyTorch swin dataloader time: 0.129s (= 25.721s / 200, num_workers=1)
Relative speed: 0.613 (= 0.129s / 0.210s)

OneFlow swin dataloader time: 0.060s (= 11.925s / 200, num_workers=4)
PyTorch swin dataloader time: 0.033s (= 6.606s / 200, num_workers=4)
Relative speed: 0.554 (= 0.033s / 0.060s)

OneFlow swin dataloader time: 0.030s (= 6.071s / 200, num_workers=8)
PyTorch swin dataloader time: 0.016s (= 3.283s / 200, num_workers=8)
Relative speed: 0.541 (= 0.016s / 0.030s)

❌ OneFlow resnet50 time: 49.2ms (= 4916.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 68.4ms (= 6844.9ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.39 (= 68.4ms / 49.2ms)

OneFlow resnet50 time: 37.4ms (= 3737.1ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 46.3ms (= 4630.9ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.24 (= 46.3ms / 37.4ms)

OneFlow resnet50 time: 29.0ms (= 5805.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 42.2ms (= 8437.7ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.45 (= 42.2ms / 29.0ms)

OneFlow resnet50 time: 25.0ms (= 5005.5ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.8ms (= 8158.2ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.63 (= 40.8ms / 25.0ms)

OneFlow resnet50 time: 25.9ms (= 5172.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 37.9ms (= 7573.4ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.46 (= 37.9ms / 25.9ms)

@marigoold marigoold removed the request for review from jackalcooper December 16, 2023 01:04
Copy link
Contributor

1 similar comment
Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.5ms (= 4348.6ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 58.5ms (= 5852.5ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.35 (= 58.5ms / 43.5ms)

OneFlow resnet50 time: 26.6ms (= 2655.8ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 38.6ms (= 3856.1ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.45 (= 38.6ms / 26.6ms)

OneFlow resnet50 time: 18.3ms (= 3667.1ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 35.9ms (= 7180.0ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.96 (= 35.9ms / 18.3ms)

OneFlow resnet50 time: 17.8ms (= 3561.7ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 31.6ms (= 6328.0ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.78 (= 31.6ms / 17.8ms)

OneFlow resnet50 time: 16.6ms (= 3328.7ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 28.6ms (= 5723.6ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.72 (= 28.6ms / 16.6ms)

OneFlow swin dataloader time: 0.207s (= 41.431s / 200, num_workers=1)
PyTorch swin dataloader time: 0.128s (= 25.645s / 200, num_workers=1)
Relative speed: 0.619 (= 0.128s / 0.207s)

OneFlow swin dataloader time: 0.059s (= 11.713s / 200, num_workers=4)
PyTorch swin dataloader time: 0.033s (= 6.604s / 200, num_workers=4)
Relative speed: 0.564 (= 0.033s / 0.059s)

OneFlow swin dataloader time: 0.030s (= 5.936s / 200, num_workers=8)
PyTorch swin dataloader time: 0.016s (= 3.287s / 200, num_workers=8)
Relative speed: 0.554 (= 0.016s / 0.030s)

❌ OneFlow resnet50 time: 49.2ms (= 4919.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 66.8ms (= 6683.1ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.36 (= 66.8ms / 49.2ms)

OneFlow resnet50 time: 36.6ms (= 3661.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 47.8ms (= 4780.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.31 (= 47.8ms / 36.6ms)

OneFlow resnet50 time: 28.0ms (= 5608.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.8ms (= 8154.9ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.45 (= 40.8ms / 28.0ms)

OneFlow resnet50 time: 26.2ms (= 5233.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.4ms (= 8076.5ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.54 (= 40.4ms / 26.2ms)

OneFlow resnet50 time: 24.7ms (= 4934.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 36.3ms (= 7267.1ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.47 (= 36.3ms / 24.7ms)

@marigoold marigoold requested review from oneflow-ci-bot and removed request for oneflow-ci-bot December 19, 2023 03:25
Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.8ms (= 4383.5ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 57.5ms (= 5749.0ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.31 (= 57.5ms / 43.8ms)

OneFlow resnet50 time: 26.1ms (= 2606.1ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 37.4ms (= 3737.2ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.43 (= 37.4ms / 26.1ms)

OneFlow resnet50 time: 18.8ms (= 3760.9ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 34.3ms (= 6851.9ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.82 (= 34.3ms / 18.8ms)

OneFlow resnet50 time: 17.3ms (= 3454.2ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 30.9ms (= 6184.8ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.79 (= 30.9ms / 17.3ms)

OneFlow resnet50 time: 16.7ms (= 3339.2ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 30.5ms (= 6105.2ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.83 (= 30.5ms / 16.7ms)

OneFlow swin dataloader time: 0.200s (= 40.026s / 200, num_workers=1)
PyTorch swin dataloader time: 0.128s (= 25.570s / 200, num_workers=1)
Relative speed: 0.639 (= 0.128s / 0.200s)

OneFlow swin dataloader time: 0.056s (= 11.185s / 200, num_workers=4)
PyTorch swin dataloader time: 0.032s (= 6.469s / 200, num_workers=4)
Relative speed: 0.578 (= 0.032s / 0.056s)

OneFlow swin dataloader time: 0.030s (= 6.053s / 200, num_workers=8)
PyTorch swin dataloader time: 0.017s (= 3.339s / 200, num_workers=8)
Relative speed: 0.552 (= 0.017s / 0.030s)

❌ OneFlow resnet50 time: 48.9ms (= 4893.9ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 65.4ms (= 6543.6ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.34 (= 65.4ms / 48.9ms)

OneFlow resnet50 time: 36.5ms (= 3645.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 45.5ms (= 4550.0ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.25 (= 45.5ms / 36.5ms)

OneFlow resnet50 time: 28.2ms (= 5647.7ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.3ms (= 8063.8ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.43 (= 40.3ms / 28.2ms)

OneFlow resnet50 time: 25.0ms (= 4990.2ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 41.0ms (= 8193.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.64 (= 41.0ms / 25.0ms)

OneFlow resnet50 time: 23.5ms (= 4699.1ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 37.5ms (= 7490.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.59 (= 37.5ms / 23.5ms)

Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.3ms (= 4328.8ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 57.5ms (= 5749.1ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.33 (= 57.5ms / 43.3ms)

OneFlow resnet50 time: 26.0ms (= 2598.4ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 38.2ms (= 3817.9ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.47 (= 38.2ms / 26.0ms)

OneFlow resnet50 time: 20.3ms (= 4052.2ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 34.8ms (= 6953.3ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.72 (= 34.8ms / 20.3ms)

OneFlow resnet50 time: 17.5ms (= 3498.1ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 31.1ms (= 6228.4ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.78 (= 31.1ms / 17.5ms)

OneFlow resnet50 time: 17.2ms (= 3444.2ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 28.5ms (= 5695.9ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.65 (= 28.5ms / 17.2ms)

OneFlow swin dataloader time: 0.199s (= 39.822s / 200, num_workers=1)
PyTorch swin dataloader time: 0.127s (= 25.457s / 200, num_workers=1)
Relative speed: 0.639 (= 0.127s / 0.199s)

OneFlow swin dataloader time: 0.054s (= 10.839s / 200, num_workers=4)
PyTorch swin dataloader time: 0.032s (= 6.486s / 200, num_workers=4)
Relative speed: 0.598 (= 0.032s / 0.054s)

OneFlow swin dataloader time: 0.031s (= 6.159s / 200, num_workers=8)
PyTorch swin dataloader time: 0.016s (= 3.299s / 200, num_workers=8)
Relative speed: 0.536 (= 0.016s / 0.031s)

❌ OneFlow resnet50 time: 49.0ms (= 4904.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 65.8ms (= 6575.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.34 (= 65.8ms / 49.0ms)

OneFlow resnet50 time: 36.3ms (= 3634.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 45.9ms (= 4592.5ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.26 (= 45.9ms / 36.3ms)

OneFlow resnet50 time: 28.1ms (= 5620.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 40.5ms (= 8098.6ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.44 (= 40.5ms / 28.1ms)

OneFlow resnet50 time: 25.1ms (= 5024.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 38.9ms (= 7779.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.55 (= 38.9ms / 25.1ms)

OneFlow resnet50 time: 23.6ms (= 4727.2ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 35.9ms (= 7180.6ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.52 (= 35.9ms / 23.6ms)

Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.6ms (= 4364.8ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 57.4ms (= 5744.6ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.32 (= 57.4ms / 43.6ms)

OneFlow resnet50 time: 26.1ms (= 2608.1ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 37.3ms (= 3734.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.43 (= 37.3ms / 26.1ms)

OneFlow resnet50 time: 18.1ms (= 3613.2ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 35.4ms (= 7088.5ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.96 (= 35.4ms / 18.1ms)

OneFlow resnet50 time: 18.1ms (= 3614.8ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 31.3ms (= 6259.5ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.73 (= 31.3ms / 18.1ms)

OneFlow resnet50 time: 17.4ms (= 3482.0ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 29.2ms (= 5832.8ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.68 (= 29.2ms / 17.4ms)

OneFlow swin dataloader time: 0.202s (= 40.468s / 200, num_workers=1)
PyTorch swin dataloader time: 0.128s (= 25.504s / 200, num_workers=1)
Relative speed: 0.630 (= 0.128s / 0.202s)

OneFlow swin dataloader time: 0.053s (= 10.594s / 200, num_workers=4)
PyTorch swin dataloader time: 0.033s (= 6.508s / 200, num_workers=4)
Relative speed: 0.614 (= 0.033s / 0.053s)

OneFlow swin dataloader time: 0.031s (= 6.171s / 200, num_workers=8)
PyTorch swin dataloader time: 0.017s (= 3.313s / 200, num_workers=8)
Relative speed: 0.537 (= 0.017s / 0.031s)

❌ OneFlow resnet50 time: 49.1ms (= 4908.9ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 65.4ms (= 6544.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.33 (= 65.4ms / 49.1ms)

OneFlow resnet50 time: 36.3ms (= 3626.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 46.1ms (= 4611.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.27 (= 46.1ms / 36.3ms)

OneFlow resnet50 time: 28.1ms (= 5629.4ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 41.0ms (= 8207.1ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.46 (= 41.0ms / 28.1ms)

OneFlow resnet50 time: 25.3ms (= 5057.4ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 38.2ms (= 7640.4ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.51 (= 38.2ms / 25.3ms)

OneFlow resnet50 time: 23.7ms (= 4737.9ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 35.8ms (= 7164.4ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.51 (= 35.8ms / 23.7ms)

Copy link
Contributor

@levi131 levi131 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@marigoold marigoold enabled auto-merge (squash) December 21, 2023 07:59
Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce RTX 3080 Ti 

❌ OneFlow resnet50 time: 43.6ms (= 4355.2ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 57.4ms (= 5741.8ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.32 (= 57.4ms / 43.6ms)

OneFlow resnet50 time: 26.2ms (= 2622.2ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 38.5ms (= 3848.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.47 (= 38.5ms / 26.2ms)

OneFlow resnet50 time: 18.3ms (= 3660.6ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 35.6ms (= 7121.5ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.95 (= 35.6ms / 18.3ms)

OneFlow resnet50 time: 17.5ms (= 3490.0ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 29.9ms (= 5974.5ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.71 (= 29.9ms / 17.5ms)

OneFlow resnet50 time: 17.0ms (= 3393.5ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 29.9ms (= 5972.8ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.76 (= 29.9ms / 17.0ms)

OneFlow swin dataloader time: 0.200s (= 40.091s / 200, num_workers=1)
PyTorch swin dataloader time: 0.128s (= 25.517s / 200, num_workers=1)
Relative speed: 0.636 (= 0.128s / 0.200s)

OneFlow swin dataloader time: 0.054s (= 10.860s / 200, num_workers=4)
PyTorch swin dataloader time: 0.033s (= 6.622s / 200, num_workers=4)
Relative speed: 0.610 (= 0.033s / 0.054s)

OneFlow swin dataloader time: 0.030s (= 6.025s / 200, num_workers=8)
PyTorch swin dataloader time: 0.017s (= 3.318s / 200, num_workers=8)
Relative speed: 0.551 (= 0.017s / 0.030s)

❌ OneFlow resnet50 time: 48.8ms (= 4875.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 63.9ms (= 6387.1ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.31 (= 63.9ms / 48.8ms)

OneFlow resnet50 time: 36.4ms (= 3640.6ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 49.3ms (= 4930.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.35 (= 49.3ms / 36.4ms)

OneFlow resnet50 time: 28.2ms (= 5635.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 39.1ms (= 7829.4ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.39 (= 39.1ms / 28.2ms)

OneFlow resnet50 time: 24.9ms (= 4982.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 38.3ms (= 7654.9ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.54 (= 38.3ms / 24.9ms)

OneFlow resnet50 time: 24.0ms (= 4790.7ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 37.1ms (= 7427.8ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.55 (= 37.1ms / 24.0ms)

@marigoold marigoold merged commit 559f5ec into master Dec 21, 2023
20 checks passed
@marigoold marigoold deleted the dev_add_autograd_functional_vjp branch December 21, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants