97{ *(
int*)lhs += *(
int*)rhs; }
101{ *(
long long*)lhs += *(
long long*)rhs; }
105{ *(
double*)
data = 1.0; }
107{ *(
double*)lhs *= *(
double*)rhs; }
111{ *(
double*)lhs += *(
double*)rhs; }
115void calc_serial(
int *pi,
long long *pj,
double *px,
long long *pk,
double *py)
117 for(
int l = 0; l <
N; ++l ) {
120 *px *= 1.0 / (l + 1);
124 for(
int l = 0; l <
N; ++l ) {
129 *px *= 1.0 / (l + 1);
139 *px *= 1.0 / (l + 1);
143 for(
int l = 0; l <
N; ++l ) {
154 void** ptrs = (
void**)malloc(nthreads*
sizeof(
void*));
159 long long js = -9999999;
161 long long ks = 99999999;
162 double ys = -99999999.0;
165 long long jp = -9999999;
167 long long kp = 99999999;
168 double yp = -99999999.0;
172 for (
int i = 0;
i < nthreads; ++
i)
176 #pragma omp single nowait
179 #pragma omp taskgroup
182 red_data[0].
shar = &ip;
183 red_data[0].
size =
sizeof(ip);
184 red_data[0].
f_init = NULL;
185 red_data[0].
f_fini = NULL;
188 red_data[1].
shar = &jp;
189 red_data[1].
size =
sizeof(jp);
190 red_data[1].
f_init = NULL;
191 red_data[1].
f_fini = NULL;
194 red_data[2].
shar = &xp;
195 red_data[2].
size =
sizeof(xp);
197 red_data[2].
f_fini = NULL;
203 for(
int l = 0; l <
N; l += 2 ) {
206 #pragma omp task firstprivate(l)
212 if (!ptrs[gtid]) ptrs[gtid] = p_xp;
219 *p_xp *= 1.0 / (l + 2);
224 #pragma omp taskgroup
227 red_data[0].
shar = &ip;
228 red_data[0].
size =
sizeof(ip);
229 red_data[0].
f_init = NULL;
230 red_data[0].
f_fini = NULL;
233 red_data[1].
shar = &kp;
234 red_data[1].
size =
sizeof(kp);
235 red_data[1].
f_init = NULL;
236 red_data[1].
f_fini = NULL;
239 red_data[2].
shar = &yp;
240 red_data[2].
size =
sizeof(yp);
241 red_data[2].
f_init = NULL;
242 red_data[2].
f_fini = NULL;
248 for(
int l = 0; l <
N; l += 2 ) {
249 #pragma omp task firstprivate(l)
270 *p_xp *= 1.0 / (l + 2);
274 int tid = omp_get_thread_num();
279 if (addr1 != addr2) {
282 printf(
"Wrong thread-specific addresses %d s:%p p:%p\n", tid, addr1, addr2);
288 if (addr1 != addr2) {
291 printf(
"Wrong thread-specific addresses %d s:%p n:%p\n",
296 if (ptrs[nthreads-1]) {
298 if (addr1 != addr2) {
301 printf(
"Wrong thread-specific addresses %d s:%p n:%p\n",
309 #pragma omp task firstprivate(l)
330 #pragma omp task firstprivate(l)
343 *p_xp *= 1.0 / (l + 2);
349 for(
int l = 0; l <
N; l += 2 ) {
350 #pragma omp task firstprivate(l)
366 printf(
"reduction flags = %u\n",
FLG);
368 if (ip == is && jp == js && ks == kp &&
369 fabs(xp - xs) < 0.01 && fabs(yp - ys) < 0.01)
372 printf(
"failed,\n ser:(%d %lld %f %lld %f)\n par:(%d %lld %f %lld %f)\n",
void * __kmpc_task_reduction_get_th_data(int gtid, void *tg, void *item)
void * __kmpc_task_reduction_init(int gtid, int num, void *data)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void * data
KMP_ARCH_X86 KMP_ARCH_X86 long double
void __red_dbl_mul_init(void *data)
int __kmpc_global_thread_num(void *)
void __red_int_add_comb(void *lhs, void *rhs)
void __red_llong_add_comb(void *lhs, void *rhs)
void __red_dbl_mul_comb(void *lhs, void *rhs)
struct _task_red_item _task_red_item_t
void calc_serial(int *pi, long long *pj, double *px, long long *pk, double *py)
void __red_dbl_add_comb(void *lhs, void *rhs)
int omp_get_max_threads()