[CppAD] Multi-Threading

Jey Kottalam cppad at jey.kottalam.net
Thu Mar 8 10:51:07 EST 2012


> The system memory allocator is
> exclusive; i.e., only one thread can use it at a time. For this reason, the
> old simpler version of CppAD would loose performance when more than 5
> threads where used in parallel. A new multi-threading memory allocator was
> added to solve this problem.
>

This is not true as far as I know. Even if it is, it's not an issue to
be solved at the level of CppAD, but instead needs to be solved
application-wide by any program that uses threads, so CppAD should
just assume that the memory allocator provided by the system is
thread-safe and performant. I'd like to at least see a preprocessor
flag that can be used to disable CppAD's custom memory management
layer to have it use operator new and operator new directly.

Generally, CppAD's multi-threading API is rather clumsy and confusing
right now, and could at least use some clearer documentation. (E.g.
it's not clear what "multi-threading mode" is, whether it refers to
using one tape from multiple threads, or if it creates a tape per
thread. It was also not immediately clear whether "multi-threading
mode" needed to be enabled to simply pass ADFun objects between
threads.)

-Jey


More information about the CppAD mailing list