Commit b753fa81 authored by Matthieu Dorier's avatar Matthieu Dorier

added provider handles and now bake_target_id_t is simply a uuid

parent 94b56161
......@@ -16,10 +16,10 @@ extern "C" {
#endif
#define BAKE_CLIENT_NULL ((bake_client_t)NULL)
#define BAKE_TARGET_ID_NULL ((bake_target_id_t)NULL)
#define BAKE_PROVIDER_HANDLE_NULL ((bake_provider_handle_t)NULL)
typedef struct bake_client* bake_client_t;
typedef struct bake_target* bake_target_id_t;
typedef struct bake_provider_handle* bake_provider_handle_t;
/**
* Creates a BAKE client attached to the given margo instance.
......@@ -46,6 +46,16 @@ int bake_client_init(margo_instance_id mid, bake_client_t* client);
*/
int bake_client_finalize(bake_client_t client);
int bake_provider_handle_create(
bake_client_t client,
hg_addr_t addr,
uint8_t mplex_id,
bake_provider_handle_t* handle);
int bake_provider_handle_ref_incr(bake_provider_handle_t handle);
int bake_provider_handle_release(bake_provider_handle_t handle);
/**
* Obtains identifying information for a BAKE target through the provided
* remote mercury address and multiplex id.
......@@ -56,11 +66,11 @@ int bake_client_finalize(bake_client_t client);
* @param [out] bti BAKE target identifier
* @returns 0 on success, -1 on failure
*/
int bake_probe_instance(
bake_client_t client,
hg_addr_t dest_addr,
uint8_t mplex_id,
bake_target_id_t *bti);
int bake_probe(
bake_provider_handle_t provider,
uint64_t max_targets,
bake_target_id_t* bti,
uint64_t* num_targets);
/**
* Creates a bounded-size BAKE data region. The resulting region can be
......@@ -74,9 +84,10 @@ int bake_probe_instance(
* @returns 0 on success, -1 on failure
*/
int bake_create(
bake_target_id_t bti,
uint64_t region_size,
bake_region_id_t *rid);
bake_provider_handle_t provider,
bake_target_id_t bti,
uint64_t region_size,
bake_region_id_t *rid);
/**
* Writes into a BAKE region that was previously created with bake_create().
......@@ -94,11 +105,11 @@ int bake_create(
* @returns 0 on success, -1 on failure
*/
int bake_write(
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
void const *buf,
uint64_t buf_size);
bake_provider_handle_t provider,
bake_region_id_t rid,
uint64_t region_offset,
void const *buf,
uint64_t buf_size);
/**
* Writes data into a previously created BAKE region like bake_write(),
......@@ -114,13 +125,13 @@ int bake_write(
* @returns 0 on success, -1 on failure
*/
int bake_proxy_write(
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size);
bake_provider_handle_t provider,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size);
/**
* Persists a BAKE region. The region is considered immutable at this point
......@@ -131,8 +142,8 @@ int bake_proxy_write(
* @returns 0 on success, -1 on failure
*/
int bake_persist(
bake_target_id_t bti,
bake_region_id_t rid);
bake_provider_handle_t provider,
bake_region_id_t rid);
/**
* Creates a bounded-size BAKE region, writes data into it, and persists
......@@ -147,12 +158,13 @@ int bake_persist(
* @returns 0 on success, -1 on failure
*/
int bake_create_write_persist(
bake_target_id_t bti,
uint64_t region_size,
uint64_t region_offset,
void const *buf,
uint64_t buf_size,
bake_region_id_t *rid);
bake_provider_handle_t provider,
bake_target_id_t bti,
uint64_t region_size,
uint64_t region_offset,
void const *buf,
uint64_t buf_size,
bake_region_id_t *rid);
/**
*
......@@ -167,14 +179,15 @@ int bake_create_write_persist(
* @returns 0 on success, -1 on failure
*/
int bake_create_write_persist_proxy(
bake_target_id_t bti,
uint64_t region_size,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size,
bake_region_id_t *rid);
bake_provider_handle_t provider,
bake_target_id_t bti,
uint64_t region_size,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size,
bake_region_id_t *rid);
/**
* Checks the size of an existing BAKE region.
......@@ -185,9 +198,9 @@ int bake_create_write_persist_proxy(
* @returns 0 on success, -1 on failure
*/
int bake_get_size(
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t *size);
bake_provider_handle_t provider,
bake_region_id_t rid,
uint64_t *size);
/**
* Reads from a BAKE region that was previously persisted with bake_persist().
......@@ -203,11 +216,11 @@ int bake_get_size(
* @returns 0 on success, -1 on failure
*/
int bake_read(
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
void *buf,
uint64_t buf_size);
bake_provider_handle_t provider,
bake_region_id_t rid,
uint64_t region_offset,
void *buf,
uint64_t buf_size);
/**
* Reads data from a previously persisted BAKE region like bake_read(),
......@@ -223,22 +236,13 @@ int bake_read(
* @returns 0 on success, -1 on failure
*/
int bake_proxy_read(
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size);
/**
* Releases local resources associated with access to a BAKE target;
* does not modify the target in any way.
*
* @param [in] bti BAKE target_identifier
*/
void bake_target_id_release(
bake_target_id_t bti);
bake_provider_handle_t provider,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size);
/**
* Shuts down a remote BAKE service (given an address).
......@@ -249,7 +253,7 @@ void bake_target_id_release(
* @returns 0 on success, -1 on failure
*/
int bake_shutdown_service(
bake_client_t client, hg_addr_t addr);
bake_client_t client, hg_addr_t addr);
/**
* Issues a BAKE no-op operation.
......@@ -257,8 +261,7 @@ int bake_shutdown_service(
* @param [in] bti BAKE target identifier
* @returns 0 on success, -1 on failure
*/
int bake_noop(
bake_target_id_t bti);
int bake_noop(bake_provider_handle_t provider);
#ifdef __cplusplus
}
......
......@@ -16,7 +16,7 @@ extern "C" {
typedef struct {
uuid_t id;
} bake_uuid_t;
} bake_target_id_t;
/**
* Persistent, opaque identifier for a region within a BAKE target.
*/
......
This diff is collapsed.
......@@ -27,6 +27,8 @@ int main(int argc, char **argv)
hg_addr_t svr_addr;
margo_instance_id mid;
bake_client_t bcl;
bake_provider_handle_t bph;
uint64_t num_targets;
bake_target_id_t bti;
uint8_t mplex_id;
hg_return_t hret;
......@@ -75,10 +77,21 @@ int main(int argc, char **argv)
return(-1);
}
ret = bake_probe_instance(bcl, svr_addr, mplex_id, &bti);
ret = bake_provider_handle_create(bcl, svr_addr, mplex_id, &bph);
if(ret < 0)
{
fprintf(stderr, "Error: bake_probe_instance()\n");
fprintf(stderr, "Error: bake_provider_handle_create()\n");
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
return(-1);
}
ret = bake_probe(bph, 1, &bti, &num_targets);
if(ret < 0)
{
fprintf(stderr, "Error: bake_probe()\n");
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -89,7 +102,7 @@ int main(int argc, char **argv)
if(region_fd < 0)
{
perror("open rid");
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -101,7 +114,7 @@ int main(int argc, char **argv)
{
perror("read");
close(region_fd);
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -109,11 +122,11 @@ int main(int argc, char **argv)
}
close(region_fd);
ret = bake_get_size(bti, rid, &check_size);
ret = bake_get_size(bph, rid, &check_size);
if(ret != 0)
{
fprintf(stderr, "Error: bake_get_size()\n");
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -124,7 +137,7 @@ int main(int argc, char **argv)
if(fd < 0)
{
perror("open output");
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -136,7 +149,7 @@ int main(int argc, char **argv)
{
perror("ftruncate");
close(fd);
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -148,7 +161,7 @@ int main(int argc, char **argv)
{
perror("mmap");
close(fd);
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -157,7 +170,7 @@ int main(int argc, char **argv)
/* transfer data */
ret = bake_read(
bti,
bph,
rid,
0,
local_region,
......@@ -166,7 +179,7 @@ int main(int argc, char **argv)
{
munmap(local_region, check_size);
close(fd);
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -176,7 +189,7 @@ int main(int argc, char **argv)
munmap(local_region, check_size);
close(fd);
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......
......@@ -27,6 +27,8 @@ int main(int argc, char **argv)
hg_addr_t svr_addr;
margo_instance_id mid;
bake_client_t bcl;
bake_provider_handle_t bph;
uint64_t num_targets;
bake_target_id_t bti;
uint8_t mplex_id;
hg_return_t hret;
......@@ -106,23 +108,36 @@ int main(int argc, char **argv)
return(-1);
}
ret = bake_probe_instance(bcl, svr_addr, mplex_id, &bti);
ret = bake_provider_handle_create(bcl, svr_addr, mplex_id, &bph);
if(ret != 0)
{
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
munmap(local_region, statbuf.st_size);
close(fd);
fprintf(stderr, "Error: bake_provider_handle_create()\n");
return(-1);
}
ret = bake_probe(bph, 1, &bti, &num_targets);
if(ret < 0)
{
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
munmap(local_region, statbuf.st_size);
close(fd);
fprintf(stderr, "Error: bake_probe_instance()\n");
fprintf(stderr, "Error: bake_probe()\n");
return(-1);
}
/* create region */
ret = bake_create(bti, statbuf.st_size, &rid);
ret = bake_create(bph, bti, statbuf.st_size, &rid);
if(ret != 0)
{
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -134,14 +149,14 @@ int main(int argc, char **argv)
/* transfer data */
ret = bake_write(
bti,
bph,
rid,
0,
local_region,
statbuf.st_size);
if(ret != 0)
{
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -154,10 +169,10 @@ int main(int argc, char **argv)
munmap(local_region, statbuf.st_size);
close(fd);
ret = bake_persist(bti, rid);
ret = bake_persist(bph, rid);
if(ret != 0)
{
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -166,18 +181,18 @@ int main(int argc, char **argv)
}
/* safety check size */
ret = bake_get_size(bti, rid, &check_size);
ret = bake_get_size(bph, rid, &check_size);
if(ret != 0)
{
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
fprintf(stderr, "Error: bake_get_size()\n");
return(-1);
}
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......
......@@ -17,9 +17,9 @@
#include "bake-client.h"
static void bench_routine_write(bake_target_id_t bti, int iterations, double* measurement_array, int size);
static void bench_routine_read(bake_target_id_t bti, int iterations, double* measurement_array, int size);
static void bench_routine_noop(bake_target_id_t bti, int iterations, double* measurement_array);
static void bench_routine_write(bake_provider_handle_t bph, bake_target_id_t bti, int iterations, double* measurement_array, int size);
static void bench_routine_read(bake_provider_handle_t bph, int iterations, double* measurement_array, int size);
static void bench_routine_noop(bake_provider_handle_t bph, int iterations, double* measurement_array);
static void bench_routine_print(const char* op, int size, int iterations, double* measurement_array);
static int measurement_cmp(const void* a, const void *b);
......@@ -34,6 +34,8 @@ int main(int argc, char **argv)
hg_addr_t svr_addr;
margo_instance_id mid;
bake_client_t bcl;
bake_provider_handle_t bph;
uint64_t num_targets;
bake_target_id_t bti;
uint8_t mplex_id;
hg_return_t hret;
......@@ -91,10 +93,11 @@ int main(int argc, char **argv)
return(-1);
}
ret = bake_probe_instance(bcl, svr_addr, mplex_id, &bti);
ret = bake_probe(bph, 1, &bti, &num_targets);
if(ret < 0)
{
fprintf(stderr, "Error: bake_probe_instance()\n");
fprintf(stderr, "Error: bake_probe()\n");
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -103,17 +106,17 @@ int main(int argc, char **argv)
printf("# <op> <iterations> <size> <min> <q1> <med> <avg> <q3> <max>\n");
bench_routine_noop(bti, iterations, measurement_array);
bench_routine_noop(bph, iterations, measurement_array);
bench_routine_print("noop", 0, iterations, measurement_array);
for(cur_size=min_size; cur_size <= max_size; cur_size *= 2)
{
bench_routine_write(bti, iterations, measurement_array, cur_size);
bench_routine_write(bph, bti, iterations, measurement_array, cur_size);
bench_routine_print("write", cur_size, iterations, measurement_array);
bench_routine_read(bti, iterations, measurement_array, cur_size);
bench_routine_read(bph, iterations, measurement_array, cur_size);
bench_routine_print("read", cur_size, iterations, measurement_array);
}
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -130,7 +133,7 @@ static double Wtime(void)
return((double)tp.tv_sec + (double)(tp.tv_nsec) / (double)1000000000.0);
}
static void bench_routine_write(bake_target_id_t bti, int iterations, double *measurement_array, int size)
static void bench_routine_write(bake_provider_handle_t bph, bake_target_id_t bti, int iterations, double *measurement_array, int size)
{
int ret;
double tm1, tm2;
......@@ -142,7 +145,7 @@ static void bench_routine_write(bake_target_id_t bti, int iterations, double *me
assert(buffer);
/* create region */
ret = bake_create(bti, size*iterations, &rid);
ret = bake_create(bph, bti, size*iterations, &rid);
assert(ret == 0);
sleep(1);
......@@ -152,7 +155,7 @@ static void bench_routine_write(bake_target_id_t bti, int iterations, double *me
tm1 = Wtime();
/* transfer data (writes) */
ret = bake_write(
bti,
bph,
rid,
region_offset,
buffer,
......@@ -164,7 +167,7 @@ static void bench_routine_write(bake_target_id_t bti, int iterations, double *me
}
/* persist */
ret = bake_persist(bti, rid);
ret = bake_persist(bph, rid);
assert(ret == 0);
free(buffer);
......@@ -172,7 +175,7 @@ static void bench_routine_write(bake_target_id_t bti, int iterations, double *me
return;
}
static void bench_routine_read(bake_target_id_t bti, int iterations, double *measurement_array, int size)
static void bench_routine_read(bake_provider_handle_t bph, int iterations, double *measurement_array, int size)
{
int ret;
double tm1, tm2;
......@@ -190,7 +193,7 @@ static void bench_routine_read(bake_target_id_t bti, int iterations, double *mea
tm1 = Wtime();
/* transfer data (reads) */
ret = bake_read(
bti,
bph,
rid,
region_offset,
buffer,
......@@ -206,7 +209,7 @@ static void bench_routine_read(bake_target_id_t bti, int iterations, double *mea
return;
}
static void bench_routine_noop(bake_target_id_t bti, int iterations, double *measurement_array)
static void bench_routine_noop(bake_provider_handle_t bph, int iterations, double *measurement_array)
{
int ret;
double tm1, tm2;
......@@ -218,7 +221,7 @@ static void bench_routine_noop(bake_target_id_t bti, int iterations, double *mea
{
tm1 = Wtime();
/* noop */
ret = bake_noop(bti);
ret = bake_noop(bph);
tm2 = Wtime();
assert(ret == 0);
......
......@@ -13,7 +13,7 @@
#include <bake.h>
/* encoders for BAKE-specific types */
static inline hg_return_t hg_proc_bake_uuid_t(hg_proc_t proc, bake_uuid_t *bti);
static inline hg_return_t hg_proc_bake_target_id_t(hg_proc_t proc, bake_target_id_t *bti);
static inline hg_return_t hg_proc_bake_region_id_t(hg_proc_t proc, bake_region_id_t *rid);
/* BAKE shutdown */
......@@ -21,7 +21,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_shutdown_ult)
/* BAKE create */
MERCURY_GEN_PROC(bake_create_in_t,
((bake_uuid_t)(pool_id))\
((bake_target_id_t)(bti))\
((uint64_t)(region_size)))
MERCURY_GEN_PROC(bake_create_out_t,
((int32_t)(ret))\
......@@ -30,7 +30,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_create_ult)
/* BAKE write */
MERCURY_GEN_PROC(bake_write_in_t,
((bake_uuid_t)(pool_id))\
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid))\
((uint64_t)(region_offset))\
((hg_bulk_t)(bulk_handle))\
......@@ -44,7 +44,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_write_ult)
/* BAKE eager write */
typedef struct
{
bake_uuid_t pool_id;
/* bake_target_id_t bti; */
bake_region_id_t rid;
uint64_t region_offset;
uint32_t size;
......@@ -57,7 +57,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_eager_write_ult)
/* BAKE persist */
MERCURY_GEN_PROC(bake_persist_in_t,
((bake_uuid_t)(pool_id))\
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid)))
MERCURY_GEN_PROC(bake_persist_out_t,
((int32_t)(ret)))
......@@ -65,7 +65,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_persist_ult)
/* BAKE create/write/persist */
MERCURY_GEN_PROC(bake_create_write_persist_in_t,
((bake_uuid_t)(pool_id))\
((bake_target_id_t)(bti))\
((uint64_t)(region_size))\
((uint64_t)(region_offset))\
((hg_bulk_t)(bulk_handle))\
......@@ -79,7 +79,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_create_write_persist_ult)
/* BAKE get size */
MERCURY_GEN_PROC(bake_get_size_in_t,
((bake_uuid_t)(pool_id))\
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid)))
MERCURY_GEN_PROC(bake_get_size_out_t,
((int32_t)(ret))\
......@@ -88,7 +88,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_get_size_ult)
/* BAKE read */
MERCURY_GEN_PROC(bake_read_in_t,
((bake_uuid_t)(pool_id))\
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid))\
((uint64_t)(region_offset))\
((hg_bulk_t)(bulk_handle))\
......@@ -101,7 +101,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_read_ult)
/* BAKE eager read */
MERCURY_GEN_PROC(bake_eager_read_in_t,
((bake_uuid_t)(pool_id))\
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid))\
((uint64_t)(region_offset))\
((uint32_t)(size)))
......@@ -117,7 +117,7 @@ DECLARE_MARGO_RPC_HANDLER(bake_eager_read_ult)
/* BAKE probe */
MERCURY_GEN_PROC(bake_probe_out_t,
((int32_t)(ret))\
((bake_uuid_t)(pool_id)))
((bake_target_id_t)(bti)))
DECLARE_MARGO_RPC_HANDLER(bake_probe_ult)
/* BAKE noop */
......@@ -141,10 +141,10 @@ static inline hg_return_t hg_proc_bake_region_id_t(hg_proc_t proc, bake_region_i
return(HG_SUCCESS);
}
static inline hg_return_t hg_proc_bake_uuid_t(hg_proc_t proc, bake_uuid_t *pool_id)
static inline hg_return_t hg_proc_bake_target_id_t(hg_proc_t proc, bake_target_id_t *bti)
{
/* TODO: make this portable */
return(hg_proc_memcpy(proc, pool_id, sizeof(*pool_id)));
return(hg_proc_memcpy(proc, bti, sizeof(*bti)));
}
static inline hg_return_t hg_proc_bake_eager_write_in_t(hg_proc_t proc, void *v_out_p)
......@@ -153,7 +153,7 @@ static inline hg_return_t hg_proc_bake_eager_write_in_t(hg_proc_t proc, void *v_
bake_eager_write_in_t *in = v_out_p;
void *buf = NULL;
hg_proc_bake_uuid_t(proc, &in->pool_id);
/* hg_proc_bake_target_id_t(proc, &in->bti); */
hg_proc_bake_region_id_t(proc, &in->rid);
hg_proc_uint64_t(proc, &in->region_offset);
hg_proc_uint32_t(proc, &in->size);
......
......@@ -14,7 +14,7 @@
/* definition of BAKE root data structure (just a uuid for now) */
typedef struct
{
bake_uuid_t pool_id;
bake_target_id_t pool_id;
} bake_root_t;
/* definition of internal BAKE region_id_t identifier for libpmemobj back end */
......@@ -820,7 +820,7 @@ static void bake_probe_ult(hg_handle_t handle)
}
out.ret = 0;
out.pool_id = svr_ctx->pmem_root->pool_id;
out.bti = svr_ctx->pmem_root->pool_id;
margo_respond(handle, &out);
margo_destroy(handle);
......
......@@ -25,6 +25,8 @@ int main(int argc, char *argv[])
hg_addr_t svr_addr;
uint8_t mplex_id;
bake_client_t bcl;
bake_provider_handle_t bph;
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.";
......@@ -74,11 +76,23 @@ int main(int argc, char *argv[])
return(-1);
}
/* create a BAKE provider handle */
ret = bake_provider_handle_create(bcl, svr_addr, mplex_id, &bph);
if(ret != 0)
{
fprintf(stderr, "Error: bake_provider_handle_create()\n");
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
return(-1);
}
/* obtain info on the server's BAKE target */
ret = bake_probe_instance(bcl, svr_addr, mplex_id, &bti);
ret = bake_probe(bph, 1, &bti, &num_targets);
if(ret != 0)
{
fprintf(stderr, "Error: bake_probe_instance()\n");
fprintf(stderr, "Error: bake_probe()\n");
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -88,7 +102,7 @@ int main(int argc, char *argv[])
buf = malloc(ALLOC_BUF_SIZE);
if(!buf)
{
bake_target_id_release(bti);
bake_provider_handle_release(bph);
margo_addr_free(mid, svr_addr);
bake_client_finalize(bcl);
margo_finalize(mid);
......@@ -101,12 +115,12 @@ int main(int argc, char *argv[])
strcpy(buf, test_str);
buf_size = strlen(test_str) + 1;
ret = bake_create_write_persist(bti, buf_size, 0, buf, buf_size, &the_rid);
ret = bake_create_write_persist(bph, bti, buf_size, 0, buf, buf_size, &the_rid);
if(ret != 0)
{