https://github.com/rugleb/cuda
A simple example of a program that uses parallel GPU computing on an NVIDIA graphics card using CUDA technology
https://github.com/rugleb/cuda
cuda gpu nvidia
Last synced: about 1 year ago
JSON representation
A simple example of a program that uses parallel GPU computing on an NVIDIA graphics card using CUDA technology
- Host: GitHub
- URL: https://github.com/rugleb/cuda
- Owner: rugleb
- License: mit
- Created: 2018-11-25T19:38:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-27T19:30:09.000Z (about 7 years ago)
- Last Synced: 2025-02-15T16:49:23.101Z (over 1 year ago)
- Topics: cuda, gpu, nvidia
- Language: Cuda
- Homepage: https://github.com/rugleb/cuda
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/rugleb/cuda)
[]()
[](https://opensource.org/licenses/MIT)
A simple program that uses parallel GPU computing on an NVIDIA video card using [CUDA](https://developer.nvidia.com/cuda-zone) technology.
The implemented program simulates the process of heat transfer along the entire length of the rod of a given size using an explicit [finite-difference scheme](https://en.wikipedia.org/wiki/Finite_difference_method).
The longer the rod (array size) - the more calculations need to be done to achieve the result.
## Requirements
* Linux machine
* [CMake 3.1 or later](https://cmake.org/download)
* [CUDA Toolkit 9](https://developer.nvidia.com/cuda-90-download-archive)
## Instructions
Compilation:
```bash
nvcc main.cu
```
Running:
```bash
[optirun] ./a.out [ARRAY SIZE] [CUDA THREADS NUMBER]
```
## Performance
CPU: Core i7-6500U CPU @ 2.50GHz ×4
GPU: GeForce 940M
```
gleb@home: optirun ./a.out 10
>>> CPU time: 0.003 ms
>>> GPU time: 0.301 ms
>>> Rate: 0.010
gleb@home: optirun ./a.out 1000
>>> CPU time: 0.282 ms
>>> GPU time: 0.284 ms
>>> Rate: 0.992
gleb@home: optirun ./a.out 10000
>>> CPU time: 3.091 ms
>>> GPU time: 0.427 ms
>>> Rate: 7.233
gleb@home: optirun ./a.out 100000
>>> CPU time: 29.232 ms
>>> GPU time: 1.904 ms
>>> Rate: 15.353
```
The final graph of the dependence of the performance gain on the size of the array:

## License
This repo is published under the MIT license, see [LICENSE](https://github.com/rugleb/cuda/blob/master/LICENSE).