forked from makortel/pixel-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_cupla.cc
65 lines (55 loc) · 2.87 KB
/
main_cupla.cc
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
#include <iostream>
#include <memory>
#include "analyzer_cupla.h"
#include "input.h"
#include "modules.h"
#include "output.h"
int main(int argc, char** argv) {
Input input = read_input();
std::cout << "Got " << input.cablingMap.size << " for cabling, wordCounter " << input.wordCounter << std::endl;
std::unique_ptr<Output> output;
double totaltime = 0;
#ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_SYNC_BACKEND
output = std::make_unique<Output>();
std::cout << "\nRunning with the blocking serial CPU backend..." << std::endl;
cupla_seq_seq_sync::analyze(input, *output, totaltime);
std::cout << "Output: " << countModules(output->moduleInd, input.wordCounter) << " modules in " << totaltime << " us"
<< std::endl;
#endif // ALPAKA_ACC_CPU_B_SEQ_T_SEQ_SYNC_BACKEND
#ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ASYNC_BACKEND
output = std::make_unique<Output>();
std::cout << "\nRunning with the non-blocking serial CPU backend..." << std::endl;
cupla_seq_seq_async::analyze(input, *output, totaltime);
std::cout << "Output: " << countModules(output->moduleInd, input.wordCounter) << " modules in " << totaltime << " us"
<< std::endl;
#endif // ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ASYNC_BACKEND
#ifdef ALPAKA_ACC_CPU_B_TBB_T_SEQ_ASYNC_BACKEND
output = std::make_unique<Output>();
std::cout << "\nRunning with the non-blocking TBB CPU backend..." << std::endl;
cupla_tbb_seq_async::analyze(input, *output, totaltime);
std::cout << "Output: " << countModules(output->moduleInd, input.wordCounter) << " modules in " << totaltime << " us"
<< std::endl;
#endif // ALPAKA_ACC_CPU_B_TBB_T_SEQ_ASYNC_BACKEND
#ifdef ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ASYNC_BACKEND
output = std::make_unique<Output>();
std::cout << "\nRunning with the non-blocking OpenMP 2.0 blocks CPU backend..." << std::endl;
cupla_omp2_seq_async::analyze(input, *output, totaltime);
std::cout << "Output: " << countModules(output->moduleInd, input.wordCounter) << " modules in " << totaltime << " us"
<< std::endl;
#endif // ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ASYNC_BACKEND
#ifdef ALPAKA_ACC_CPU_BT_OMP4_ASYNC_BACKEND
output = std::make_unique<Output>();
std::cout << "\nRunning with the non-blocking OpenMP 4.0 CPU backend..." << std::endl;
cupla_omp4_omp4_async::analyze(input, *output, totaltime);
std::cout << "Output: " << countModules(output->moduleInd, input.wordCounter) << " modules in " << totaltime << " us"
<< std::endl;
#endif // ALPAKA_ACC_CPU_BT_OMP4_ASYNC_BACKEND
#ifdef ALPAKA_ACC_GPU_CUDA_ASYNC_BACKEND
output = std::make_unique<Output>();
std::cout << "\nRunning with the non-blocking CUDA GPU backend..." << std::endl;
cupla_cuda_async::analyze(input, *output, totaltime);
std::cout << "Output: " << countModules(output->moduleInd, input.wordCounter) << " modules in " << totaltime << " us"
<< std::endl;
#endif // ALPAKA_ACC_GPU_CUDA_ASYNC_BACKEND
return 0;
}