chkpoint_two & atomic_three: constructor cannot be called in parallel mode. #235
Replies: 7 comments 6 replies
-
|
Is the call during sequential mode; i.e., when there is only one thread ? |
Beta Was this translation helpful? Give feedback.
-
|
Try moving chekpoint constructor to the sequential section of the program. You should then be able to use that checkpoint object in parallel; i.,e., the calls of the form can be made by many threads in parallel. In other words one checkpoint object can be used by many threads at the same time. |
Beta Was this translation helpful? Give feedback.
-
|
@pnik073 Did the suggestion above work for you ? |
Beta Was this translation helpful? Give feedback.
-
|
Glad to head that moving the checkpoint function constructor into the sequential code worked for you. When you mention using AD are you differentiating f[g(x)] ? |
Beta Was this translation helpful? Give feedback.
-
|
The simplest thing to do is to evaluate the Jacobian of f(g(x)) using reverse mode, once for each scenario. When tryiing a method for splitting the calculation into g'(x) and f'( g(x) ), try some of the different sparse derivative choices for g'(x) if it is sparse. If g'(x) is dense, perhaps it would be faster to make multiplies copies of its ADFun function (one for each thread) and do its Jacobian calculation in parallel, |
Beta Was this translation helpful? Give feedback.
-
|
Are you recording a different f for each sample ? If so, perhaps you should use dynamic parameters for the random samples ? |
Beta Was this translation helpful? Give feedback.
-
|
If I understand the description above correctly, you can define The for each sample of the random parameters, you would use new_dynamic |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why we cannot or how can we use checkpoints in parallel mode?
I have fully working parallel execution following the basics described in https://cppad.readthedocs.io/latest/sthread_get_started.cpp.html .
However, when I try to introduce checkpoints I get the error
atomic_three: constructor cannot be called in parallel modewhen I use more than one thread. With 1 thread the same code with checkpointing works as expected. For the checkpoints I am following https://cppad.readthedocs.io/stable-2025/chkpoint_two_get_started.cpp.html#My use case assumes AD vectors
ax(the independent), someay_commoncommon intermediate output and multipleay_specificspecific outputs per thread. The pseudo-code looks like this:Beta Was this translation helpful? Give feedback.
All reactions