62 ABTI_sched_config *p_config;
65 size_t alloc_size = 8 *
sizeof(size_t);
68 size_t offset =
sizeof(num_params);
70 size_t buffer_size = alloc_size;
74 va_start(varg_list, config);
80 if (var.
idx == ABT_sched_config_var_end.
idx)
87 size_t size = ABTI_sched_config_type_size(type);
88 if (offset +
sizeof(param) +
sizeof(type) + size > buffer_size) {
89 size_t cur_buffer_size = buffer_size;
90 buffer_size += alloc_size;
91 buffer =
ABTU_realloc(buffer, cur_buffer_size, buffer_size);
94 memcpy(buffer + offset, (
void *)¶m,
sizeof(param));
95 offset +=
sizeof(param);
98 memcpy(buffer + offset, (
void *)&size,
sizeof(size));
99 offset +=
sizeof(size);
108 i = va_arg(varg_list,
int);
112 d = va_arg(varg_list,
double);
116 p = va_arg(varg_list,
void *);
124 memcpy(buffer + offset, ptr, size);
130 memcpy(buffer, (
int *)&num_params,
sizeof(num_params));
136 p_config = (ABTI_sched_config *)buffer;
137 *config = ABTI_sched_config_get_handle(p_config);
168 void **variables = (
void *)
ABTU_malloc(num_vars *
sizeof(
void *));
170 va_start(varg_list, num_vars);
171 for (v = 0; v < num_vars; v++) {
172 variables[v] = va_arg(varg_list,
void *);
176 abt_errno = ABTI_sched_config_read(config, 1, num_vars, variables);
177 ABTI_CHECK_ERROR(abt_errno);
199 ABTI_sched_config *p_config = ABTI_sched_config_get_ptr(*config);
213 return sizeof(double);
215 return sizeof(
void *);
229 int automatic_i = -1;
231 void **variables = (
void **)
ABTU_malloc(num_vars *
sizeof(
void *));
232 variables[(ABT_sched_config_access.
idx + 2) * (-1)] = &access_i;
233 variables[(ABT_sched_config_automatic.
idx + 2) * (-1)] = &automatic_i;
235 abt_errno = ABTI_sched_config_read(config, 0, num_vars, variables);
237 ABTI_CHECK_ERROR(abt_errno);
241 if (automatic_i != -1)
263 ABTI_sched_config *p_config = ABTI_sched_config_get_ptr(config);
265 char *buffer = (
char *)p_config;
268 memcpy(&num_params, buffer,
sizeof(num_params));
269 offset +=
sizeof(num_params);
273 for (p = 0; p < num_params; p++) {
278 memcpy(&var_idx, buffer + offset,
sizeof(var_idx));
279 offset +=
sizeof(var_idx);
281 memcpy(&size, buffer + offset,
sizeof(size));
282 offset +=
sizeof(size);
290 var_idx = (var_idx + 2) * -1;
291 if (var_idx >= num_vars)
293 memcpy(variables[var_idx], buffer + offset, size);
297 if (var_idx >= num_vars)
299 memcpy(variables[var_idx], buffer + offset, size);
#define ABT_ERR_INV_SCHED_CONFIG
ABT_sched_config_var ABT_sched_config_automatic
ABT_sched_config_var ABT_sched_config_access
static void * ABTU_malloc(size_t size)
int ABT_sched_config_read(ABT_sched_config config, int num_vars,...)
Copy the set values from config into the variables passed in the dynamic list of arguments.
ABT_sched_config_type type
#define HANDLE_ERROR_FUNC_WITH_CODE(n)
static void * ABTU_realloc(void *ptr, size_t old_size, size_t new_size)
int ABT_sched_config_free(ABT_sched_config *config)
Free the configuration.
#define ABT_ERR_SCHED_CONFIG
struct ABT_sched_config_opaque * ABT_sched_config
int ABT_sched_config_create(ABT_sched_config *config,...)
Create a scheduler configuration.
#define ABT_SCHED_CONFIG_NULL
ABT_sched_config_var ABT_sched_config_var_end
static void ABTU_free(void *ptr)