Commit 4a420229 authored by Philip Carns's avatar Philip Carns
Browse files

modifications to use joins rather than eventuals

- just in benchmark
- probably should be create|join_many
- will revisit later, keeping eventuals in trunk instead of joins
parent 1b7340ed
......@@ -30,8 +30,6 @@ struct worker_ult_arg
ABT_cond cond;
ABT_mutex mutex;
int inflight;
int completed;
ABT_eventual eventual;
};
static void worker_ult(void *_arg);
......@@ -52,6 +50,7 @@ int main(int argc, char **argv)
int compute_es_count = -1;
struct worker_ult_arg arg;
int *done;
ABT_thread* tid_array;
if(argc != 8)
{
......@@ -81,6 +80,9 @@ int main(int argc, char **argv)
compute_xstreams = malloc(compute_es_count * sizeof(*compute_xstreams));
assert(compute_xstreams);
tid_array = malloc(arg.opt_num_units * sizeof(*tid_array));
assert(tid_array);
/* set up argobots */
ret = ABT_init(argc, argv);
assert(ret == 0);
......@@ -122,7 +124,6 @@ int main(int argc, char **argv)
ABT_cond_create(&arg.cond);
ABT_mutex_create(&arg.mutex);
ABT_eventual_create(sizeof(*done), &arg.eventual);
arg.inflight = 0;
start = wtime();
......@@ -130,15 +131,23 @@ int main(int argc, char **argv)
for(i=0; i<arg.opt_num_units; i++)
{
/* create ULTs */
ret = ABT_thread_create(compute_pool, worker_ult, &arg, ABT_THREAD_ATTR_NULL, NULL);
ret = ABT_thread_create(compute_pool, worker_ult, &arg, ABT_THREAD_ATTR_NULL, &tid_array[i]);
assert(ret == 0);
}
ABT_eventual_wait(arg.eventual, (void**)&done);
for(i=0; i<arg.opt_num_units; i++)
{
ABT_thread_join(tid_array[i]);
}
end = wtime();
seconds = end-start;
for(i=0; i<arg.opt_num_units; i++)
{
ABT_thread_free(&tid_array[i]);
}
/* wait on the compute ESs to complete */
for(i=0; i<compute_es_count; i++)
......@@ -249,12 +258,8 @@ static void worker_ult(void *_arg)
ABT_mutex_lock(arg->mutex);
arg->inflight--;
ABT_cond_signal(arg->cond);
arg->completed++;
ABT_mutex_unlock(arg->mutex);
if(arg->completed == arg->opt_num_units)
ABT_eventual_set(arg->eventual, &done, sizeof(done));
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment