|
From: Bill H. <goo...@go...> - 2009-02-11 19:39:14
|
I have just committed changes to the development version of FLINT to make the test_support and memory_manager code thread safe. I've verified that all tests in fmpz_poly-test can now run in parallel without issues and fixed numerous issues with thread safety in that module. All of the functions in fmpz_poly are fully threadsafe, with the exception of: * _fmpz_poly_mul_modular is not threadsafe (it stores static information - Gonzalo and I are working on fixing it). Some of the biggest issues were: * mpn_random2 is not threadsafe and segfaults * the stack based memory manager in FLINT was not threadsafe as it did not set up per thread stacks * use of randstate_t's in test support without initialising per thread was not threadsafe * everything needs cleaning up when joining threads (i.e. the per thread memory managers and random states), otherwise you get a memory leak - there is now a macro in flint.h for doing this cleanup, though OpenMP does not seem to have a mechanism for doing automatic cleanup on joining threads, so this is the user's responsibility I have not checked the thread safety of any other part of FLINT, however I am unaware of anything else that is not threadsafe except the random functions in long_extras and the stack based mpz_t allocator in the mpz_extras module (which no one uses anyway). It is my hope that FLINT 1.2 will be fully threadsafe. Note gcc 4.2.4 or higher is currently needed to compile the development version of FLINT. I'll put some checking in for lower versions in FLINT 1.2 before releasing (and OpenMP stuff just won't be available to people with older versions of gcc). I haven't decided whether to have the tests to run in parallel or not. Currently some of them run much faster in parallel, and some much slower. Bill. |