-
Notifications
You must be signed in to change notification settings - Fork 1
/
lab1.cu
69 lines (56 loc) · 1.44 KB
/
lab1.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @file lab1.cpp
* @author Abhishek Bhaumick ([email protected])
* @brief
* @version 0.1
* @date 2021-01-11
*
* @copyright Copyright (c) 2021
*
*/
#include <iostream>
#include "lab1.cuh"
#include "cpuLib.h"
#include "cudaLib.cuh"
int main(int argc, char** argv) {
std::string str;
int choice;
std::cout << "ECE 695 - Lab 1 \n";
std::cout << "Select application: \n";
std::cout << " 1 - CPU SAXPY \n";
std::cout << " 2 - GPU SAXPY \n";
std::cout << " 3 - CPU Monte-Carlo Pi \n";
std::cout << " 4 - GPU Monte-Carlo Pi \n";
std::cin >> choice;
std::cout << "\n";
std::cout << "Choice selected - " << choice << "\n\n";
switch (choice) {
// CPU only SAXPY
case 1:
std::cout << "Running SAXPY CPU! \n\n";
runCpuSaxpy(VECTOR_SIZE);
std::cout << "\n\n ... Done!\n";
break;
// CUDA + GPU SAXPY
case 2:
std::cout << "Running SAXPY GPU! \n\n";
runGpuSaxpy(VECTOR_SIZE);
std::cout << "\n\n ... Done!\n";
break;
case 3:
std::cout << "Running Monte-Carlo Pi Estimation on CPU! \n\n";
runCpuMCPi(MC_ITER_COUNT, MC_SAMPLE_SIZE);
std::cout << "\n\n ... Done!\n";
break;
case 4:
std::cout << "Running Monte-Carlo Pi Estimation on GPU! \n\n";
runGpuMCPi(GENERATE_BLOCKS, SAMPLE_SIZE, REDUCE_BLOCKS, REDUCE_SIZE);
std::cout << "\n\n ... Done!\n";
break;
default:
std::cout << "Hmm ... Devious, you are!\n";
std::cout << " Choose correctly, you must.\n";
break;
}
return 0;
}