File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
#ifndef LIBCIRCLE_H
2
2
#define LIBCIRCLE_H
3
3
4
+ #include <stdint.h>
5
+
4
6
/* define a C interface */
5
7
#ifdef __cplusplus
6
8
extern "C" {
7
9
#endif
8
10
9
- #include <stdint.h>
10
-
11
11
/**
12
12
* The maximum length of a string value which is allowed to be placed on the
13
13
* queue structure.
@@ -22,8 +22,9 @@ extern "C" {
22
22
* Run time flags for the behavior of splitting work.
23
23
*/
24
24
#define CIRCLE_SPLIT_RANDOM (1 << 0) /* Split work randomly. */
25
- #define CIRCLE_SPLIT_EQUAL ~CIRCLE_SPLIT_RANDOM /* Split work evenly */
26
- #define CIRCLE_DEFAULT_FLAGS CIRCLE_SPLIT_RANDOM /* Default behavior is random work stealing */
25
+ #define CIRCLE_SPLIT_EQUAL (1 << 1) /* Split work evenly */
26
+ #define CIRCLE_CREATE_GLOBAL (1 << 2) /* Call create callback on all procs */
27
+ #define CIRCLE_DEFAULT_FLAGS CIRCLE_SPLIT_EQUAL /* Default behavior is random work stealing */
27
28
28
29
/**
29
30
* The various logging levels that libcircle will output.
Original file line number Diff line number Diff line change @@ -347,11 +347,17 @@ int8_t CIRCLE_worker()
347
347
LOG (CIRCLE_LOG_DBG , "Using randomized load splitting." );
348
348
}
349
349
350
+ /* start the termination token on rank 0 */
350
351
if (rank == 0 ) {
351
- (* (CIRCLE_INPUT_ST .create_cb ))(& queue_handle );
352
352
local_state .have_token = 1 ;
353
353
}
354
354
355
+ /* start by adding work to queue by calling create_cb,
356
+ * only invoke on master unless CREATE_GLOBAL is set */
357
+ if (rank == 0 || CIRCLE_INPUT_ST .options & CIRCLE_CREATE_GLOBAL ) {
358
+ (* (CIRCLE_INPUT_ST .create_cb ))(& queue_handle );
359
+ }
360
+
355
361
CIRCLE_work_loop (sptr , & queue_handle );
356
362
CIRCLE_cleanup_mpi_messages (sptr );
357
363
You can’t perform that action at this time.
0 commit comments