Comments (3)
Commands:
!git clone https://github.com/pytorch/extension-cpp
%cd extension-cpp/cpp/
!python setup.py install
%cd ../cuda
!python setup.py install
%cd ..
!python benchmark.py py -r 100000
!python benchmark.py cpp -r 100000
!python benchmark.py cuda -r 100000
!python benchmark.py py --cuda -r 100000
!python benchmark.py cpp --cuda -r 100000
!python benchmark.py cuda --cuda -r 100000
from extension-cpp.
The K80 enabled servers in google colab are not very fast and their architecture (Kepler) is not as easily usable more recent ones like Turing or Pascal
You can at least see that the pure cuda implementation is the fastest.
If you want to see real benefits from using torch cpp or pure python with cuda, you can try to add the workload, with e.g. a greater batch size.
I tried with a batch size of 64 instead of 16 and here are my results :
!python benchmark.py py --cuda -b64 -r 1000
!python benchmark.py cpp --cuda -b64 -r 1000
!python benchmark.py cuda --cuda -b64 -r 1000
->
Forward: 327.349/372.224 us | Backward 553.608/714.348 us
Forward: 257.730/307.776 us | Backward 931.501/1132.617 us
Forward: 201.941/245.529 us | Backward 471.115/645.371 us
and
!python benchmark.py py -b64 -r 1000
!python benchmark.py cpp -b64 -r 1000
!python benchmark.py cuda -b64 -r 1000
->
Forward: 491.858/543.436 us | Backward 710.726/835.553 us
Forward: 420.809/493.803 us | Backward 897.169/1071.797 us
Forward: 202.179/240.434 us | Backward 483.751/624.685 us
from extension-cpp.
Thank you very much that really helps.
from extension-cpp.
Related Issues (20)
- www.facebook.com/rozi.khatun.961
- This repo can not compile using Pytorch 1.6.0 HOT 1
- This repo can not compile using Pytorch 1.6.0 HOT 1
- A question about backward propagation speed in cpp extension in tutorial
- Error when building cpp extension HOT 1
- AttributeError: module 'depthwise' has no attribute 'forward'
- cuda does not install HOT 17
- How does the layer of C++ extensions translate to TorchScript or onnx? HOT 1
- Cannot Unpack, Too Many Items
- How to debug in cuda-pytorch env?
- Writing a custom C++ extension with variants for both CPU and GPU? HOT 2
- Custom CUDA operator only work well on cuda:0 HOT 3
- How can I access data in cuda kernel like in pytorch?
- error LNK2001 undefined reference to `__cudaRegisterLinkedBinary
- Relation between at::Half and __half
- Deprecation warning
- Scikit-build-core / scikit-build support for binding
- `TORCH_LIBRARY` and `m.def` Not Working as Documented
- [feature request] Instruction on how to setup compile-env for Windows
- JIT-compiling the extension results in non-functional Python module.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-cpp.