Commit 0f9d4a1f authored by Matthieu Dorier's avatar Matthieu Dorier

done testing and debugging xfer ULTs

parent 0ada529c
......@@ -1039,16 +1039,16 @@ static void bake_create_write_persist_ult(hg_handle_t handle)
current_size = current_size > remaining_size ? remaining_size : current_size;
args->mid = mid;
args->size = current_size;
args->target = memory + current_offset;
args->buf_size = xfer_buf_size;
args->buf_pool = entry->xfer_bulk_pool;
args->remote_addr = src_addr;
args->remote_bulk = in.bulk_handle;
args->remote_offset = current_offset;
args->op_type = HG_BULK_PULL;
args->ret = 0;
args[i].mid = mid;
args[i].size = current_size;
args[i].target = memory + current_offset;
args[i].buf_size = xfer_buf_size;
args[i].buf_pool = entry->xfer_bulk_pool;
args[i].remote_addr = src_addr;
args[i].remote_bulk = in.bulk_handle;
args[i].remote_offset = current_offset;
args[i].op_type = HG_BULK_PULL;
args[i].ret = 0;
ABT_thread_create(handler_pool, (void (*)(void*))xfer_ult, args+i, ABT_THREAD_ATTR_NULL, ults+i);
......@@ -1911,13 +1911,16 @@ static void xfer_ult(xfer_args* args)
margo_bulk_pool_t buf_pool;
hg_addr_t remote_addr;
hg_bulk_t remote_bulk;
hg_bulk_t remote_offset;
hg_size_t remote_offset;
int32_t op_type;
int32_t ret;
} xfer_args;
*/
hg_bulk_t local_bulk = HG_BULK_NULL;
fprintf(stderr,"xfer_ult: size=%ld, remote_offset=%ld, buf_size=%ld\n", args->size, args->remote_offset, args->buf_size);
ABT_thread_yield();
// (1) compute how many iterations must be done
size_t num_xfers = args->size / args->buf_size;
if(num_xfers * args->buf_size < args->size)
......@@ -1980,6 +1983,7 @@ static void xfer_ult(xfer_args* args)
// (9) update the current offset
current_offset += current_size;
remaining_size -= current_size;
}
args->ret = 0;
......
......@@ -15,6 +15,7 @@ TESTS += \
tests/create-write-persist-remove.sh
EXTRA_DIST += \
tests/lorem.txt \
tests/basic.sh \
tests/copy-to-and-from.sh \
tests/copy-to-and-from-multi-providers.sh \
......
......@@ -86,6 +86,7 @@ int main(int argc, char *argv[])
margo_finalize(mid);
return(-1);
}
bake_provider_handle_set_eager_limit(bph, 0);
/* obtain info on the server's BAKE target */
ret = bake_probe(bph, 1, &bti, &num_targets);
......
......@@ -13,8 +13,7 @@
#include "bake-client.h"
#define ALLOC_BUF_SIZE 512
static char* read_input_file(const char* filename);
int main(int argc, char *argv[])
{
......@@ -29,20 +28,23 @@ int main(int argc, char *argv[])
uint64_t num_targets;
bake_target_id_t bti;
bake_region_id_t the_rid;
const char *test_str = "This is a test string for create-write-persist test.";
char *test_str = NULL;
char *buf;
uint64_t buf_size;
hg_return_t hret;
int ret;
if(argc != 3)
if(argc != 4)
{
fprintf(stderr, "Usage: create-write-persist-test <bake server addr> <mplex id>\n");
fprintf(stderr, "Usage: create-write-persist-test <input file> <bake server addr> <mplex id>\n");
fprintf(stderr, " Example: ./create-write-persist-test tcp://localhost:1234 1\n");
return(-1);
}
bake_svr_addr_str = argv[1];
mplex_id = atoi(argv[2]);
char* input_file = argv[1];
bake_svr_addr_str = argv[2];
mplex_id = atoi(argv[3]);
test_str = read_input_file(input_file);
/* initialize Margo using the transport portion of the server
* address (i.e., the part before the first : character if present)
......@@ -86,6 +88,7 @@ int main(int argc, char *argv[])
margo_finalize(mid);
return(-1);
}
bake_provider_handle_set_eager_limit(bph, 0);
/* obtain info on the server's BAKE target */
ret = bake_probe(bph, 1, &bti, &num_targets);
......@@ -99,27 +102,13 @@ int main(int argc, char *argv[])
return(-1);
}
buf = malloc(ALLOC_BUF_SIZE);
if(!buf)
{
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
return(-1);
}
/**** write phase ****/
/* copy the test string into a buffer and forward to the proxy server */
strcpy(buf, test_str);
buf_size = strlen(test_str) + 1;
ret = bake_create_write_persist(bph, bti, buf, buf_size, &the_rid);
ret = bake_create_write_persist(bph, bti, test_str, buf_size, &the_rid);
if(ret != 0)
{
fprintf(stderr, "Error: bake_create_write_persist()\n");
free(buf);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
......@@ -129,8 +118,8 @@ int main(int argc, char *argv[])
/**** read-back phase ****/
/* reset the buffer and read it back via BAKE */
memset(buf, 0, ALLOC_BUF_SIZE);
buf = malloc(buf_size);
memset(buf, 0, buf_size);
uint64_t bytes_read;
ret = bake_read(bph, the_rid, 0, buf, buf_size, &bytes_read);
......@@ -163,6 +152,7 @@ int main(int argc, char *argv[])
/**** cleanup ****/
free(buf);
free(test_str);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
......@@ -170,3 +160,17 @@ int main(int argc, char *argv[])
return(ret);
}
static char* read_input_file(const char* filename) {
FILE* fp = fopen(filename, "r");
if(fp == NULL) {
fprintf(stderr, "Could not open %s\n", filename);
exit(-1);
}
fseek(fp, 0, SEEK_END);
size_t sz = ftell(fp);
fseek(fp, 0, SEEK_SET);
char* buf = calloc(1,sz+1);
fread(buf, 1, sz, fp);
fclose(fp);
return buf;
}
......@@ -17,7 +17,7 @@ sleep 1
#####################
# run test
run_to 10 tests/create-write-persist-test $svr1 1
run_to 10 tests/create-write-persist-test $srcdir/tests/lorem.txt $svr1 1
if [ $? -ne 0 ]; then
wait
exit 1
......
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ac laoreet dolor. Donec non est sed libero consectetur placerat. Suspendisse ultricies eros non nunc maximus, a fermentum diam placerat. Suspendisse quis elit luctus, accumsan enim vitae, facilisis nibh. Pellentesque et ante eget quam iaculis imperdiet id at nulla. Morbi faucibus purus nisi, id pulvinar tortor vulputate at. Suspendisse pharetra posuere velit, a varius metus. Donec hendrerit, leo sed fermentum dapibus, nisi nunc pretium sapien, nec scelerisque nulla ipsum quis nulla.
Nam lacinia nisi at erat sodales ullamcorper. Integer ullamcorper justo tincidunt tristique pharetra. Nunc pretium neque sit amet mi faucibus, a posuere sem fringilla. Phasellus dignissim, libero at tempus sagittis, quam nulla hendrerit urna, ac lacinia orci metus in justo. Nam venenatis molestie mauris vitae volutpat. Phasellus fermentum justo eu libero pellentesque, sit amet consectetur est ultricies. Proin mollis in neque ut blandit. Curabitur placerat, risus eu gravida maximus, enim mauris lobortis tortor, eu venenatis tortor nulla ac lorem. Morbi viverra vel augue et aliquet. Praesent malesuada ex ut leo rhoncus eleifend. Fusce sollicitudin ac nisl eu vestibulum. Aenean vulputate metus lacus, in lacinia massa eleifend ac. Sed neque urna, vestibulum id ultrices vitae, venenatis in lacus. Pellentesque nec scelerisque nisi, mattis condimentum velit. Integer blandit dui sed dui bibendum ornare. Vestibulum non magna molestie, euismod libero sed, pulvinar mauris.
Donec risus eros, accumsan eu elit fermentum, tempus scelerisque magna. Nam iaculis tincidunt justo. Vivamus at erat quis enim maximus lobortis. Ut eu tortor lorem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vulputate, est et euismod lacinia, sapien ipsum varius mi, facilisis condimentum sem sem nec nisi. Quisque vitae est tristique, mollis felis eget, rutrum lacus. Mauris porta augue vel quam eleifend, sit amet mattis erat eleifend. Nullam aliquet quis eros vitae convallis. Curabitur sed pharetra neque, in imperdiet diam. Donec urna lorem, accumsan vel urna eleifend, ullamcorper tincidunt urna. Quisque leo neque, sagittis a volutpat ac, molestie sed sapien. Vestibulum ligula nulla, hendrerit sit amet ultricies eu, ullamcorper in urna.
Ut vel ullamcorper orci. In neque ipsum, lacinia eu sapien maximus, suscipit maximus mi. Sed eu turpis lacus. Aliquam erat volutpat. Aliquam accumsan quam vel quam venenatis, vitae tempor sem luctus. Pellentesque lobortis sapien eget est pretium venenatis. Duis mattis vestibulum elit id tristique. Fusce sit amet iaculis turpis. Nulla id aliquet lectus, a tincidunt nunc. Mauris pretium ornare congue. Sed consequat augue lacus, in blandit libero tempor eu. Vestibulum consectetur ligula quis augue facilisis, vel imperdiet tellus aliquet. Aliquam feugiat scelerisque facilisis. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Vestibulum massa enim, rutrum id dui eget, vehicula sagittis felis. In posuere sollicitudin sollicitudin. Duis faucibus, libero et varius pulvinar, massa nibh convallis justo, sed consectetur nisi nulla ac eros. In vitae lorem magna. Nullam ex odio, pretium vitae bibendum eu, sodales ac enim. Proin condimentum finibus vestibulum. Nunc neque tortor, tincidunt cursus faucibus nec, finibus et ante. Nullam erat massa, rutrum non velit sit amet, luctus convallis nibh. Ut vitae facilisis mauris. Duis vehicula, diam eget dignissim consequat, orci massa scelerisque nulla, sit amet porta turpis nisl venenatis nulla. Sed suscipit vulputate nibh sit amet ornare. Nam at lectus elementum enim tempus varius ac sed diam. Duis elementum vestibulum nibh, sit amet dignissim nulla efficitur sed.
......@@ -44,7 +44,7 @@ function test_start_servers ()
exit 1
fi
run_to ${maxtime} src/bake-server-daemon -f $TMPBASE/svr-$i.addr na+sm $TMPBASE/svr-$i.dat &
run_to ${maxtime} src/bake-server-daemon -b 128 -c 4 -t 4 -f $TMPBASE/svr-$i.addr na+sm $TMPBASE/svr-$i.dat &
if [ $? -ne 0 ]; then
# TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the
......@@ -127,3 +127,4 @@ function test_start_servers_multi_targets ()
svr1=`cat $TMPBASE/svr-1.addr`
}
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