Commit cddd1cfd authored by Philip Carns's avatar Philip Carns
Browse files

parameter for # concurrent threads

parent 232599a4
......@@ -17,8 +17,6 @@
#include <abt-io.h>
#include <abt-snoozer.h>
#define INFLIGHT_LIMIT 64
struct worker_ult_common
{
int opt_io;
......@@ -31,6 +29,7 @@ struct worker_ult_common
ABT_cond cond;
ABT_mutex mutex;
int completed;
int inflight_threads;
};
struct worker_ult_arg
......@@ -59,9 +58,9 @@ int main(int argc, char **argv)
struct worker_ult_common common;
int *done;
if(argc != 9)
if(argc != 10)
{
fprintf(stderr, "Usage: abt-io-overlap <compute> <io> <abt_io 0|1> <abt_snoozer 0|1> <unit_size> <num_units> <compute_es_count> <io_es_count>\n");
fprintf(stderr, "Usage: abt-io-overlap <compute> <io> <abt_io 0|1> <abt_snoozer 0|1> <unit_size> <num_units> <compute_es_count> <io_es_count> <inflight_threads>\n");
return(-1);
}
......@@ -82,6 +81,8 @@ int main(int argc, char **argv)
assert(ret == 1);
ret = sscanf(argv[8], "%d", &io_es_count);
assert(ret == 1);
ret = sscanf(argv[9], "%d", &common.inflight_threads);
assert(ret == 1);
io_xstreams = malloc(io_es_count * sizeof(*io_xstreams));
assert(io_xstreams);
......@@ -147,7 +148,7 @@ int main(int argc, char **argv)
for(i=0; i<common.opt_num_units; i++)
{
ABT_mutex_lock(common.mutex);
while((i + 1 - common.completed) >= INFLIGHT_LIMIT)
while((i + 1 - common.completed) >= common.inflight_threads)
ABT_cond_wait(common.cond, common.mutex);
ABT_mutex_unlock(common.mutex);
......
......@@ -14,8 +14,6 @@
#include <errno.h>
#include <pthread.h>
#define INFLIGHT_LIMIT 64
struct worker_pthread_common
{
int opt_io;
......@@ -25,6 +23,7 @@ struct worker_pthread_common
pthread_cond_t cond;
pthread_mutex_t mutex;
int completed;
int inflight_threads;
};
struct worker_pthread_arg
......@@ -47,9 +46,9 @@ int main(int argc, char **argv)
pthread_attr_t attr;
pthread_t tid;
if(argc != 5)
if(argc != 6)
{
fprintf(stderr, "Usage: pthread-overlap <compute> <io> <unit_size> <num_units>\n");
fprintf(stderr, "Usage: pthread-overlap <compute> <io> <unit_size> <num_units> <inflight_threads>\n");
return(-1);
}
......@@ -62,6 +61,8 @@ int main(int argc, char **argv)
assert(common.opt_unit_size % 4096 == 0);
ret = sscanf(argv[4], "%d", &common.opt_num_units);
assert(ret == 1);
ret = sscanf(argv[5], "%d", &common.inflight_threads);
assert(ret == 1);
pthread_cond_init(&common.cond, NULL);
pthread_mutex_init(&common.mutex, NULL);
......@@ -86,7 +87,7 @@ int main(int argc, char **argv)
for(i=0; i<common.opt_num_units; i++)
{
pthread_mutex_lock(&common.mutex);
while((i + 1 - common.completed) >= INFLIGHT_LIMIT)
while((i + 1 - common.completed) >= common.inflight_threads)
pthread_cond_wait(&common.cond, &common.mutex);
pthread_mutex_unlock(&common.mutex);
......
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