|
Prev
| Next
|
|
|
|
|
|
multi_atomic_two_worker |
|
@(@\newcommand{\W}[1]{ \; #1 \; }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }
\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }
\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }
\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@This is cppad-20221105 documentation. Here is a link to its
current documentation
.
Multi-Threaded atomic_two Worker
Purpose
This routine does the computation for one thread.
Source
namespace {
void multi_atomic_two_worker(void)
{ size_t thread_num = thread_alloc::thread_num();
size_t num_threads = std::max(num_threads_, size_t(1));
bool ok = thread_num < num_threads;
//
vector<double> x(1), y(1);
size_t n = work_all_[thread_num]->y_squared->size();
work_all_[thread_num]->square_root->resize(n);
for(size_t i = 0; i < n; i++)
{ x[0] = (* work_all_[thread_num]->y_squared )[i];
y = work_all_[thread_num]->fun->Forward(0, x);
//
(* work_all_[thread_num]->square_root )[i] = y[0];
}
work_all_[thread_num]->ok = ok;
}
}
Input File: example/multi_thread/multi_atomic_two.cpp