Cuda problems
The main goal of this repo is to compare the acceleration ratio
between CUDA GPU and CPU on some math problems.
To compile the code. Simply run make
in parent dir.
This will generate binaries for every problem.
Matrix multiplication
The problem is about how we can accelerate the multiplication of two matrices using a high-performance GPU. And what acceleration ratio we can achieve by doing that.
The source code of solution shown in this file.
Input parameters:
- N - Matrix size
Calucatuion results
NxN | CPU time | GPU time | Acceleration ratio |
---|---|---|---|
128x128 | 0.495776 | 0.163552 | 3.03131 |
256x256 | 5.2296 | 0.915456 | 5.71256 |
512x512 | 38.8427 | 7.82819 | 4.9619 |
1024x1024 | 443.885 | 63.6874 | 6.96974 |
2048x2048 | 4311.1 | 512.336 | 8.41459 |
The PI number calculus
The problem is about how we can accelerate the approximation calculations of the Pi number on GPU using the Monte-Carlo method.
The source code of solution shown in this file.
Input parameters:
- N - Number of points
Calucatuion results
N | CPU time | GPU time | Acceleration ratio |
---|---|---|---|
300 | 0.045376 | 0.078464 | 0.578303 |
1000 | 0.044672 | 0.097408 | 0.458607 |
100000 | 0.807616 | 0.180928 | 4.46374 |
1000000 | 4.33581 | 1.43181 | 3.0282 |
The bilateral image filtering
The problem is about how we can accelerate the image filtering on GPU with bilateral filter.
Input parameters:
- img_path - path to source image_file
- sigma_r - smoothing parameter
- sigma_d - smoothing parameter
Calucatuion results
Sigma r | Sigma d | CPU time | GPU time | Acceleration ratio |
---|---|---|---|---|
40 | 90 | 8.650950 | 0.022675 | 381.51066 |
75 | 75 | 9.288938 | 0.022062 | 421.02762 |
0.4 | 0.4 | 9.993022 | 0.022515 | 443.82321 |