-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (45 loc) · 1.95 KB
/
Copy pathmain.cpp
File metadata and controls
62 lines (45 loc) · 1.95 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
#include <iostream>
#include <sycl/sycl.hpp>
#include "ConfigReader.h"
#include "InterpolationFiller.h"
#include "MobileMappingReader.h"
#include "PngWriter.h"
#include "RadialFiller.h"
#include "Rasterizer.h"
#include "Sorter.h"
#include "SYCLState.h"
int main(const int argc, const char *argv[]) {
if (argc < 2) {
std::cerr << "Provide a path to a config file!\n";
return 1;
}
const auto config = EFTDEM::ConfigReader::readConfig(argv[1]);
int debug;
if (config.numDebugLines != 0) debug = std::max(config.numDebugLines, EFTDEM_DEBUG);
else debug = EFTDEM_DEBUG * 25;
EFTDEM::PointCloud pointCloud{config.width, config.height};
EFTDEM::MobileMappingReader::readPointsFromFile(pointCloud, config.inputPath, debug);
pointCloud.heights = std::vector<float>(pointCloud.width * pointCloud.height, 0);
const auto startTime = std::chrono::high_resolution_clock::now();
// Trigger write back to host on buffer destruction
{
sycl::queue queue;
if (config.useGPU) queue = sycl::queue{sycl::gpu_selector_v, sycl::property::queue::in_order{}};
else queue = sycl::queue{sycl::cpu_selector_v, sycl::property::queue::in_order{}};
EFTDEM::SYCLState syclState{
queue,
std::nullopt,
std::nullopt,
std::nullopt
};
std::cout << "Selected " << syclState.queue.get_device().get_info<sycl::info::device::name>() << " as the SYCL device.\n";
EFTDEM::Sorter::sortPointCloud(pointCloud, syclState, debug);
EFTDEM::Rasterizer::rasterizePointCloud(pointCloud, syclState, debug);
EFTDEM::RadialFiller::fill(pointCloud, syclState, config.numClosingIterations, debug);
//EFTDEM::InterpolationFiller::fill(pointCloud, syclState, config.numClosingIterations, debug);
}
const auto endTime = std::chrono::high_resolution_clock::now();
std::cout << "Elapsed time for SYCL operations: " << std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count() << " ms\n";
EFTDEM::PngWriter::exportPointCloud(pointCloud, config.outputPath);
return 0;
}