I'm writing a C++ software which needs fast Minkowski sum computations. An implementation based on double suffices.
I evaluated some geometric libraries such as
but I ended up using another third-party library which is very fast compared to the previous ones and which uses the FIST library for triangulation.
My code works more or less in the following way:
Since the computations within the loop are independent from round to round, I parallelized the loop and everything worked fine.
Then I decided to move the Minkowski sum computation in each parallel round:
but the third-party library worked no more.
I get number_of_threads - 1
error messages saying
Assertion Failed.
The files causing the assertion failure change from run to run and from thread to thread, but they all are c-files having same name as the FIST headers (while I have the source code of the third-party library, I have only a .lib and the headers of the FIST library)
As stated before, I tried to compute all the Minkowski sums I need outside the parallelized code and use the results within it. This was ok. So I'm almost sure that the problems come from FIST.
I have two questions:
Do you know if the FIST library is thread safe?
If not, could you please suggest me a thread-safe (C or, better,) C++ triangulation library to replace FIST (possibly with comparable performances)?
edit:
Actually, I don't know if "thread-safe" is exactly what I want: I only need a tringulation library able to compute many independent triangulations at the same time.
I think that if the library had not global variables and if it had a class without static
variables
class triangulation
{
// no static variables
void execute_triangulation();
}
it could be enough. So I could use different instances of that class and run in parallel their method.
You can probably use the 2D triangulation package of CGAL to replace FIST, and then use it as the input of that third-party library that does Minskowski sums. The CGAL triangulations are very fast, and reliable. You can triangulate polygons and complex shapes using constrained Delaunay triangulation.
By the way, which Minkowsky library do you use?
One possible and immediately testable solution is to place a mutex around the code that invokes the Minkowski calculations. If that sounds interesting and you don't know how to do it, add a comment detailing the platform you're using and I, or someone else, will outline how to do it.
At the very least, that will show you whether you have correctly identified the problem. If the calculations form a small part of your total bandwidth, then it may turn out to be a good solution - otherwise just a step on the road.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With