I'm learning to use OpenCL to optimize some of my simulations. I realized that I need some sort of Graph-clustering or graph-partitioning to exploit efficiently local memory for un-ordered meshes.
example: I implemented elastic cloth simulation with regular mesh of 4-bonded vertexes, which I can separate manually to localized batches. Now I would like to move to general irregular mesh where each node can have any number of edges.
From quick search I found some resources but I'm not sure if it adress very well my needs (I have no experience in area of discrete math and graph theory).
What I want:
- split mesh to batches such that
- all batches has approximately same size (number of nodes and edges) e.g. 16 nodes each correspoding to
local_size
of my OpenCL kernell - the number of edges between different batches is minimal - to minimize overlap between nodes loaded by each workgroup
- all batches has approximately same size (number of nodes and edges) e.g. 16 nodes each correspoding to
- Algorithm which is concise and easy to implement by myself - for me this is just side issue not main topic. I do not what to create dependence on some 3rd party software or library even if it is open-source.
- it does not have to lead to optimal solution, it can be stochastic and rough heuristic
- it should be fast - $O(n)$ with small prefactor