Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
graph_cl.h
Go to the documentation of this file.
1 
2 #ifndef GRAPHCL_H
3 #define GRAPHCL_H
4 
5 #include <graph_m4ri.h>
6 #include <list>
7 #include <iterator>
8 #include <data/matrix_pool.h>
9 #include <clm4rm.h>
10 
11 namespace frechet { namespace reach {
23 class GraphCL : public Graph {
24 private:
26  clmatrix_t* clmtx[2][2];
28  mutable std::list<clmatrix_t*> temps;
32  mutable cl_mem diagonalElementBuffer;
33 
34 protected:
35 
39 
57 public:
62  GraphCL(const GraphCL& that);
67  GraphCL(GraphCL&& that);
71  virtual ~GraphCL();
72 
78  GraphCL& operator= (const GraphCL& that);
84  GraphCL& operator= (GraphCL&& that);
85 
86  //TODO? bool operator== (const Graph& that) const;
90  virtual void synchToGpu() override;
94  virtual void synchFromGpu() override;
95 
105  virtual void finalize() override;
106  virtual void combine(const Graph* P) override;
107  virtual void merge2(const Graph* A, const Graph* B, MatrixPool* pool) override;
108  virtual void merge3(const Graph* A, const Graph* B, MatrixPool* pool) override;
109 
110  virtual void queryDiagonalElement() const override;
111  virtual int foundDiagonalElement() const override;
112 
113  virtual void release(Orientation o1, Orientation o2) override;
114  virtual void release(Orientation o1, Orientation o2, MatrixPool* pool) override;
115  virtual void resetConditions() override;
117 protected:
125  clmatrix_t* tempMatrix(int rows, int cols, MatrixPool* pool) const;
130  void copy(const GraphCL& that);
135  void swap(GraphCL& that);
136 };
137 
138 } } // namespace frechet::reach
139 
140 #endif // GRAPHCL_H
clmatrix_t * tempMatrix(int rows, int cols, MatrixPool *pool) const
allocate a temporary matrix
Definition: graph_cl.cpp:331
virtual void synchFromGpu() override
copy adjacancy matrix data back from GPU memory to CPU memory
Definition: graph_cl.cpp:173
GraphCL(const GraphModel::ptr model)
empty constructor
Definition: graph_cl.cpp:37
OpenCL boolean matrix data structure. Data is arranged in 32 bit words.
Definition: clm4rm.h:98
Reachability Graph with additional storage in GPU memory.
Definition: graph_cl.h:23
virtual void resetConditions() override
Definition: graph_cl.cpp:142
clmatrix_t * clmtx[2][2]
data stored on GPU memory
Definition: graph_cl.h:26
global definitions for all algorithms.
void copy(const GraphCL &that)
copy data
Definition: graph_cl.cpp:101
virtual void finalize() override
Definition: graph_cl.cpp:134
std::list< clmatrix_t * > temps
temporary matrixes
Definition: graph_cl.h:28
boost::shared_ptr< GraphModel > ptr
smart pointer to a GraphModel object
Definition: graph_model.h:307
boost::shared_ptr< Graph > GraphPtr
Definition: graph_m4ri.h:14
virtual void combine(const Graph *P) override
apply the COMBINE operation, filtering edges with valid placements. Effectively performs a Boolean AN...
Definition: graph_cl.cpp:190
Manages OpenCL event dependencies; necessary when the queue is out-of-order; dependencies must be est...
Definition: clm4rm.h:227
virtual void merge2(const Graph *A, const Graph *B, MatrixPool *pool) override
apply the MERGE operation, computing the transitive closure of two graphs. Effectively performs a mat...
Definition: graph_cl.cpp:227
virtual void synchToGpu() override
copy adjacancy matrix data to GPU memory
Definition: graph_cl.cpp:147
GraphPtr newGraph(const GraphModel::ptr model)
Definition: graph_cl.cpp:12
virtual void release()
release memory for all parts of the adjacancy matrix
Definition: graph_m4ri.cpp:203
virtual void queryDiagonalElement() const override
find an edge on the diagonal of the adjacancy matrix. Does not return a result. To query the result o...
Definition: graph_cl.cpp:302
a range of node indices in a Reachability Graph
Definition: graph_model.h:17
Orientation
Segment Orientation.
Definition: boundary.h:31
virtual ~GraphCL()
destructor; release all memory, including GPU memory
Definition: graph_cl.cpp:73
memory pool for matrix objects (M4RI matrices mzd_t* and OpenCL matrices clm4rm_t*)
Definition: matrix_pool.h:26
Represents a Reachability Graph. Vertices correspond to intervals in the reachability structure,...
Definition: graph_boost.h:39
clm4rm_conditions cond
cl_events for out-of-order dependencies
Definition: graph_cl.h:30
cl_mem diagonalElementBuffer
result of searchDiagonalElement
Definition: graph_cl.h:32
#define str(S)
void swap(GraphCL &that)
swap data
Definition: graph_cl.cpp:112
GraphCL & operator=(const GraphCL &that)
assginment operator
Definition: graph_cl.cpp:89
const GraphModel & model
Definition: graph_boost.h:55
The Reachability Structure; maintains a list of intervals on the border of Free Space,...
Definition: structure.h:32
const IndexRange & hmask() const
horizontal range covered by this graph
Definition: graph_m4ri.h:187
virtual int foundDiagonalElement() const override
Definition: graph_cl.cpp:315
virtual void merge3(const Graph *A, const Graph *B, MatrixPool *pool) override
apply the final MERGE operation, computing the transitive closure of two graphs. Effectively performs...
Definition: graph_cl.cpp:263