feat: add CUDA raytracing benchmark and refactor VoxRaytracer::RayData to use DataAllocator for host/device memory management.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#ifndef VOXRAYTRACER_H
|
||||
#define VOXRAYTRACER_H
|
||||
|
||||
#include "Math/DataAllocator.h"
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -43,7 +44,7 @@ class VoxRaytracer {
|
||||
public:
|
||||
class RayData {
|
||||
public:
|
||||
RayData() : m_TotalLength(0) {}
|
||||
RayData() : m_TotalLength(0), m_Count(0) {}
|
||||
|
||||
struct Element {
|
||||
Id_t vox_id;
|
||||
@@ -55,15 +56,24 @@ public:
|
||||
|
||||
void AppendRay(const RayData &in);
|
||||
|
||||
inline const std::vector<Element> &Data() const { return this->m_Data; }
|
||||
inline DataAllocator<Element> &Data() { return this->m_Data; }
|
||||
|
||||
inline const DataAllocator<Element> &Data() const { return this->m_Data; }
|
||||
|
||||
inline size_t Count() const { return this->m_Count; }
|
||||
|
||||
inline const Scalarf &TotalLength() const { return this->m_TotalLength; }
|
||||
|
||||
inline void SetCount(size_t c) { this->m_Count = c; }
|
||||
|
||||
inline void SetTotalLength(Scalarf tl) { this->m_TotalLength = tl; }
|
||||
|
||||
void PrintSelf(std::ostream &o);
|
||||
|
||||
private:
|
||||
std::vector<Element> m_Data;
|
||||
DataAllocator<Element> m_Data;
|
||||
Scalarf m_TotalLength;
|
||||
size_t m_Count;
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -87,6 +97,15 @@ public:
|
||||
template <typename VoxelT>
|
||||
void AccumulateLinesCUDA(const HLine3f *lines, size_t num_lines,
|
||||
VoxImage<VoxelT> &image);
|
||||
|
||||
void TraceLineCUDA(const HLine3f *lines, size_t num_lines, RayData *out_rays,
|
||||
int max_elements_per_ray = 128,
|
||||
float *kernel_time_ms = nullptr);
|
||||
|
||||
void TraceBetweenPointsCUDA(const HPoint3f *in_pts, const HPoint3f *out_pts,
|
||||
size_t num_lines, RayData *out_rays,
|
||||
int max_elements_per_ray = 128,
|
||||
float *kernel_time_ms = nullptr);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user