Commit d54d59f9 authored by Shane Snyder's avatar Shane Snyder

port bake-bulk to new margo api changes

parent 9da77dd1
This diff is collapsed.
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <uuid/uuid.h> #include <uuid/uuid.h>
#include <abt.h>
#include <abt-snoozer.h>
#include <margo.h> #include <margo.h>
#include <libpmemobj.h> #include <libpmemobj.h>
#include <bake-bulk-server.h> #include <bake-bulk-server.h>
...@@ -18,10 +16,6 @@ int main(int argc, char **argv) ...@@ -18,10 +16,6 @@ int main(int argc, char **argv)
{ {
int ret; int ret;
margo_instance_id mid; margo_instance_id mid;
ABT_xstream handler_xstream;
ABT_pool handler_pool;
hg_context_t *hg_context;
hg_class_t *hg_class;
char target_string[64]; char target_string[64];
PMEMoid root_oid; PMEMoid root_oid;
PMEMobjpool *bb_pmem_pool = NULL; PMEMobjpool *bb_pmem_pool = NULL;
...@@ -53,60 +47,9 @@ int main(int argc, char **argv) ...@@ -53,60 +47,9 @@ int main(int argc, char **argv)
uuid_unparse(bb_pmem_root->target_id.id, target_string); uuid_unparse(bb_pmem_root->target_id.id, target_string);
fprintf(stderr, "BAKE target ID: %s\n", target_string); fprintf(stderr, "BAKE target ID: %s\n", target_string);
/* boilerplate HG initialization steps */ /* start margo */
/***************************************/ /* use the main xstream for driving progress and executing rpc handlers */
hg_class = HG_Init(argv[1], HG_TRUE); mid = margo_init(argv[1], MARGO_SERVER_MODE, 0, -1);
if(!hg_class)
{
fprintf(stderr, "Error: HG_Init()\n");
return(-1);
}
hg_context = HG_Context_create(hg_class);
if(!hg_context)
{
fprintf(stderr, "Error: HG_Context_create()\n");
HG_Finalize(hg_class);
return(-1);
}
/* set up argobots */
/***************************************/
ret = ABT_init(argc, argv);
if(ret != 0)
{
fprintf(stderr, "Error: ABT_init()\n");
return(-1);
}
/* set primary ES to idle without polling */
ret = ABT_snoozer_xstream_self_set();
if(ret != 0)
{
fprintf(stderr, "Error: ABT_snoozer_xstream_self_set()\n");
return(-1);
}
/* Find primary pool to use for running rpc handlers */
ret = ABT_xstream_self(&handler_xstream);
if(ret != 0)
{
fprintf(stderr, "Error: ABT_xstream_self()\n");
return(-1);
}
ret = ABT_xstream_get_main_pools(handler_xstream, 1, &handler_pool);
if(ret != 0)
{
fprintf(stderr, "Error: ABT_xstream_get_main_pools()\n");
return(-1);
}
/* actually start margo */
/* provide argobots pools for driving communication progress and
* executing rpc handlers as well as class and context for Mercury
* communication.
*/
/***************************************/
mid = margo_init_pool(handler_pool, handler_pool, hg_context);
assert(mid); assert(mid);
/* register the bake bulk server */ /* register the bake bulk server */
...@@ -128,11 +71,6 @@ int main(int argc, char **argv) ...@@ -128,11 +71,6 @@ int main(int argc, char **argv)
*/ */
margo_wait_for_finalize(mid); margo_wait_for_finalize(mid);
ABT_finalize();
HG_Context_destroy(hg_context);
HG_Finalize(hg_class);
pmemobj_close(bb_pmem_pool); pmemobj_close(bb_pmem_pool);
return(0); return(0);
......
This diff is collapsed.
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "abt.h"
#include "abt-snoozer.h"
#include "bake-bulk-client.h" #include "bake-bulk-client.h"
/* client program that will copy a bake bulk region out to a POSIX file */ /* client program that will copy a bake bulk region out to a POSIX file */
...@@ -36,25 +34,9 @@ int main(int argc, char **argv) ...@@ -36,25 +34,9 @@ int main(int argc, char **argv)
return(-1); return(-1);
} }
/* set up Argobots */
ret = ABT_init(argc, argv);
if(ret != 0)
{
fprintf(stderr, "Error: ABT_init()\n");
return(-1);
}
ret = ABT_snoozer_xstream_self_set();
if(ret != 0)
{
ABT_finalize();
fprintf(stderr, "Error: ABT_snoozer_xstream_self_set()\n");
return(-1);
}
ret = bake_probe_instance(argv[1], &bti); ret = bake_probe_instance(argv[1], &bti);
if(ret < 0) if(ret < 0)
{ {
ABT_finalize();
fprintf(stderr, "Error: bake_probe_instance()\n"); fprintf(stderr, "Error: bake_probe_instance()\n");
return(-1); return(-1);
} }
...@@ -64,7 +46,6 @@ int main(int argc, char **argv) ...@@ -64,7 +46,6 @@ int main(int argc, char **argv)
{ {
perror("open rid"); perror("open rid");
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(-1); return(-1);
} }
...@@ -74,7 +55,6 @@ int main(int argc, char **argv) ...@@ -74,7 +55,6 @@ int main(int argc, char **argv)
perror("read"); perror("read");
close(region_fd); close(region_fd);
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(-1); return(-1);
} }
close(region_fd); close(region_fd);
...@@ -84,7 +64,6 @@ int main(int argc, char **argv) ...@@ -84,7 +64,6 @@ int main(int argc, char **argv)
{ {
fprintf(stderr, "Error: bake_bulk_get_size()\n"); fprintf(stderr, "Error: bake_bulk_get_size()\n");
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(-1); return(-1);
} }
...@@ -93,7 +72,6 @@ int main(int argc, char **argv) ...@@ -93,7 +72,6 @@ int main(int argc, char **argv)
{ {
perror("open output"); perror("open output");
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(-1); return(-1);
} }
...@@ -103,7 +81,6 @@ int main(int argc, char **argv) ...@@ -103,7 +81,6 @@ int main(int argc, char **argv)
perror("ftruncate"); perror("ftruncate");
close(fd); close(fd);
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(-1); return(-1);
} }
...@@ -113,7 +90,6 @@ int main(int argc, char **argv) ...@@ -113,7 +90,6 @@ int main(int argc, char **argv)
perror("mmap"); perror("mmap");
close(fd); close(fd);
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(-1); return(-1);
} }
...@@ -129,7 +105,6 @@ int main(int argc, char **argv) ...@@ -129,7 +105,6 @@ int main(int argc, char **argv)
munmap(local_region, check_size); munmap(local_region, check_size);
close(fd); close(fd);
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
fprintf(stderr, "Error: bake_bulk_read()\n"); fprintf(stderr, "Error: bake_bulk_read()\n");
return(-1); return(-1);
} }
...@@ -137,7 +112,6 @@ int main(int argc, char **argv) ...@@ -137,7 +112,6 @@ int main(int argc, char **argv)
munmap(local_region, check_size); munmap(local_region, check_size);
close(fd); close(fd);
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(0); return(0);
} }
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "abt.h"
#include "abt-snoozer.h"
#include "bake-bulk-client.h" #include "bake-bulk-client.h"
/* client program that will copy a POSIX file into a bake bulk region */ /* client program that will copy a POSIX file into a bake bulk region */
...@@ -60,29 +58,9 @@ int main(int argc, char **argv) ...@@ -60,29 +58,9 @@ int main(int argc, char **argv)
return(-1); return(-1);
} }
/* set up Argobots */
ret = ABT_init(argc, argv);
if(ret != 0)
{
munmap(local_region, statbuf.st_size);
close(fd);
fprintf(stderr, "Error: ABT_init()\n");
return(-1);
}
ret = ABT_snoozer_xstream_self_set();
if(ret != 0)
{
ABT_finalize();
munmap(local_region, statbuf.st_size);
close(fd);
fprintf(stderr, "Error: ABT_snoozer_xstream_self_set()\n");
return(-1);
}
ret = bake_probe_instance(argv[2], &bti); ret = bake_probe_instance(argv[2], &bti);
if(ret < 0) if(ret < 0)
{ {
ABT_finalize();
munmap(local_region, statbuf.st_size); munmap(local_region, statbuf.st_size);
close(fd); close(fd);
fprintf(stderr, "Error: bake_probe_instance()\n"); fprintf(stderr, "Error: bake_probe_instance()\n");
...@@ -94,7 +72,6 @@ int main(int argc, char **argv) ...@@ -94,7 +72,6 @@ int main(int argc, char **argv)
if(ret != 0) if(ret != 0)
{ {
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
munmap(local_region, statbuf.st_size); munmap(local_region, statbuf.st_size);
close(fd); close(fd);
fprintf(stderr, "Error: bake_bulk_create()\n"); fprintf(stderr, "Error: bake_bulk_create()\n");
...@@ -111,7 +88,6 @@ int main(int argc, char **argv) ...@@ -111,7 +88,6 @@ int main(int argc, char **argv)
if(ret != 0) if(ret != 0)
{ {
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
munmap(local_region, statbuf.st_size); munmap(local_region, statbuf.st_size);
close(fd); close(fd);
fprintf(stderr, "Error: bake_bulk_write()\n"); fprintf(stderr, "Error: bake_bulk_write()\n");
...@@ -125,7 +101,6 @@ int main(int argc, char **argv) ...@@ -125,7 +101,6 @@ int main(int argc, char **argv)
if(ret != 0) if(ret != 0)
{ {
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
fprintf(stderr, "Error: bake_bulk_persist()\n"); fprintf(stderr, "Error: bake_bulk_persist()\n");
return(-1); return(-1);
} }
...@@ -135,7 +110,6 @@ int main(int argc, char **argv) ...@@ -135,7 +110,6 @@ int main(int argc, char **argv)
if(ret != 0) if(ret != 0)
{ {
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
fprintf(stderr, "Error: bake_bulk_get_size()\n"); fprintf(stderr, "Error: bake_bulk_get_size()\n");
return(-1); return(-1);
} }
...@@ -144,7 +118,6 @@ int main(int argc, char **argv) ...@@ -144,7 +118,6 @@ int main(int argc, char **argv)
if(check_size != statbuf.st_size) if(check_size != statbuf.st_size)
{ {
ABT_finalize();
fprintf(stderr, "Error: size mismatch!\n"); fprintf(stderr, "Error: size mismatch!\n");
return(-1); return(-1);
} }
...@@ -169,8 +142,6 @@ int main(int argc, char **argv) ...@@ -169,8 +142,6 @@ int main(int argc, char **argv)
} }
} }
ABT_finalize();
return(0); return(0);
} }
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "abt.h"
#include "abt-snoozer.h"
#include "bake-bulk-client.h" #include "bake-bulk-client.h"
static void bench_routine_write(bake_target_id_t bti, int iterations, double* measurement_array, int size); static void bench_routine_write(bake_target_id_t bti, int iterations, double* measurement_array, int size);
...@@ -51,25 +49,9 @@ int main(int argc, char **argv) ...@@ -51,25 +49,9 @@ int main(int argc, char **argv)
measurement_array = malloc(sizeof(*measurement_array)*iterations); measurement_array = malloc(sizeof(*measurement_array)*iterations);
assert(measurement_array); assert(measurement_array);
/* set up Argobots */
ret = ABT_init(argc, argv);
if(ret != 0)
{
fprintf(stderr, "Error: ABT_init()\n");
return(-1);
}
ret = ABT_snoozer_xstream_self_set();
if(ret != 0)
{
ABT_finalize();
fprintf(stderr, "Error: ABT_snoozer_xstream_self_set()\n");
return(-1);
}
ret = bake_probe_instance(argv[1], &bti); ret = bake_probe_instance(argv[1], &bti);
if(ret < 0) if(ret < 0)
{ {
ABT_finalize();
fprintf(stderr, "Error: bake_probe_instance()\n"); fprintf(stderr, "Error: bake_probe_instance()\n");
return(-1); return(-1);
} }
...@@ -88,8 +70,6 @@ int main(int argc, char **argv) ...@@ -88,8 +70,6 @@ int main(int argc, char **argv)
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
free(measurement_array); free(measurement_array);
return(0); return(0);
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include "abt.h"
#include "abt-snoozer.h"
#include "bake-bulk-client.h" #include "bake-bulk-client.h"
/* client program that will shut down a BAKE bulk server. */ /* client program that will shut down a BAKE bulk server. */
...@@ -26,20 +24,6 @@ int main(int argc, char **argv) ...@@ -26,20 +24,6 @@ int main(int argc, char **argv)
return(-1); return(-1);
} }
/* set up Argobots */
ret = ABT_init(argc, argv);
if(ret != 0)
{
fprintf(stderr, "Error: ABT_init()\n");
return(-1);
}
ret = ABT_snoozer_xstream_self_set();
if(ret != 0)
{
fprintf(stderr, "Error: ABT_snoozer_xstream_self_set()\n");
return(-1);
}
ret = bake_probe_instance(argv[1], &bti); ret = bake_probe_instance(argv[1], &bti);
if(ret < 0) if(ret < 0)
{ {
...@@ -52,8 +36,6 @@ int main(int argc, char **argv) ...@@ -52,8 +36,6 @@ int main(int argc, char **argv)
bake_release_instance(bti); bake_release_instance(bti);
ABT_finalize();
return(0); return(0);
} }
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