kmp_sched.cpp 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. /*
  2. * kmp_sched.cpp -- static scheduling -- iteration initialization
  3. */
  4. //===----------------------------------------------------------------------===//
  5. //
  6. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  7. // See https://llvm.org/LICENSE.txt for license information.
  8. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  9. //
  10. //===----------------------------------------------------------------------===//
  11. /* Static scheduling initialization.
  12. NOTE: team->t.t_nproc is a constant inside of any dispatch loop, however
  13. it may change values between parallel regions. __kmp_max_nth
  14. is the largest value __kmp_nth may take, 1 is the smallest. */
  15. #include "kmp.h"
  16. #include "kmp_error.h"
  17. #include "kmp_i18n.h"
  18. #include "kmp_itt.h"
  19. #include "kmp_stats.h"
  20. #include "kmp_str.h"
  21. #if OMPT_SUPPORT
  22. #include "ompt-specific.h"
  23. #endif
  24. #ifdef KMP_DEBUG
  25. //-------------------------------------------------------------------------
  26. // template for debug prints specification ( d, u, lld, llu )
  27. char const *traits_t<int>::spec = "d";
  28. char const *traits_t<unsigned int>::spec = "u";
  29. char const *traits_t<long long>::spec = "lld";
  30. char const *traits_t<unsigned long long>::spec = "llu";
  31. char const *traits_t<long>::spec = "ld";
  32. //-------------------------------------------------------------------------
  33. #endif
  34. #if KMP_STATS_ENABLED
  35. #define KMP_STATS_LOOP_END(stat) \
  36. { \
  37. kmp_int64 t; \
  38. kmp_int64 u = (kmp_int64)(*pupper); \
  39. kmp_int64 l = (kmp_int64)(*plower); \
  40. kmp_int64 i = (kmp_int64)incr; \
  41. if (i == 1) { \
  42. t = u - l + 1; \
  43. } else if (i == -1) { \
  44. t = l - u + 1; \
  45. } else if (i > 0) { \
  46. t = (u - l) / i + 1; \
  47. } else { \
  48. t = (l - u) / (-i) + 1; \
  49. } \
  50. KMP_COUNT_VALUE(stat, t); \
  51. KMP_POP_PARTITIONED_TIMER(); \
  52. }
  53. #else
  54. #define KMP_STATS_LOOP_END(stat) /* Nothing */
  55. #endif
  56. static ident_t loc_stub = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;"};
  57. static inline void check_loc(ident_t *&loc) {
  58. if (loc == NULL)
  59. loc = &loc_stub; // may need to report location info to ittnotify
  60. }
  61. template <typename T>
  62. static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
  63. kmp_int32 schedtype, kmp_int32 *plastiter,
  64. T *plower, T *pupper,
  65. typename traits_t<T>::signed_t *pstride,
  66. typename traits_t<T>::signed_t incr,
  67. typename traits_t<T>::signed_t chunk
  68. #if OMPT_SUPPORT && OMPT_OPTIONAL
  69. ,
  70. void *codeptr
  71. #endif
  72. ) {
  73. KMP_COUNT_BLOCK(OMP_LOOP_STATIC);
  74. KMP_PUSH_PARTITIONED_TIMER(OMP_loop_static);
  75. KMP_PUSH_PARTITIONED_TIMER(OMP_loop_static_scheduling);
  76. typedef typename traits_t<T>::unsigned_t UT;
  77. typedef typename traits_t<T>::signed_t ST;
  78. /* this all has to be changed back to TID and such.. */
  79. kmp_int32 gtid = global_tid;
  80. kmp_uint32 tid;
  81. kmp_uint32 nth;
  82. UT trip_count;
  83. kmp_team_t *team;
  84. __kmp_assert_valid_gtid(gtid);
  85. kmp_info_t *th = __kmp_threads[gtid];
  86. #if OMPT_SUPPORT && OMPT_OPTIONAL
  87. ompt_team_info_t *team_info = NULL;
  88. ompt_task_info_t *task_info = NULL;
  89. ompt_work_t ompt_work_type = ompt_work_loop;
  90. static kmp_int8 warn = 0;
  91. if (ompt_enabled.ompt_callback_work || ompt_enabled.ompt_callback_dispatch) {
  92. // Only fully initialize variables needed by OMPT if OMPT is enabled.
  93. team_info = __ompt_get_teaminfo(0, NULL);
  94. task_info = __ompt_get_task_info_object(0);
  95. // Determine workshare type
  96. if (loc != NULL) {
  97. if ((loc->flags & KMP_IDENT_WORK_LOOP) != 0) {
  98. ompt_work_type = ompt_work_loop;
  99. } else if ((loc->flags & KMP_IDENT_WORK_SECTIONS) != 0) {
  100. ompt_work_type = ompt_work_sections;
  101. } else if ((loc->flags & KMP_IDENT_WORK_DISTRIBUTE) != 0) {
  102. ompt_work_type = ompt_work_distribute;
  103. } else {
  104. kmp_int8 bool_res =
  105. KMP_COMPARE_AND_STORE_ACQ8(&warn, (kmp_int8)0, (kmp_int8)1);
  106. if (bool_res)
  107. KMP_WARNING(OmptOutdatedWorkshare);
  108. }
  109. KMP_DEBUG_ASSERT(ompt_work_type);
  110. }
  111. }
  112. #endif
  113. KMP_DEBUG_ASSERT(plastiter && plower && pupper && pstride);
  114. KE_TRACE(10, ("__kmpc_for_static_init called (%d)\n", global_tid));
  115. #ifdef KMP_DEBUG
  116. {
  117. char *buff;
  118. // create format specifiers before the debug output
  119. buff = __kmp_str_format(
  120. "__kmpc_for_static_init: T#%%d sched=%%d liter=%%d iter=(%%%s,"
  121. " %%%s, %%%s) incr=%%%s chunk=%%%s signed?<%s>\n",
  122. traits_t<T>::spec, traits_t<T>::spec, traits_t<ST>::spec,
  123. traits_t<ST>::spec, traits_t<ST>::spec, traits_t<T>::spec);
  124. KD_TRACE(100, (buff, global_tid, schedtype, *plastiter, *plower, *pupper,
  125. *pstride, incr, chunk));
  126. __kmp_str_free(&buff);
  127. }
  128. #endif
  129. if (__kmp_env_consistency_check) {
  130. __kmp_push_workshare(global_tid, ct_pdo, loc);
  131. if (incr == 0) {
  132. __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo,
  133. loc);
  134. }
  135. }
  136. /* special handling for zero-trip loops */
  137. if (incr > 0 ? (*pupper < *plower) : (*plower < *pupper)) {
  138. if (plastiter != NULL)
  139. *plastiter = FALSE;
  140. /* leave pupper and plower set to entire iteration space */
  141. *pstride = incr; /* value should never be used */
  142. // *plower = *pupper - incr;
  143. // let compiler bypass the illegal loop (like for(i=1;i<10;i--))
  144. // THE LINE COMMENTED ABOVE CAUSED shape2F/h_tests_1.f TO HAVE A FAILURE
  145. // ON A ZERO-TRIP LOOP (lower=1, upper=0,stride=1) - JPH June 23, 2009.
  146. #ifdef KMP_DEBUG
  147. {
  148. char *buff;
  149. // create format specifiers before the debug output
  150. buff = __kmp_str_format("__kmpc_for_static_init:(ZERO TRIP) liter=%%d "
  151. "lower=%%%s upper=%%%s stride = %%%s "
  152. "signed?<%s>, loc = %%s\n",
  153. traits_t<T>::spec, traits_t<T>::spec,
  154. traits_t<ST>::spec, traits_t<T>::spec);
  155. check_loc(loc);
  156. KD_TRACE(100,
  157. (buff, *plastiter, *plower, *pupper, *pstride, loc->psource));
  158. __kmp_str_free(&buff);
  159. }
  160. #endif
  161. KE_TRACE(10, ("__kmpc_for_static_init: T#%d return\n", global_tid));
  162. #if OMPT_SUPPORT && OMPT_OPTIONAL
  163. if (ompt_enabled.ompt_callback_work) {
  164. ompt_callbacks.ompt_callback(ompt_callback_work)(
  165. ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
  166. &(task_info->task_data), 0, codeptr);
  167. }
  168. #endif
  169. KMP_STATS_LOOP_END(OMP_loop_static_iterations);
  170. return;
  171. }
  172. // Although there are schedule enumerations above kmp_ord_upper which are not
  173. // schedules for "distribute", the only ones which are useful are dynamic, so
  174. // cannot be seen here, since this codepath is only executed for static
  175. // schedules.
  176. if (schedtype > kmp_ord_upper) {
  177. // we are in DISTRIBUTE construct
  178. schedtype += kmp_sch_static -
  179. kmp_distribute_static; // AC: convert to usual schedule type
  180. if (th->th.th_team->t.t_serialized > 1) {
  181. tid = 0;
  182. team = th->th.th_team;
  183. } else {
  184. tid = th->th.th_team->t.t_master_tid;
  185. team = th->th.th_team->t.t_parent;
  186. }
  187. } else {
  188. tid = __kmp_tid_from_gtid(global_tid);
  189. team = th->th.th_team;
  190. }
  191. /* determine if "for" loop is an active worksharing construct */
  192. if (team->t.t_serialized) {
  193. /* serialized parallel, each thread executes whole iteration space */
  194. if (plastiter != NULL)
  195. *plastiter = TRUE;
  196. /* leave pupper and plower set to entire iteration space */
  197. *pstride =
  198. (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
  199. #ifdef KMP_DEBUG
  200. {
  201. char *buff;
  202. // create format specifiers before the debug output
  203. buff = __kmp_str_format("__kmpc_for_static_init: (serial) liter=%%d "
  204. "lower=%%%s upper=%%%s stride = %%%s\n",
  205. traits_t<T>::spec, traits_t<T>::spec,
  206. traits_t<ST>::spec);
  207. KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pstride));
  208. __kmp_str_free(&buff);
  209. }
  210. #endif
  211. KE_TRACE(10, ("__kmpc_for_static_init: T#%d return\n", global_tid));
  212. #if OMPT_SUPPORT && OMPT_OPTIONAL
  213. if (ompt_enabled.ompt_callback_work) {
  214. ompt_callbacks.ompt_callback(ompt_callback_work)(
  215. ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
  216. &(task_info->task_data), *pstride, codeptr);
  217. }
  218. #endif
  219. KMP_STATS_LOOP_END(OMP_loop_static_iterations);
  220. return;
  221. }
  222. nth = team->t.t_nproc;
  223. if (nth == 1) {
  224. if (plastiter != NULL)
  225. *plastiter = TRUE;
  226. *pstride =
  227. (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
  228. #ifdef KMP_DEBUG
  229. {
  230. char *buff;
  231. // create format specifiers before the debug output
  232. buff = __kmp_str_format("__kmpc_for_static_init: (serial) liter=%%d "
  233. "lower=%%%s upper=%%%s stride = %%%s\n",
  234. traits_t<T>::spec, traits_t<T>::spec,
  235. traits_t<ST>::spec);
  236. KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pstride));
  237. __kmp_str_free(&buff);
  238. }
  239. #endif
  240. KE_TRACE(10, ("__kmpc_for_static_init: T#%d return\n", global_tid));
  241. #if OMPT_SUPPORT && OMPT_OPTIONAL
  242. if (ompt_enabled.ompt_callback_work) {
  243. ompt_callbacks.ompt_callback(ompt_callback_work)(
  244. ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
  245. &(task_info->task_data), *pstride, codeptr);
  246. }
  247. #endif
  248. KMP_STATS_LOOP_END(OMP_loop_static_iterations);
  249. return;
  250. }
  251. /* compute trip count */
  252. if (incr == 1) {
  253. trip_count = *pupper - *plower + 1;
  254. } else if (incr == -1) {
  255. trip_count = *plower - *pupper + 1;
  256. } else if (incr > 0) {
  257. // upper-lower can exceed the limit of signed type
  258. trip_count = (UT)(*pupper - *plower) / incr + 1;
  259. } else {
  260. trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
  261. }
  262. #if KMP_STATS_ENABLED
  263. if (KMP_MASTER_GTID(gtid)) {
  264. KMP_COUNT_VALUE(OMP_loop_static_total_iterations, trip_count);
  265. }
  266. #endif
  267. if (__kmp_env_consistency_check) {
  268. /* tripcount overflow? */
  269. if (trip_count == 0 && *pupper != *plower) {
  270. __kmp_error_construct(kmp_i18n_msg_CnsIterationRangeTooLarge, ct_pdo,
  271. loc);
  272. }
  273. }
  274. /* compute remaining parameters */
  275. switch (schedtype) {
  276. case kmp_sch_static: {
  277. if (trip_count < nth) {
  278. KMP_DEBUG_ASSERT(
  279. __kmp_static == kmp_sch_static_greedy ||
  280. __kmp_static ==
  281. kmp_sch_static_balanced); // Unknown static scheduling type.
  282. if (tid < trip_count) {
  283. *pupper = *plower = *plower + tid * incr;
  284. } else {
  285. // set bounds so non-active threads execute no iterations
  286. *plower = *pupper + (incr > 0 ? 1 : -1);
  287. }
  288. if (plastiter != NULL)
  289. *plastiter = (tid == trip_count - 1);
  290. } else {
  291. if (__kmp_static == kmp_sch_static_balanced) {
  292. UT small_chunk = trip_count / nth;
  293. UT extras = trip_count % nth;
  294. *plower += incr * (tid * small_chunk + (tid < extras ? tid : extras));
  295. *pupper = *plower + small_chunk * incr - (tid < extras ? 0 : incr);
  296. if (plastiter != NULL)
  297. *plastiter = (tid == nth - 1);
  298. } else {
  299. T big_chunk_inc_count =
  300. (trip_count / nth + ((trip_count % nth) ? 1 : 0)) * incr;
  301. T old_upper = *pupper;
  302. KMP_DEBUG_ASSERT(__kmp_static == kmp_sch_static_greedy);
  303. // Unknown static scheduling type.
  304. *plower += tid * big_chunk_inc_count;
  305. *pupper = *plower + big_chunk_inc_count - incr;
  306. if (incr > 0) {
  307. if (*pupper < *plower)
  308. *pupper = traits_t<T>::max_value;
  309. if (plastiter != NULL)
  310. *plastiter = *plower <= old_upper && *pupper > old_upper - incr;
  311. if (*pupper > old_upper)
  312. *pupper = old_upper; // tracker C73258
  313. } else {
  314. if (*pupper > *plower)
  315. *pupper = traits_t<T>::min_value;
  316. if (plastiter != NULL)
  317. *plastiter = *plower >= old_upper && *pupper < old_upper - incr;
  318. if (*pupper < old_upper)
  319. *pupper = old_upper; // tracker C73258
  320. }
  321. }
  322. }
  323. *pstride = trip_count;
  324. break;
  325. }
  326. case kmp_sch_static_chunked: {
  327. ST span;
  328. UT nchunks;
  329. if (chunk < 1)
  330. chunk = 1;
  331. else if ((UT)chunk > trip_count)
  332. chunk = trip_count;
  333. nchunks = (trip_count) / (UT)chunk + (trip_count % (UT)chunk ? 1 : 0);
  334. span = chunk * incr;
  335. if (nchunks < nth) {
  336. *pstride = span * nchunks;
  337. if (tid < nchunks) {
  338. *plower = *plower + (span * tid);
  339. *pupper = *plower + span - incr;
  340. } else {
  341. *plower = *pupper + (incr > 0 ? 1 : -1);
  342. }
  343. } else {
  344. *pstride = span * nth;
  345. *plower = *plower + (span * tid);
  346. *pupper = *plower + span - incr;
  347. }
  348. if (plastiter != NULL)
  349. *plastiter = (tid == (nchunks - 1) % nth);
  350. break;
  351. }
  352. case kmp_sch_static_balanced_chunked: {
  353. T old_upper = *pupper;
  354. // round up to make sure the chunk is enough to cover all iterations
  355. UT span = (trip_count + nth - 1) / nth;
  356. // perform chunk adjustment
  357. chunk = (span + chunk - 1) & ~(chunk - 1);
  358. span = chunk * incr;
  359. *plower = *plower + (span * tid);
  360. *pupper = *plower + span - incr;
  361. if (incr > 0) {
  362. if (*pupper > old_upper)
  363. *pupper = old_upper;
  364. } else if (*pupper < old_upper)
  365. *pupper = old_upper;
  366. if (plastiter != NULL)
  367. *plastiter = (tid == ((trip_count - 1) / (UT)chunk));
  368. break;
  369. }
  370. default:
  371. KMP_ASSERT2(0, "__kmpc_for_static_init: unknown scheduling type");
  372. break;
  373. }
  374. #if USE_ITT_BUILD
  375. // Report loop metadata
  376. if (KMP_MASTER_TID(tid) && __itt_metadata_add_ptr &&
  377. __kmp_forkjoin_frames_mode == 3 && th->th.th_teams_microtask == NULL &&
  378. team->t.t_active_level == 1) {
  379. kmp_uint64 cur_chunk = chunk;
  380. check_loc(loc);
  381. // Calculate chunk in case it was not specified; it is specified for
  382. // kmp_sch_static_chunked
  383. if (schedtype == kmp_sch_static) {
  384. cur_chunk = trip_count / nth + ((trip_count % nth) ? 1 : 0);
  385. }
  386. // 0 - "static" schedule
  387. __kmp_itt_metadata_loop(loc, 0, trip_count, cur_chunk);
  388. }
  389. #endif
  390. #ifdef KMP_DEBUG
  391. {
  392. char *buff;
  393. // create format specifiers before the debug output
  394. buff = __kmp_str_format("__kmpc_for_static_init: liter=%%d lower=%%%s "
  395. "upper=%%%s stride = %%%s signed?<%s>\n",
  396. traits_t<T>::spec, traits_t<T>::spec,
  397. traits_t<ST>::spec, traits_t<T>::spec);
  398. KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pstride));
  399. __kmp_str_free(&buff);
  400. }
  401. #endif
  402. KE_TRACE(10, ("__kmpc_for_static_init: T#%d return\n", global_tid));
  403. #if OMPT_SUPPORT && OMPT_OPTIONAL
  404. if (ompt_enabled.ompt_callback_work) {
  405. ompt_callbacks.ompt_callback(ompt_callback_work)(
  406. ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
  407. &(task_info->task_data), trip_count, codeptr);
  408. }
  409. if (ompt_enabled.ompt_callback_dispatch) {
  410. ompt_dispatch_t dispatch_type;
  411. ompt_data_t instance = ompt_data_none;
  412. ompt_dispatch_chunk_t dispatch_chunk;
  413. if (ompt_work_type == ompt_work_sections) {
  414. dispatch_type = ompt_dispatch_section;
  415. instance.ptr = codeptr;
  416. } else {
  417. OMPT_GET_DISPATCH_CHUNK(dispatch_chunk, *plower, *pupper, incr);
  418. dispatch_type = (ompt_work_type == ompt_work_distribute)
  419. ? ompt_dispatch_distribute_chunk
  420. : ompt_dispatch_ws_loop_chunk;
  421. instance.ptr = &dispatch_chunk;
  422. }
  423. ompt_callbacks.ompt_callback(ompt_callback_dispatch)(
  424. &(team_info->parallel_data), &(task_info->task_data), dispatch_type,
  425. instance);
  426. }
  427. #endif
  428. KMP_STATS_LOOP_END(OMP_loop_static_iterations);
  429. return;
  430. }
  431. template <typename T>
  432. static void __kmp_dist_for_static_init(ident_t *loc, kmp_int32 gtid,
  433. kmp_int32 schedule, kmp_int32 *plastiter,
  434. T *plower, T *pupper, T *pupperDist,
  435. typename traits_t<T>::signed_t *pstride,
  436. typename traits_t<T>::signed_t incr,
  437. typename traits_t<T>::signed_t chunk
  438. #if OMPT_SUPPORT && OMPT_OPTIONAL
  439. ,
  440. void *codeptr
  441. #endif
  442. ) {
  443. KMP_COUNT_BLOCK(OMP_DISTRIBUTE);
  444. KMP_PUSH_PARTITIONED_TIMER(OMP_distribute);
  445. KMP_PUSH_PARTITIONED_TIMER(OMP_distribute_scheduling);
  446. typedef typename traits_t<T>::unsigned_t UT;
  447. typedef typename traits_t<T>::signed_t ST;
  448. kmp_uint32 tid;
  449. kmp_uint32 nth;
  450. kmp_uint32 team_id;
  451. kmp_uint32 nteams;
  452. UT trip_count;
  453. kmp_team_t *team;
  454. kmp_info_t *th;
  455. KMP_DEBUG_ASSERT(plastiter && plower && pupper && pupperDist && pstride);
  456. KE_TRACE(10, ("__kmpc_dist_for_static_init called (%d)\n", gtid));
  457. __kmp_assert_valid_gtid(gtid);
  458. #ifdef KMP_DEBUG
  459. {
  460. char *buff;
  461. // create format specifiers before the debug output
  462. buff = __kmp_str_format(
  463. "__kmpc_dist_for_static_init: T#%%d schedLoop=%%d liter=%%d "
  464. "iter=(%%%s, %%%s, %%%s) chunk=%%%s signed?<%s>\n",
  465. traits_t<T>::spec, traits_t<T>::spec, traits_t<ST>::spec,
  466. traits_t<ST>::spec, traits_t<T>::spec);
  467. KD_TRACE(100,
  468. (buff, gtid, schedule, *plastiter, *plower, *pupper, incr, chunk));
  469. __kmp_str_free(&buff);
  470. }
  471. #endif
  472. if (__kmp_env_consistency_check) {
  473. __kmp_push_workshare(gtid, ct_pdo, loc);
  474. if (incr == 0) {
  475. __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo,
  476. loc);
  477. }
  478. if (incr > 0 ? (*pupper < *plower) : (*plower < *pupper)) {
  479. // The loop is illegal.
  480. // Some zero-trip loops maintained by compiler, e.g.:
  481. // for(i=10;i<0;++i) // lower >= upper - run-time check
  482. // for(i=0;i>10;--i) // lower <= upper - run-time check
  483. // for(i=0;i>10;++i) // incr > 0 - compile-time check
  484. // for(i=10;i<0;--i) // incr < 0 - compile-time check
  485. // Compiler does not check the following illegal loops:
  486. // for(i=0;i<10;i+=incr) // where incr<0
  487. // for(i=10;i>0;i-=incr) // where incr<0
  488. __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc);
  489. }
  490. }
  491. tid = __kmp_tid_from_gtid(gtid);
  492. th = __kmp_threads[gtid];
  493. nth = th->th.th_team_nproc;
  494. team = th->th.th_team;
  495. KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
  496. nteams = th->th.th_teams_size.nteams;
  497. team_id = team->t.t_master_tid;
  498. KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
  499. // compute global trip count
  500. if (incr == 1) {
  501. trip_count = *pupper - *plower + 1;
  502. } else if (incr == -1) {
  503. trip_count = *plower - *pupper + 1;
  504. } else if (incr > 0) {
  505. // upper-lower can exceed the limit of signed type
  506. trip_count = (UT)(*pupper - *plower) / incr + 1;
  507. } else {
  508. trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
  509. }
  510. *pstride = *pupper - *plower; // just in case (can be unused)
  511. if (trip_count <= nteams) {
  512. KMP_DEBUG_ASSERT(
  513. __kmp_static == kmp_sch_static_greedy ||
  514. __kmp_static ==
  515. kmp_sch_static_balanced); // Unknown static scheduling type.
  516. // only primary threads of some teams get single iteration, other threads
  517. // get nothing
  518. if (team_id < trip_count && tid == 0) {
  519. *pupper = *pupperDist = *plower = *plower + team_id * incr;
  520. } else {
  521. *pupperDist = *pupper;
  522. *plower = *pupper + incr; // compiler should skip loop body
  523. }
  524. if (plastiter != NULL)
  525. *plastiter = (tid == 0 && team_id == trip_count - 1);
  526. } else {
  527. // Get the team's chunk first (each team gets at most one chunk)
  528. if (__kmp_static == kmp_sch_static_balanced) {
  529. UT chunkD = trip_count / nteams;
  530. UT extras = trip_count % nteams;
  531. *plower +=
  532. incr * (team_id * chunkD + (team_id < extras ? team_id : extras));
  533. *pupperDist = *plower + chunkD * incr - (team_id < extras ? 0 : incr);
  534. if (plastiter != NULL)
  535. *plastiter = (team_id == nteams - 1);
  536. } else {
  537. T chunk_inc_count =
  538. (trip_count / nteams + ((trip_count % nteams) ? 1 : 0)) * incr;
  539. T upper = *pupper;
  540. KMP_DEBUG_ASSERT(__kmp_static == kmp_sch_static_greedy);
  541. // Unknown static scheduling type.
  542. *plower += team_id * chunk_inc_count;
  543. *pupperDist = *plower + chunk_inc_count - incr;
  544. // Check/correct bounds if needed
  545. if (incr > 0) {
  546. if (*pupperDist < *plower)
  547. *pupperDist = traits_t<T>::max_value;
  548. if (plastiter != NULL)
  549. *plastiter = *plower <= upper && *pupperDist > upper - incr;
  550. if (*pupperDist > upper)
  551. *pupperDist = upper; // tracker C73258
  552. if (*plower > *pupperDist) {
  553. *pupper = *pupperDist; // no iterations available for the team
  554. goto end;
  555. }
  556. } else {
  557. if (*pupperDist > *plower)
  558. *pupperDist = traits_t<T>::min_value;
  559. if (plastiter != NULL)
  560. *plastiter = *plower >= upper && *pupperDist < upper - incr;
  561. if (*pupperDist < upper)
  562. *pupperDist = upper; // tracker C73258
  563. if (*plower < *pupperDist) {
  564. *pupper = *pupperDist; // no iterations available for the team
  565. goto end;
  566. }
  567. }
  568. }
  569. // Get the parallel loop chunk now (for thread)
  570. // compute trip count for team's chunk
  571. if (incr == 1) {
  572. trip_count = *pupperDist - *plower + 1;
  573. } else if (incr == -1) {
  574. trip_count = *plower - *pupperDist + 1;
  575. } else if (incr > 1) {
  576. // upper-lower can exceed the limit of signed type
  577. trip_count = (UT)(*pupperDist - *plower) / incr + 1;
  578. } else {
  579. trip_count = (UT)(*plower - *pupperDist) / (-incr) + 1;
  580. }
  581. KMP_DEBUG_ASSERT(trip_count);
  582. switch (schedule) {
  583. case kmp_sch_static: {
  584. if (trip_count <= nth) {
  585. KMP_DEBUG_ASSERT(
  586. __kmp_static == kmp_sch_static_greedy ||
  587. __kmp_static ==
  588. kmp_sch_static_balanced); // Unknown static scheduling type.
  589. if (tid < trip_count)
  590. *pupper = *plower = *plower + tid * incr;
  591. else
  592. *plower = *pupper + incr; // no iterations available
  593. if (plastiter != NULL)
  594. if (*plastiter != 0 && !(tid == trip_count - 1))
  595. *plastiter = 0;
  596. } else {
  597. if (__kmp_static == kmp_sch_static_balanced) {
  598. UT chunkL = trip_count / nth;
  599. UT extras = trip_count % nth;
  600. *plower += incr * (tid * chunkL + (tid < extras ? tid : extras));
  601. *pupper = *plower + chunkL * incr - (tid < extras ? 0 : incr);
  602. if (plastiter != NULL)
  603. if (*plastiter != 0 && !(tid == nth - 1))
  604. *plastiter = 0;
  605. } else {
  606. T chunk_inc_count =
  607. (trip_count / nth + ((trip_count % nth) ? 1 : 0)) * incr;
  608. T upper = *pupperDist;
  609. KMP_DEBUG_ASSERT(__kmp_static == kmp_sch_static_greedy);
  610. // Unknown static scheduling type.
  611. *plower += tid * chunk_inc_count;
  612. *pupper = *plower + chunk_inc_count - incr;
  613. if (incr > 0) {
  614. if (*pupper < *plower)
  615. *pupper = traits_t<T>::max_value;
  616. if (plastiter != NULL)
  617. if (*plastiter != 0 &&
  618. !(*plower <= upper && *pupper > upper - incr))
  619. *plastiter = 0;
  620. if (*pupper > upper)
  621. *pupper = upper; // tracker C73258
  622. } else {
  623. if (*pupper > *plower)
  624. *pupper = traits_t<T>::min_value;
  625. if (plastiter != NULL)
  626. if (*plastiter != 0 &&
  627. !(*plower >= upper && *pupper < upper - incr))
  628. *plastiter = 0;
  629. if (*pupper < upper)
  630. *pupper = upper; // tracker C73258
  631. }
  632. }
  633. }
  634. break;
  635. }
  636. case kmp_sch_static_chunked: {
  637. ST span;
  638. if (chunk < 1)
  639. chunk = 1;
  640. span = chunk * incr;
  641. *pstride = span * nth;
  642. *plower = *plower + (span * tid);
  643. *pupper = *plower + span - incr;
  644. if (plastiter != NULL)
  645. if (*plastiter != 0 && !(tid == ((trip_count - 1) / (UT)chunk) % nth))
  646. *plastiter = 0;
  647. break;
  648. }
  649. default:
  650. KMP_ASSERT2(0,
  651. "__kmpc_dist_for_static_init: unknown loop scheduling type");
  652. break;
  653. }
  654. }
  655. end:;
  656. #ifdef KMP_DEBUG
  657. {
  658. char *buff;
  659. // create format specifiers before the debug output
  660. buff = __kmp_str_format(
  661. "__kmpc_dist_for_static_init: last=%%d lo=%%%s up=%%%s upDist=%%%s "
  662. "stride=%%%s signed?<%s>\n",
  663. traits_t<T>::spec, traits_t<T>::spec, traits_t<T>::spec,
  664. traits_t<ST>::spec, traits_t<T>::spec);
  665. KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pupperDist, *pstride));
  666. __kmp_str_free(&buff);
  667. }
  668. #endif
  669. KE_TRACE(10, ("__kmpc_dist_for_static_init: T#%d return\n", gtid));
  670. #if OMPT_SUPPORT && OMPT_OPTIONAL
  671. if (ompt_enabled.ompt_callback_work || ompt_enabled.ompt_callback_dispatch) {
  672. ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
  673. ompt_task_info_t *task_info = __ompt_get_task_info_object(0);
  674. if (ompt_enabled.ompt_callback_work) {
  675. ompt_callbacks.ompt_callback(ompt_callback_work)(
  676. ompt_work_distribute, ompt_scope_begin, &(team_info->parallel_data),
  677. &(task_info->task_data), 0, codeptr);
  678. }
  679. if (ompt_enabled.ompt_callback_dispatch) {
  680. ompt_data_t instance = ompt_data_none;
  681. ompt_dispatch_chunk_t dispatch_chunk;
  682. OMPT_GET_DISPATCH_CHUNK(dispatch_chunk, *plower, *pupperDist, incr);
  683. instance.ptr = &dispatch_chunk;
  684. ompt_callbacks.ompt_callback(ompt_callback_dispatch)(
  685. &(team_info->parallel_data), &(task_info->task_data),
  686. ompt_dispatch_distribute_chunk, instance);
  687. }
  688. }
  689. #endif // OMPT_SUPPORT && OMPT_OPTIONAL
  690. KMP_STATS_LOOP_END(OMP_distribute_iterations);
  691. return;
  692. }
  693. template <typename T>
  694. static void __kmp_team_static_init(ident_t *loc, kmp_int32 gtid,
  695. kmp_int32 *p_last, T *p_lb, T *p_ub,
  696. typename traits_t<T>::signed_t *p_st,
  697. typename traits_t<T>::signed_t incr,
  698. typename traits_t<T>::signed_t chunk) {
  699. // The routine returns the first chunk distributed to the team and
  700. // stride for next chunks calculation.
  701. // Last iteration flag set for the team that will execute
  702. // the last iteration of the loop.
  703. // The routine is called for dist_schedule(static,chunk) only.
  704. typedef typename traits_t<T>::unsigned_t UT;
  705. typedef typename traits_t<T>::signed_t ST;
  706. kmp_uint32 team_id;
  707. kmp_uint32 nteams;
  708. UT trip_count;
  709. T lower;
  710. T upper;
  711. ST span;
  712. kmp_team_t *team;
  713. kmp_info_t *th;
  714. KMP_DEBUG_ASSERT(p_last && p_lb && p_ub && p_st);
  715. KE_TRACE(10, ("__kmp_team_static_init called (%d)\n", gtid));
  716. __kmp_assert_valid_gtid(gtid);
  717. #ifdef KMP_DEBUG
  718. {
  719. char *buff;
  720. // create format specifiers before the debug output
  721. buff = __kmp_str_format("__kmp_team_static_init enter: T#%%d liter=%%d "
  722. "iter=(%%%s, %%%s, %%%s) chunk %%%s; signed?<%s>\n",
  723. traits_t<T>::spec, traits_t<T>::spec,
  724. traits_t<ST>::spec, traits_t<ST>::spec,
  725. traits_t<T>::spec);
  726. KD_TRACE(100, (buff, gtid, *p_last, *p_lb, *p_ub, *p_st, chunk));
  727. __kmp_str_free(&buff);
  728. }
  729. #endif
  730. lower = *p_lb;
  731. upper = *p_ub;
  732. if (__kmp_env_consistency_check) {
  733. if (incr == 0) {
  734. __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo,
  735. loc);
  736. }
  737. if (incr > 0 ? (upper < lower) : (lower < upper)) {
  738. // The loop is illegal.
  739. // Some zero-trip loops maintained by compiler, e.g.:
  740. // for(i=10;i<0;++i) // lower >= upper - run-time check
  741. // for(i=0;i>10;--i) // lower <= upper - run-time check
  742. // for(i=0;i>10;++i) // incr > 0 - compile-time check
  743. // for(i=10;i<0;--i) // incr < 0 - compile-time check
  744. // Compiler does not check the following illegal loops:
  745. // for(i=0;i<10;i+=incr) // where incr<0
  746. // for(i=10;i>0;i-=incr) // where incr<0
  747. __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc);
  748. }
  749. }
  750. th = __kmp_threads[gtid];
  751. team = th->th.th_team;
  752. KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
  753. nteams = th->th.th_teams_size.nteams;
  754. team_id = team->t.t_master_tid;
  755. KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
  756. // compute trip count
  757. if (incr == 1) {
  758. trip_count = upper - lower + 1;
  759. } else if (incr == -1) {
  760. trip_count = lower - upper + 1;
  761. } else if (incr > 0) {
  762. // upper-lower can exceed the limit of signed type
  763. trip_count = (UT)(upper - lower) / incr + 1;
  764. } else {
  765. trip_count = (UT)(lower - upper) / (-incr) + 1;
  766. }
  767. if (chunk < 1)
  768. chunk = 1;
  769. span = chunk * incr;
  770. *p_st = span * nteams;
  771. *p_lb = lower + (span * team_id);
  772. *p_ub = *p_lb + span - incr;
  773. if (p_last != NULL)
  774. *p_last = (team_id == ((trip_count - 1) / (UT)chunk) % nteams);
  775. // Correct upper bound if needed
  776. if (incr > 0) {
  777. if (*p_ub < *p_lb) // overflow?
  778. *p_ub = traits_t<T>::max_value;
  779. if (*p_ub > upper)
  780. *p_ub = upper; // tracker C73258
  781. } else { // incr < 0
  782. if (*p_ub > *p_lb)
  783. *p_ub = traits_t<T>::min_value;
  784. if (*p_ub < upper)
  785. *p_ub = upper; // tracker C73258
  786. }
  787. #ifdef KMP_DEBUG
  788. {
  789. char *buff;
  790. // create format specifiers before the debug output
  791. buff =
  792. __kmp_str_format("__kmp_team_static_init exit: T#%%d team%%u liter=%%d "
  793. "iter=(%%%s, %%%s, %%%s) chunk %%%s\n",
  794. traits_t<T>::spec, traits_t<T>::spec,
  795. traits_t<ST>::spec, traits_t<ST>::spec);
  796. KD_TRACE(100, (buff, gtid, team_id, *p_last, *p_lb, *p_ub, *p_st, chunk));
  797. __kmp_str_free(&buff);
  798. }
  799. #endif
  800. }
  801. //------------------------------------------------------------------------------
  802. extern "C" {
  803. /*!
  804. @ingroup WORK_SHARING
  805. @param loc Source code location
  806. @param gtid Global thread id of this thread
  807. @param schedtype Scheduling type
  808. @param plastiter Pointer to the "last iteration" flag
  809. @param plower Pointer to the lower bound
  810. @param pupper Pointer to the upper bound
  811. @param pstride Pointer to the stride
  812. @param incr Loop increment
  813. @param chunk The chunk size
  814. Each of the four functions here are identical apart from the argument types.
  815. The functions compute the upper and lower bounds and stride to be used for the
  816. set of iterations to be executed by the current thread from the statically
  817. scheduled loop that is described by the initial values of the bounds, stride,
  818. increment and chunk size.
  819. @{
  820. */
  821. void __kmpc_for_static_init_4(ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype,
  822. kmp_int32 *plastiter, kmp_int32 *plower,
  823. kmp_int32 *pupper, kmp_int32 *pstride,
  824. kmp_int32 incr, kmp_int32 chunk) {
  825. __kmp_for_static_init<kmp_int32>(loc, gtid, schedtype, plastiter, plower,
  826. pupper, pstride, incr, chunk
  827. #if OMPT_SUPPORT && OMPT_OPTIONAL
  828. ,
  829. OMPT_GET_RETURN_ADDRESS(0)
  830. #endif
  831. );
  832. }
  833. /*!
  834. See @ref __kmpc_for_static_init_4
  835. */
  836. void __kmpc_for_static_init_4u(ident_t *loc, kmp_int32 gtid,
  837. kmp_int32 schedtype, kmp_int32 *plastiter,
  838. kmp_uint32 *plower, kmp_uint32 *pupper,
  839. kmp_int32 *pstride, kmp_int32 incr,
  840. kmp_int32 chunk) {
  841. __kmp_for_static_init<kmp_uint32>(loc, gtid, schedtype, plastiter, plower,
  842. pupper, pstride, incr, chunk
  843. #if OMPT_SUPPORT && OMPT_OPTIONAL
  844. ,
  845. OMPT_GET_RETURN_ADDRESS(0)
  846. #endif
  847. );
  848. }
  849. /*!
  850. See @ref __kmpc_for_static_init_4
  851. */
  852. void __kmpc_for_static_init_8(ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype,
  853. kmp_int32 *plastiter, kmp_int64 *plower,
  854. kmp_int64 *pupper, kmp_int64 *pstride,
  855. kmp_int64 incr, kmp_int64 chunk) {
  856. __kmp_for_static_init<kmp_int64>(loc, gtid, schedtype, plastiter, plower,
  857. pupper, pstride, incr, chunk
  858. #if OMPT_SUPPORT && OMPT_OPTIONAL
  859. ,
  860. OMPT_GET_RETURN_ADDRESS(0)
  861. #endif
  862. );
  863. }
  864. /*!
  865. See @ref __kmpc_for_static_init_4
  866. */
  867. void __kmpc_for_static_init_8u(ident_t *loc, kmp_int32 gtid,
  868. kmp_int32 schedtype, kmp_int32 *plastiter,
  869. kmp_uint64 *plower, kmp_uint64 *pupper,
  870. kmp_int64 *pstride, kmp_int64 incr,
  871. kmp_int64 chunk) {
  872. __kmp_for_static_init<kmp_uint64>(loc, gtid, schedtype, plastiter, plower,
  873. pupper, pstride, incr, chunk
  874. #if OMPT_SUPPORT && OMPT_OPTIONAL
  875. ,
  876. OMPT_GET_RETURN_ADDRESS(0)
  877. #endif
  878. );
  879. }
  880. /*!
  881. @}
  882. */
  883. #if OMPT_SUPPORT && OMPT_OPTIONAL
  884. #define OMPT_CODEPTR_ARG , OMPT_GET_RETURN_ADDRESS(0)
  885. #else
  886. #define OMPT_CODEPTR_ARG
  887. #endif
  888. /*!
  889. @ingroup WORK_SHARING
  890. @param loc Source code location
  891. @param gtid Global thread id of this thread
  892. @param schedule Scheduling type for the parallel loop
  893. @param plastiter Pointer to the "last iteration" flag
  894. @param plower Pointer to the lower bound
  895. @param pupper Pointer to the upper bound of loop chunk
  896. @param pupperD Pointer to the upper bound of dist_chunk
  897. @param pstride Pointer to the stride for parallel loop
  898. @param incr Loop increment
  899. @param chunk The chunk size for the parallel loop
  900. Each of the four functions here are identical apart from the argument types.
  901. The functions compute the upper and lower bounds and strides to be used for the
  902. set of iterations to be executed by the current thread from the statically
  903. scheduled loop that is described by the initial values of the bounds, strides,
  904. increment and chunks for parallel loop and distribute constructs.
  905. @{
  906. */
  907. void __kmpc_dist_for_static_init_4(ident_t *loc, kmp_int32 gtid,
  908. kmp_int32 schedule, kmp_int32 *plastiter,
  909. kmp_int32 *plower, kmp_int32 *pupper,
  910. kmp_int32 *pupperD, kmp_int32 *pstride,
  911. kmp_int32 incr, kmp_int32 chunk) {
  912. __kmp_dist_for_static_init<kmp_int32>(loc, gtid, schedule, plastiter, plower,
  913. pupper, pupperD, pstride, incr,
  914. chunk OMPT_CODEPTR_ARG);
  915. }
  916. /*!
  917. See @ref __kmpc_dist_for_static_init_4
  918. */
  919. void __kmpc_dist_for_static_init_4u(ident_t *loc, kmp_int32 gtid,
  920. kmp_int32 schedule, kmp_int32 *plastiter,
  921. kmp_uint32 *plower, kmp_uint32 *pupper,
  922. kmp_uint32 *pupperD, kmp_int32 *pstride,
  923. kmp_int32 incr, kmp_int32 chunk) {
  924. __kmp_dist_for_static_init<kmp_uint32>(loc, gtid, schedule, plastiter, plower,
  925. pupper, pupperD, pstride, incr,
  926. chunk OMPT_CODEPTR_ARG);
  927. }
  928. /*!
  929. See @ref __kmpc_dist_for_static_init_4
  930. */
  931. void __kmpc_dist_for_static_init_8(ident_t *loc, kmp_int32 gtid,
  932. kmp_int32 schedule, kmp_int32 *plastiter,
  933. kmp_int64 *plower, kmp_int64 *pupper,
  934. kmp_int64 *pupperD, kmp_int64 *pstride,
  935. kmp_int64 incr, kmp_int64 chunk) {
  936. __kmp_dist_for_static_init<kmp_int64>(loc, gtid, schedule, plastiter, plower,
  937. pupper, pupperD, pstride, incr,
  938. chunk OMPT_CODEPTR_ARG);
  939. }
  940. /*!
  941. See @ref __kmpc_dist_for_static_init_4
  942. */
  943. void __kmpc_dist_for_static_init_8u(ident_t *loc, kmp_int32 gtid,
  944. kmp_int32 schedule, kmp_int32 *plastiter,
  945. kmp_uint64 *plower, kmp_uint64 *pupper,
  946. kmp_uint64 *pupperD, kmp_int64 *pstride,
  947. kmp_int64 incr, kmp_int64 chunk) {
  948. __kmp_dist_for_static_init<kmp_uint64>(loc, gtid, schedule, plastiter, plower,
  949. pupper, pupperD, pstride, incr,
  950. chunk OMPT_CODEPTR_ARG);
  951. }
  952. /*!
  953. @}
  954. */
  955. //------------------------------------------------------------------------------
  956. // Auxiliary routines for Distribute Parallel Loop construct implementation
  957. // Transfer call to template< type T >
  958. // __kmp_team_static_init( ident_t *loc, int gtid,
  959. // int *p_last, T *lb, T *ub, ST *st, ST incr, ST chunk )
  960. /*!
  961. @ingroup WORK_SHARING
  962. @{
  963. @param loc Source location
  964. @param gtid Global thread id
  965. @param p_last pointer to last iteration flag
  966. @param p_lb pointer to Lower bound
  967. @param p_ub pointer to Upper bound
  968. @param p_st Step (or increment if you prefer)
  969. @param incr Loop increment
  970. @param chunk The chunk size to block with
  971. The functions compute the upper and lower bounds and stride to be used for the
  972. set of iterations to be executed by the current team from the statically
  973. scheduled loop that is described by the initial values of the bounds, stride,
  974. increment and chunk for the distribute construct as part of composite distribute
  975. parallel loop construct. These functions are all identical apart from the types
  976. of the arguments.
  977. */
  978. void __kmpc_team_static_init_4(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
  979. kmp_int32 *p_lb, kmp_int32 *p_ub,
  980. kmp_int32 *p_st, kmp_int32 incr,
  981. kmp_int32 chunk) {
  982. KMP_DEBUG_ASSERT(__kmp_init_serial);
  983. __kmp_team_static_init<kmp_int32>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
  984. chunk);
  985. }
  986. /*!
  987. See @ref __kmpc_team_static_init_4
  988. */
  989. void __kmpc_team_static_init_4u(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
  990. kmp_uint32 *p_lb, kmp_uint32 *p_ub,
  991. kmp_int32 *p_st, kmp_int32 incr,
  992. kmp_int32 chunk) {
  993. KMP_DEBUG_ASSERT(__kmp_init_serial);
  994. __kmp_team_static_init<kmp_uint32>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
  995. chunk);
  996. }
  997. /*!
  998. See @ref __kmpc_team_static_init_4
  999. */
  1000. void __kmpc_team_static_init_8(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
  1001. kmp_int64 *p_lb, kmp_int64 *p_ub,
  1002. kmp_int64 *p_st, kmp_int64 incr,
  1003. kmp_int64 chunk) {
  1004. KMP_DEBUG_ASSERT(__kmp_init_serial);
  1005. __kmp_team_static_init<kmp_int64>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
  1006. chunk);
  1007. }
  1008. /*!
  1009. See @ref __kmpc_team_static_init_4
  1010. */
  1011. void __kmpc_team_static_init_8u(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
  1012. kmp_uint64 *p_lb, kmp_uint64 *p_ub,
  1013. kmp_int64 *p_st, kmp_int64 incr,
  1014. kmp_int64 chunk) {
  1015. KMP_DEBUG_ASSERT(__kmp_init_serial);
  1016. __kmp_team_static_init<kmp_uint64>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
  1017. chunk);
  1018. }
  1019. /*!
  1020. @}
  1021. */
  1022. } // extern "C"