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 {
35  ABTI_UB_ASSERT(ABTI_initialized());
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 {
70  ABTI_UB_ASSERT(ABTI_initialized());
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 {
103  ABTI_UB_ASSERT(ABTI_initialized());
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 {
135  ABTI_UB_ASSERT(ABTI_initialized());
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 {
193  ABTI_UB_ASSERT(ABTI_initialized());
194 
195  ABTI_key *p_key = ABTI_key_get_ptr(key);
196  ABTI_CHECK_NULL_KEY_PTR(p_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 {
242  ABTI_UB_ASSERT(ABTI_initialized());
243  ABTI_UB_ASSERT(value);
244 
245  ABTI_key *p_key = ABTI_key_get_ptr(key);
246  ABTI_CHECK_NULL_KEY_PTR(p_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 =
303  ABTI_local_get_xstream_or_null(ABTI_local_get_local());
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
309  ABTI_UB_ASSERT(ABTI_initialized());
310  ABTI_xstream *p_local_xstream =
311  ABTI_local_get_xstream_or_null(ABTI_local_get_local());
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
370  ABTI_UB_ASSERT(ABTI_initialized());
371  ABTI_xstream *p_local_xstream =
372  ABTI_local_get_xstream_or_null(ABTI_local_get_local());
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
433  ABTI_UB_ASSERT(ABTI_initialized());
434  ABTI_xstream *p_local_xstream =
435  ABTI_local_get_xstream_or_null(ABTI_local_get_local());
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 {
470  ABTI_UB_ASSERT(ABTI_initialized());
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
522  ABTI_UB_ASSERT(ABTI_initialized());
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 {
558  ABTI_UB_ASSERT(ABTI_initialized());
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 {
595  ABTI_UB_ASSERT(ABTI_initialized());
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 {
628  ABTI_UB_ASSERT(ABTI_initialized());
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,
635  ABTI_YTHREAD_YIELD_KIND_USER, ABT_SYNC_EVENT_TYPE_USER,
636  NULL);
637  return ABT_SUCCESS;
638 }
639 
674 {
675  ABTI_UB_ASSERT(ABTI_initialized());
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);
686  ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
688  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
690 
691  /* Switch the context */
692  ABTI_ythread_yield_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
693  ABTI_YTHREAD_YIELD_TO_KIND_USER,
695  return ABT_SUCCESS;
696 }
697 
728 {
729  ABTI_UB_ASSERT(ABTI_initialized());
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);
739  ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
741  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
743  ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
744  ABTI_UB_ASSERT(ABTD_atomic_acquire_load_int(&p_tar_ythread->thread.state) ==
746 
747  /* Switch the context */
748  ABTI_ythread_resume_yield_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
749  ABTI_YTHREAD_RESUME_YIELD_TO_KIND_USER,
751  return ABT_SUCCESS;
752 }
753 
783 int ABT_self_suspend(void)
784 {
785  ABTI_UB_ASSERT(ABTI_initialized());
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 {
833  ABTI_UB_ASSERT(ABTI_initialized());
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);
844  ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
846  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
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 {
888  ABTI_UB_ASSERT(ABTI_initialized());
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);
898  ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
900  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
902  ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
903  ABTI_UB_ASSERT(ABTD_atomic_acquire_load_int(&p_tar_ythread->thread.state) ==
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 {
935  ABTI_UB_ASSERT(ABTI_initialized());
936 
937  ABTI_xstream *p_local_xstream;
938  ABTI_ythread *p_ythread;
939  ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_ythread);
940  ABTI_CHECK_TRUE(!(p_ythread->thread.type & ABTI_THREAD_TYPE_PRIMARY),
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 {
981  ABTI_UB_ASSERT(ABTI_initialized());
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);
992  ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
994  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type &
995  (ABTI_THREAD_TYPE_MAIN_SCHED | ABTI_THREAD_TYPE_PRIMARY)),
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 
1034  ABTI_UB_ASSERT(ABTI_initialized());
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 &
1045  (ABTI_THREAD_TYPE_PRIMARY | ABTI_THREAD_TYPE_MAIN_SCHED)),
1047  ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
1049  ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
1050  ABTI_UB_ASSERT(ABTD_atomic_acquire_load_int(&p_tar_ythread->thread.state) ==
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)
1089  ABTI_UB_ASSERT(ABTI_initialized());
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
1144  ABTI_UB_ASSERT(ABTI_initialized());
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
1190  ABTI_UB_ASSERT(ABTI_initialized());
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 *))
1221  ABTI_UB_ASSERT(ABTI_initialized());
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)
1256  ABTI_UB_ASSERT(ABTI_initialized());
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 }
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
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
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
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
ABT_self_get_thread
int ABT_self_get_thread(ABT_thread *thread)
Get the calling work unit.
Definition: self.c:101
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
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
ABT_THREAD_STATE_BLOCKED
@ ABT_THREAD_STATE_BLOCKED
Definition: abt.h:431
abti.h
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
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
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
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
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
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
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
ABT_FALSE
#define ABT_FALSE
False constant for ABT_bool.
Definition: abt.h:786
ABT_self_get_task_id
int ABT_self_get_task_id(ABT_unit_id *id)
Get ID of the calling work unit.
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
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
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
ABT_self_get_type
int ABT_self_get_type(ABT_unit_type *type)
Obtain a type of the caller.
Definition: self.c:291
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
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
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