ARGOBOTS  dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
self.c
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  * See COPYRIGHT in top-level directory.
4  */
5 
6 #include "abti.h"
7 
34 {
36  ABTI_UB_ASSERT(xstream);
37 
38  ABTI_xstream *p_local_xstream;
39  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
40 
41  /* Return value */
42  *xstream = ABTI_xstream_get_handle(p_local_xstream);
43  return ABT_SUCCESS;
44 }
45 
69 {
71  ABTI_UB_ASSERT(rank);
72 
73  ABTI_xstream *p_local_xstream;
74  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
75  /* Return value */
76  *rank = (int)p_local_xstream->rank;
77  return ABT_SUCCESS;
78 }
79 
102 {
104  ABTI_UB_ASSERT(thread);
105 
106  ABTI_xstream *p_local_xstream;
107  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
108  *thread = ABTI_thread_get_handle(p_local_xstream->p_thread);
109  return ABT_SUCCESS;
110 }
111 
134 {
136  ABTI_UB_ASSERT(id);
137 
138  ABTI_xstream *p_local_xstream;
139  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
140  *id = ABTI_thread_get_id(p_local_xstream->p_thread);
141  return ABT_SUCCESS;
142 }
143 
144 #ifdef ABT_CONFIG_USE_DOXYGEN
145 
151 int ABT_self_get_task(ABT_thread *thread);
152 #endif
153 
154 #ifdef ABT_CONFIG_USE_DOXYGEN
155 
162 #endif
163 
191 int ABT_self_set_specific(ABT_key key, void *value)
192 {
194 
195  ABTI_key *p_key = ABTI_key_get_ptr(key);
197 
198  ABTI_global *p_global;
199  ABTI_SETUP_GLOBAL(&p_global);
200 
201  ABTI_xstream *p_local_xstream;
202  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
203 
204  /* Obtain the key-value table pointer. */
205  int abt_errno =
206  ABTI_ktable_set(p_global, ABTI_xstream_get_local(p_local_xstream),
207  &p_local_xstream->p_thread->p_keytable, p_key, value);
208  ABTI_CHECK_ERROR(abt_errno);
209  return ABT_SUCCESS;
210 }
211 
240 int ABT_self_get_specific(ABT_key key, void **value)
241 {
243  ABTI_UB_ASSERT(value);
244 
245  ABTI_key *p_key = ABTI_key_get_ptr(key);
247 
248  /* We don't allow an external thread to call this routine. */
249  ABTI_xstream *p_local_xstream;
250  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
251 
252  /* Obtain the key-value table pointer */
253  *value = ABTI_ktable_get(&p_local_xstream->p_thread->p_keytable, p_key);
254  return ABT_SUCCESS;
255 }
256 
292 {
293  ABTI_UB_ASSERT(type);
294 
295 #ifndef ABT_CONFIG_ENABLE_VER_20_API
296  /* By default, type is ABT_UNIT_TYPE_EXT in Argobots 1.x */
297  *type = ABT_UNIT_TYPE_EXT;
298  ABTI_SETUP_GLOBAL(NULL);
299  /* Since ABT_ERR_INV_XSTREAM is a valid return, this should not be handled
300  * by ABTI_SETUP_LOCAL_XSTREAM, which warns the user when --enable-debug=err
301  * is set. */
302  ABTI_xstream *p_local_xstream =
304  if (!p_local_xstream) {
305  return ABT_ERR_INV_XSTREAM;
306  }
307  *type = ABTI_thread_type_get_type(p_local_xstream->p_thread->type);
308 #else
310  ABTI_xstream *p_local_xstream =
312  if (p_local_xstream) {
313  *type = ABTI_thread_type_get_type(p_local_xstream->p_thread->type);
314  } else {
315  *type = ABT_UNIT_TYPE_EXT;
316  }
317 #endif
318  return ABT_SUCCESS;
319 }
320 
358 {
359  ABTI_UB_ASSERT(is_primary);
360 
361 #ifndef ABT_CONFIG_ENABLE_VER_20_API
362  *is_primary = ABT_FALSE;
363  ABTI_SETUP_GLOBAL(NULL);
364  ABTI_ythread *p_ythread;
365  ABTI_SETUP_LOCAL_YTHREAD(NULL, &p_ythread);
366  *is_primary = (p_ythread->thread.type & ABTI_THREAD_TYPE_PRIMARY)
367  ? ABT_TRUE
368  : ABT_FALSE;
369 #else
371  ABTI_xstream *p_local_xstream =
373  if (p_local_xstream) {
374  *is_primary =
375  (p_local_xstream->p_thread->type & ABTI_THREAD_TYPE_PRIMARY)
376  ? ABT_TRUE
377  : ABT_FALSE;
378  } else {
379  *is_primary = ABT_FALSE;
380  }
381 #endif
382  return ABT_SUCCESS;
383 }
384 
421 {
422  ABTI_UB_ASSERT(on_primary);
423 
424 #ifndef ABT_CONFIG_ENABLE_VER_20_API
425  *on_primary = ABT_FALSE;
426  ABTI_SETUP_GLOBAL(NULL);
427  ABTI_xstream *p_local_xstream;
428  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
429  *on_primary = (p_local_xstream->type == ABTI_XSTREAM_TYPE_PRIMARY)
430  ? ABT_TRUE
431  : ABT_FALSE;
432 #else
434  ABTI_xstream *p_local_xstream =
436  if (p_local_xstream) {
437  *on_primary = (p_local_xstream->type == ABTI_XSTREAM_TYPE_PRIMARY)
438  ? ABT_TRUE
439  : ABT_FALSE;
440  } else {
441  *on_primary = ABT_FALSE;
442  }
443 #endif
444  return ABT_SUCCESS;
445 }
446 
469 {
471  ABTI_UB_ASSERT(pool);
472 
473  ABTI_xstream *p_local_xstream;
474  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
475  ABTI_thread *p_self = p_local_xstream->p_thread;
476  ABTI_ASSERT(p_self->p_pool);
477  *pool = ABTI_pool_get_handle(p_self->p_pool);
478  return ABT_SUCCESS;
479 }
480 
509 int ABT_self_get_last_pool_id(int *pool_id)
510 {
511  ABTI_UB_ASSERT(pool_id);
512 
513  ABTI_xstream *p_local_xstream;
514 #ifndef ABT_CONFIG_ENABLE_VER_20_API
515  *pool_id = -1;
516  ABTI_SETUP_GLOBAL(NULL);
517  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
518  ABTI_thread *p_self = p_local_xstream->p_thread;
519  ABTI_ASSERT(p_self->p_pool);
520  *pool_id = p_self->p_pool->id;
521 #else
523  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
524  ABTI_thread *p_self = p_local_xstream->p_thread;
525  ABTI_ASSERT(p_self->p_pool);
526  *pool_id = p_self->p_pool->id;
527 #endif
528  return ABT_SUCCESS;
529 }
530 
557 {
559 
560  ABTI_global *p_global = ABTI_global_get_global();
561  ABTI_xstream *p_local_xstream;
562  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
563  ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
564  ABTI_CHECK_NULL_POOL_PTR(p_pool);
565  ABTI_thread *p_self = p_local_xstream->p_thread;
566 
567  int abt_errno = ABTI_thread_set_associated_pool(p_global, p_self, p_pool);
568  ABTI_CHECK_ERROR(abt_errno);
569  return ABT_SUCCESS;
570 }
571 
594 {
596  ABTI_UB_ASSERT(unit);
597 
598  /* We don't allow an external thread to call this routine. */
599  ABTI_xstream *p_local_xstream;
600  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
601  *unit = p_local_xstream->p_thread->unit;
602  return ABT_SUCCESS;
603 }
604 
626 int ABT_self_yield(void)
627 {
629 
630  ABTI_xstream *p_local_xstream;
631  ABTI_ythread *p_ythread;
632  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_ythread);
633 
634  ABTI_ythread_yield(&p_local_xstream, p_ythread,
636  NULL);
637  return ABT_SUCCESS;
638 }
639 
674 {
676 
677  ABTI_xstream *p_local_xstream;
678  ABTI_ythread *p_cur_ythread;
679  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
680 
681  ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
682  ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
683  ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
684  ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
685  ABTI_CHECK_TRUE(p_cur_ythread != p_tar_ythread, ABT_ERR_INV_THREAD);
690 
691  /* Switch the context */
692  ABTI_ythread_yield_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
695  return ABT_SUCCESS;
696 }
697 
728 {
730 
731  ABTI_xstream *p_local_xstream;
732  ABTI_ythread *p_cur_ythread;
733  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
734 
735  ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
736  ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
737  ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
738  ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
743  ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
746 
747  /* Switch the context */
748  ABTI_ythread_resume_yield_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
751  return ABT_SUCCESS;
752 }
753 
783 int ABT_self_suspend(void)
784 {
786 
787  ABTI_xstream *p_local_xstream;
788  ABTI_ythread *p_self;
789  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_self);
790 
791  ABTI_ythread_suspend(&p_local_xstream, p_self, ABT_SYNC_EVENT_TYPE_USER,
792  NULL);
793  return ABT_SUCCESS;
794 }
795 
832 {
834 
835  ABTI_xstream *p_local_xstream;
836  ABTI_ythread *p_cur_ythread;
837  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
838 
839  ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
840  ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
841  ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
842  ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
843  ABTI_CHECK_TRUE(p_cur_ythread != p_tar_ythread, ABT_ERR_INV_THREAD);
848 
849  /* Switch the context */
850  ABTI_ythread_suspend_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
852  return ABT_SUCCESS;
853 }
854 
887 {
889 
890  ABTI_xstream *p_local_xstream;
891  ABTI_ythread *p_cur_ythread;
892  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
893 
894  ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
895  ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
896  ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
897  ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
902  ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
905 
906  /* Switch the context */
907  ABTI_ythread_resume_suspend_to(&p_local_xstream, p_cur_ythread,
908  p_tar_ythread, ABT_SYNC_EVENT_TYPE_USER,
909  NULL);
910  return ABT_SUCCESS;
911 }
912 
933 int ABT_self_exit(void)
934 {
936 
937  ABTI_xstream *p_local_xstream;
938  ABTI_ythread *p_ythread;
939  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_ythread);
942 
943  ABTI_ythread_exit(p_local_xstream, p_ythread);
944  return ABT_SUCCESS;
945 }
946 
979 int ABT_self_exit_to(ABT_thread thread)
980 {
982 
983  ABTI_xstream *p_local_xstream;
984  ABTI_ythread *p_cur_ythread;
985  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
986 
987  ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
988  ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
989  ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
990  ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
991  ABTI_CHECK_TRUE(p_cur_ythread != p_tar_ythread, ABT_ERR_INV_THREAD);
994  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type &
997 
998  /* Switch the context */
999  ABTI_ythread_exit_to(p_local_xstream, p_cur_ythread, p_tar_ythread);
1000  return ABT_SUCCESS;
1001 }
1002 
1035 
1036  ABTI_xstream *p_local_xstream;
1037  ABTI_ythread *p_cur_ythread;
1038  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
1039 
1040  ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
1041  ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
1042  ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
1043  ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
1044  ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type &
1049  ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
1052 
1053  /* Switch the context */
1054  ABTI_ythread_resume_exit_to(p_local_xstream, p_cur_ythread, p_tar_ythread);
1055  return ABT_SUCCESS;
1056 }
1057 
1087 int ABT_self_schedule(ABT_thread thread, ABT_pool pool)
1090 
1091  ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
1092  ABTI_CHECK_NULL_THREAD_PTR(p_thread);
1093  ABTI_global *p_global;
1094  ABTI_SETUP_GLOBAL(&p_global);
1095 
1096  ABTI_xstream *p_local_xstream;
1097  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, NULL);
1098 
1099  ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
1100  if (p_pool) {
1101  int abt_errno =
1102  ABTI_thread_set_associated_pool(p_global, p_thread, p_pool);
1103  ABTI_CHECK_ERROR(abt_errno);
1104  }
1105  ABTI_ythread_schedule(p_global, &p_local_xstream, p_thread);
1106  return ABT_SUCCESS;
1107 }
1108 
1138 int ABT_self_set_arg(void *arg)
1140  ABTI_xstream *p_local_xstream;
1141 #ifndef ABT_CONFIG_ENABLE_VER_20_API
1142  ABTI_SETUP_GLOBAL(NULL);
1143 #else
1145 #endif
1146  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1147 
1148  p_local_xstream->p_thread->p_arg = arg;
1149  return ABT_SUCCESS;
1150 }
1151 
1181 int ABT_self_get_arg(void **arg)
1183  ABTI_UB_ASSERT(arg);
1184 
1185  ABTI_xstream *p_local_xstream;
1186 #ifndef ABT_CONFIG_ENABLE_VER_20_API
1187  *arg = NULL;
1188  ABTI_SETUP_GLOBAL(NULL);
1189 #else
1191 #endif
1192  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1193 
1194  *arg = p_local_xstream->p_thread->p_arg;
1195  return ABT_SUCCESS;
1196 }
1197 
1219 int ABT_self_get_thread_func(void (**thread_func)(void *))
1222  ABTI_UB_ASSERT(thread_func);
1223 
1224  ABTI_xstream *p_local_xstream;
1225  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1226 
1227  *thread_func = p_local_xstream->p_thread->f_thread;
1228  return ABT_SUCCESS;
1229 }
1230 
1254 int ABT_self_is_unnamed(ABT_bool *is_unnamed)
1257  ABTI_UB_ASSERT(is_unnamed);
1258 
1259  ABTI_xstream *p_local_xstream;
1260  ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1261 
1262  *is_unnamed = (p_local_xstream->p_thread->type & ABTI_THREAD_TYPE_NAMED)
1263  ? ABT_FALSE
1264  : ABT_TRUE;
1265  return ABT_SUCCESS;
1266 }
ABTI_key
Definition: abti.h:461
ABT_SYNC_EVENT_TYPE_USER
@ ABT_SYNC_EVENT_TYPE_USER
Definition: abt.h:700
ABT_key
struct ABT_key_opaque * ABT_key
Work-unit-specific data key handle type.
Definition: abt.h:980
ABT_ERR_INV_THREAD
#define ABT_ERR_INV_THREAD
Error code: invalid work unit.
Definition: abt.h:186
ABT_self_resume_suspend_to
int ABT_self_resume_suspend_to(ABT_thread thread)
Suspend the calling ULT and jump to another suspended ULT.
Definition: self.c:887
ABT_self_schedule
int ABT_self_schedule(ABT_thread thread, ABT_pool pool)
Execute a work unit on the calling ULT.
Definition: self.c:1088
ABT_bool
int ABT_bool
Boolean type.
Definition: abt.h:1043
ABTI_XSTREAM_TYPE_PRIMARY
@ ABTI_XSTREAM_TYPE_PRIMARY
Definition: abti.h:66
ABTI_SETUP_LOCAL_XSTREAM
#define ABTI_SETUP_LOCAL_XSTREAM(pp_local_xstream)
Definition: abti_error.h:89
ABTI_ktable_get
static void * ABTI_ktable_get(ABTD_atomic_ptr *pp_ktable, ABTI_key *p_key)
Definition: abti_key.h:287
ABT_self_get_arg
int ABT_self_get_arg(void **arg)
Retrieve an argument for a work-unit function of the calling work unit.
Definition: self.c:1182
ABT_thread
struct ABT_thread_opaque * ABT_thread
Work unit handle type.
Definition: abt.h:932
ABTI_key_get_ptr
static ABTI_key * ABTI_key_get_ptr(ABT_key key)
Definition: abti_key.h:11
ABTI_SETUP_GLOBAL
#define ABTI_SETUP_GLOBAL(pp_global)
Definition: abti_error.h:75
ABT_self_get_thread_func
int ABT_self_get_thread_func(void(**thread_func)(void *))
Retrieve a work-unit function of the calling work unit.
Definition: self.c:1220
ABT_ERR_INV_XSTREAM
#define ABT_ERR_INV_XSTREAM
Error code: invalid execution stream.
Definition: abt.h:114
ABTI_thread::type
ABTI_thread_type type
Definition: abti.h:426
ABTI_global_get_global
static ABTI_global * ABTI_global_get_global(void)
Definition: abti_global.h:9
ABTI_CHECK_ERROR
#define ABTI_CHECK_ERROR(abt_errno)
Definition: abti_error.h:136
ABT_self_suspend_to
int ABT_self_suspend_to(ABT_thread thread)
Suspend the calling ULT and jump to another ULT.
Definition: self.c:832
ABTI_xstream::rank
int rank
Definition: abti.h:299
ABTI_xstream::type
ABTI_xstream_type type
Definition: abti.h:300
ABTI_thread_get_id
ABT_unit_id ABTI_thread_get_id(ABTI_thread *p_thread)
Definition: thread.c:2803
ABTI_thread_get_handle
static ABT_thread ABTI_thread_get_handle(ABTI_thread *p_thread)
Definition: abti_thread.h:24
ABTI_thread_set_associated_pool
static ABTU_ret_err int ABTI_thread_set_associated_pool(ABTI_global *p_global, ABTI_thread *p_thread, ABTI_pool *p_pool)
Definition: abti_unit.h:155
ABT_self_get_thread
int ABT_self_get_thread(ABT_thread *thread)
Get the calling work unit.
Definition: self.c:101
ABTI_thread
Definition: abti.h:422
ABT_self_get_last_pool
int ABT_self_get_last_pool(ABT_pool *pool)
Get the last pool of the calling work unit.
Definition: self.c:468
ABT_self_set_specific
int ABT_self_set_specific(ABT_key key, void *value)
Associate a value with a work-unit-specific data key in the calling work unit.
Definition: self.c:191
ABTI_xstream
Definition: abti.h:294
ABT_self_get_task
int ABT_self_get_task(ABT_thread *thread)
Get the calling work unit.
ABT_pool
struct ABT_pool_opaque * ABT_pool
Pool handle type.
Definition: abt.h:878
ABTI_ktable_set
static ABTU_ret_err int ABTI_ktable_set(ABTI_global *p_global, ABTI_local *p_local, ABTD_atomic_ptr *pp_ktable, ABTI_key *p_key, void *value)
Definition: abti_key.h:225
ABTI_thread_type_get_type
static ABT_unit_type ABTI_thread_type_get_type(ABTI_thread_type type)
Definition: abti_thread.h:41
ABTI_pool
Definition: abti.h:389
ABTI_THREAD_TYPE_PRIMARY
#define ABTI_THREAD_TYPE_PRIMARY
Definition: abti.h:85
ABTI_xstream_get_handle
static ABT_xstream ABTI_xstream_get_handle(ABTI_xstream *p_xstream)
Definition: abti_stream.h:26
ABT_THREAD_STATE_BLOCKED
@ ABT_THREAD_STATE_BLOCKED
Definition: abt.h:431
abti.h
ABTI_CHECK_NULL_THREAD_PTR
#define ABTI_CHECK_NULL_THREAD_PTR(p)
Definition: abti_error.h:229
ABT_self_on_primary_xstream
int ABT_self_on_primary_xstream(ABT_bool *on_primary)
Check if the caller is running on the primary execution stream.
Definition: self.c:420
ABT_unit_id
uint64_t ABT_unit_id
Work unit ID type.
Definition: abt.h:921
ABT_xstream
struct ABT_xstream_opaque * ABT_xstream
Execution stream handle type.
Definition: abt.h:826
ABTI_thread_get_ythread_or_null
static ABTI_ythread * ABTI_thread_get_ythread_or_null(ABTI_thread *p_thread)
Definition: abti_thread.h:59
ABTI_thread::state
ABTD_atomic_int state
Definition: abti.h:432
ABT_self_suspend
int ABT_self_suspend(void)
Suspend the calling ULT.
Definition: self.c:784
ABT_unit_type
ABT_unit_type
Type of a work unit for scheduling.
Definition: abt.h:582
ABT_self_set_associated_pool
int ABT_self_set_associated_pool(ABT_pool pool)
Set an associated pool for the calling work unit.
Definition: self.c:556
ABT_self_get_last_pool_id
int ABT_self_get_last_pool_id(int *pool_id)
Get ID of the last pool of the calling work unit.
Definition: self.c:509
ABTI_YTHREAD_RESUME_YIELD_TO_KIND_USER
@ ABTI_YTHREAD_RESUME_YIELD_TO_KIND_USER
Definition: abti_ythread.h:325
ABT_self_is_primary
int ABT_self_is_primary(ABT_bool *is_primary)
Check if the caller is the primary ULT.
Definition: self.c:357
ABT_unit
struct ABT_unit_opaque * ABT_unit
Work unit handle type for scheduling.
Definition: abt.h:911
ABTI_ASSERT
#define ABTI_ASSERT(cond)
Definition: abti_error.h:12
ABTI_initialized
ABT_bool ABTI_initialized(void)
Definition: global.c:187
ABTI_local_get_local
static ABTI_local * ABTI_local_get_local(void)
Definition: abti_local.h:41
ABTI_CHECK_NULL_YTHREAD_PTR
#define ABTI_CHECK_NULL_YTHREAD_PTR(p)
Definition: abti_error.h:238
ABT_self_yield_to
int ABT_self_yield_to(ABT_thread thread)
Yield the calling ULT to another ULT.
Definition: self.c:673
ABT_self_exit
int ABT_self_exit(void)
Terminate a calling ULT.
Definition: self.c:934
ABT_SUCCESS
#define ABT_SUCCESS
Error code: the routine returns successfully.
Definition: abt.h:92
ABTI_ythread_schedule
static void ABTI_ythread_schedule(ABTI_global *p_global, ABTI_xstream **pp_local_xstream, ABTI_thread *p_thread)
Definition: abti_ythread.h:650
ABTI_ythread_resume_yield_to
static void ABTI_ythread_resume_yield_to(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABTI_ythread *p_target, ABTI_ythread_resume_yield_to_kind kind, ABT_sync_event_type sync_event_type, void *p_sync)
Definition: abti_ythread.h:329
ABT_self_exit_to
int ABT_self_exit_to(ABT_thread thread)
Terminate the calling ULT and jump to another ULT.
Definition: self.c:980
ABTI_SETUP_LOCAL_YTHREAD
#define ABTI_SETUP_LOCAL_YTHREAD(pp_local_xstream, pp_ythread)
Definition: abti_error.h:104
ABTD_atomic_acquire_load_int
static int ABTD_atomic_acquire_load_int(const ABTD_atomic_int *ptr)
Definition: abtd_atomic.h:878
ABTI_ythread_yield
static void ABTI_ythread_yield(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABTI_ythread_yield_kind kind, ABT_sync_event_type sync_event_type, void *p_sync)
Definition: abti_ythread.h:254
ABTI_local_get_xstream_or_null
static ABTI_xstream * ABTI_local_get_xstream_or_null(ABTI_local *p_local)
Definition: abti_local.h:77
ABT_self_get_specific
int ABT_self_get_specific(ABT_key key, void **value)
Get a value associated with a work-unit-specific data key in the calling work unit.
Definition: self.c:240
ABTI_xstream_get_local
static ABTI_local * ABTI_xstream_get_local(ABTI_xstream *p_xstream)
Definition: abti_stream.h:48
ABT_self_set_arg
int ABT_self_set_arg(void *arg)
Set an argument for a work-unit function of the calling work unit.
Definition: self.c:1139
ABT_TRUE
#define ABT_TRUE
True constant for ABT_bool.
Definition: abt.h:784
ABTI_pool_get_ptr
static ABTI_pool * ABTI_pool_get_ptr(ABT_pool pool)
Definition: abti_pool.h:11
ABTI_ythread_exit
static ABTU_noreturn void ABTI_ythread_exit(ABTI_xstream *p_local_xstream, ABTI_ythread *p_self)
Definition: abti_ythread.h:460
ABT_FALSE
#define ABT_FALSE
False constant for ABT_bool.
Definition: abt.h:786
ABTI_ythread
Definition: abti.h:456
ABTI_ythread_suspend_to
static void ABTI_ythread_suspend_to(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABTI_ythread *p_target, ABT_sync_event_type sync_event_type, void *p_sync)
Definition: abti_ythread.h:366
ABTI_YTHREAD_YIELD_TO_KIND_USER
@ ABTI_YTHREAD_YIELD_TO_KIND_USER
Definition: abti_ythread.h:243
ABT_self_get_task_id
int ABT_self_get_task_id(ABT_unit_id *id)
Get ID of the calling work unit.
ABTI_THREAD_TYPE_MAIN_SCHED
#define ABTI_THREAD_TYPE_MAIN_SCHED
Definition: abti.h:86
ABTI_UB_ASSERT
#define ABTI_UB_ASSERT(cond)
Definition: abti_error.h:19
ABTI_CHECK_NULL_POOL_PTR
#define ABTI_CHECK_NULL_POOL_PTR(p)
Definition: abti_error.h:184
ABT_self_resume_yield_to
int ABT_self_resume_yield_to(ABT_thread thread)
Yield the calling ULT to another suspended ULT.
Definition: self.c:727
ABTI_YTHREAD_YIELD_KIND_USER
@ ABTI_YTHREAD_YIELD_KIND_USER
Definition: abti_ythread.h:238
ABTI_THREAD_TYPE_NAMED
#define ABTI_THREAD_TYPE_NAMED
Definition: abti.h:88
ABT_self_yield
int ABT_self_yield(void)
Yield the calling ULT to its parent ULT.
Definition: self.c:626
ABT_self_get_xstream_rank
int ABT_self_get_xstream_rank(int *rank)
Return a rank of an execution stream that is running the calling work unit.
Definition: self.c:68
ABTI_ythread::thread
ABTI_thread thread
Definition: abti.h:457
ABTI_ythread_yield_to
static void ABTI_ythread_yield_to(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABTI_ythread *p_target, ABTI_ythread_yield_to_kind kind, ABT_sync_event_type sync_event_type, void *p_sync)
Definition: abti_ythread.h:275
ABT_self_get_unit
int ABT_self_get_unit(ABT_unit *unit)
Get a unit handle of the calling work unit.
Definition: self.c:593
ABTI_pool::id
uint64_t id
Definition: abti.h:397
ABTI_CHECK_TRUE
#define ABTI_CHECK_TRUE(cond, abt_errno)
Definition: abti_error.h:146
ABT_self_get_type
int ABT_self_get_type(ABT_unit_type *type)
Obtain a type of the caller.
Definition: self.c:291
ABTI_CHECK_NULL_KEY_PTR
#define ABTI_CHECK_NULL_KEY_PTR(p)
Definition: abti_error.h:265
ABTI_global
Definition: abti.h:223
ABTI_ythread_suspend
static void ABTI_ythread_suspend(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABT_sync_event_type sync_event_type, void *p_sync)
Definition: abti_ythread.h:353
ABT_self_is_unnamed
int ABT_self_is_unnamed(ABT_bool *is_unnamed)
Check if the calling work unit is unnamed.
Definition: self.c:1255
ABTI_thread::p_pool
ABTI_pool * p_pool
Definition: abti.h:434
ABTI_ythread_resume_suspend_to
static void ABTI_ythread_resume_suspend_to(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABTI_ythread *p_target, ABT_sync_event_type sync_event_type, void *p_sync)
Definition: abti_ythread.h:387
ABTI_ythread_exit_to
static ABTU_noreturn void ABTI_ythread_exit_to(ABTI_xstream *p_local_xstream, ABTI_ythread *p_self, ABTI_ythread *p_target)
Definition: abti_ythread.h:511
ABTI_thread_get_ptr
static ABTI_thread * ABTI_thread_get_ptr(ABT_thread thread)
Definition: abti_thread.h:9
ABTI_pool_get_handle
static ABT_pool ABTI_pool_get_handle(ABTI_pool *p_pool)
Definition: abti_pool.h:26
ABT_UNIT_TYPE_EXT
@ ABT_UNIT_TYPE_EXT
Definition: abt.h:594
ABT_self_get_xstream
int ABT_self_get_xstream(ABT_xstream *xstream)
Get an execution stream that is running the calling work unit.
Definition: self.c:33
ABT_self_get_thread_id
int ABT_self_get_thread_id(ABT_unit_id *id)
Get ID of the calling work unit.
Definition: self.c:133
ABTI_ythread_resume_exit_to
static ABTU_noreturn void ABTI_ythread_resume_exit_to(ABTI_xstream *p_local_xstream, ABTI_ythread *p_self, ABTI_ythread *p_target)
Definition: abti_ythread.h:552
ABT_self_resume_exit_to
int ABT_self_resume_exit_to(ABT_thread thread)
Terminate the calling ULT and jump to another suspended ULT.
Definition: self.c:1033