-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
81 lines (75 loc) · 2.32 KB
/
Copy pathmain.cpp
File metadata and controls
81 lines (75 loc) · 2.32 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <tuple>
#include <vector>
#include <fstream>
#include <cstdlib>
#include <iostream>
#include "include/Run_Functions.hpp"
#include "include/FFTW_Class.hpp"
#ifdef PYTHON_PLOTTING
#include "include/Plotting_Functions.hpp"
#endif
#ifdef CUDA_FFT
#include "include/cuFFT_Class.hpp"
#endif
#ifdef ROC_FFT
#include "include/rocFFT_Class.hpp"
#endif
using namespace std;
ofstream output_file;
void atexit_handler_1() {
output_file << "Premature close" << endl;
output_file.flush();
output_file.close();
}
int main(int argc, char **argv) {
auto [Mem_Run, Plot, file_name, FFTW, cuFFT, rocFFT,
run_count, repeat_count, mem_start] = retrieve_arguments(argc, argv);
output_file.open(file_name, ios::out | ios::app);
const int exiting = std::atexit(atexit_handler_1);
if (exiting)
{
std::cerr << "Registration failed!\n";
return EXIT_FAILURE;
}
if (Mem_Run) {
output_file << "Repeating runs " << repeat_count << " times; With Memory Size\n";
output_file << "FFT_Code,\tMem_Size[MB],\tAvg_time[ms],\tCheck_Value\n";
output_file.flush();
vector<float> memories = get_memories(mem_start, run_count);
if (FFTW){
memory_run<FFTW_Class>(memories, run_count, Plot, output_file);
}
#ifdef CUDA_FFT
if (cuFFT){
memory_run<cuFFT_Class>(memories, run_count, Plot, output_file);
}
#endif
#ifdef ROC_FFT
if (rocFFT){
memory_run<rocFFT_Class>(memories, run_count, Plot, output_file);
}
#endif
} else {
output_file << "Repeating runs " << repeat_count << " times; With elements.\n";
output_file << "FFT_Code,\tMem_Size[MB],\tAvg_time[ms],\tCheck_Value\n";
output_file.flush();
vector<int> elements = get_elements(run_count);
if (FFTW){
element_run<FFTW_Class>(elements, run_count, Plot, output_file);
}
#ifdef CUDA_FFT
if (cuFFT){
element_run<cuFFT_Class>(elements, run_count, Plot, output_file);
}
#endif
#ifdef ROC_FFT
if (rocFFT){
element_run<rocFFT_Class>(elements, run_count, Plot, output_file);
}
#endif
}
output_file << "Run_Finished\n";
output_file.flush();
output_file.close();
return 0;
}