Commit 60544ef6 authored by David Rich's avatar David Rich Committed by Rob Latham
Browse files

Updates based on ParSplice work.

parent 64070223
......@@ -161,11 +161,13 @@ hg_return_t kv_get(kv_context *context, void *key, void *value)
return ret;
}
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size)
std::pair<size_t, int32_t> kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size)
{
hg_return_t ret;
bulk_get_in_t bgin;
bulk_get_out_t bgout;
size_t bgsize;
int32_t bgret;
bgin.key = *(uint64_t*)key;
bgin.size = data_size;
......@@ -177,9 +179,11 @@ hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t da
ret = margo_get_output(context->bulk_get_handle, &bgout);
assert(ret == HG_SUCCESS);
assert(bgout.ret == HG_SUCCESS); // make sure the server side says all is OK
bgsize = bgout.size;
bgret = bgout.ret;
margo_free_output(context->bulk_get_handle, &bgout);
return HG_SUCCESS;
return (bgsize, bgret);
}
hg_return_t kv_close(kv_context *context)
......@@ -261,7 +265,7 @@ hg_return_t kv_client_deregister(kv_context *context) {
return HG_SUCCESS;
}
hg_return_t kv_client_shutdown_server(kv_context *context) {
hg_return_t kv_client_signal_shutdown(kv_context *context) {
hg_return_t ret;
ret = margo_forward(context->shutdown_handle, NULL);
......
......@@ -135,13 +135,13 @@ hg_return_t kv_server_deregister(kv_context *context);
hg_return_t kv_server_wait_for_shutdown(kv_context *context);
/* client-side routines wrapping up all the RPC stuff */
hg_return_t kv_client_shutdown_server(kv_context *context);
hg_return_t kv_client_signal_shutdown(kv_context *context);
hg_return_t kv_open(kv_context *context, char *server, char *name,
kv_type keytype, kv_type valtype);
kv_type keytype, kv_type valtype);
hg_return_t kv_put(kv_context *context, void *key, void *value);
hg_return_t kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t data_size);
hg_return_t kv_get(kv_context *context, void *key, void *value);
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size);
std::pair<size_t, int32_t> kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size);
hg_return_t kv_close(kv_context *context);
bench_result *kv_benchmark(kv_context *context, int count);
......
......@@ -108,7 +108,9 @@ int main(int argc, char *argv[])
std::vector<char> put_data;
put_data.resize(sizeof(put_val));
memcpy(put_data.data(), &put_val, sizeof(put_val));
hret = kv_bulk_put(context, (void*)&key, (void*)put_data.data(), put_data.size());
printf("(put) key %lu, size=%lu, rc=%d\n", key, put_data.size(), (int32_t)ret);
DIE_IF(hret != HG_SUCCESS, "kv_bulk_put");
sleep(2);
......@@ -117,8 +119,12 @@ int main(int argc, char *argv[])
int get_val;
std::vector<char> get_data;
get_data.resize(sizeof(get_val));
hret = kv_bulk_get(context, (void*)&key, (void*)get_data.data(), get_data.size());
DIE_IF(hret != HG_SUCCESS, "kv_bulk_get");
std::pair<size_t, int32_t> get_ret = kv_bulk_get(context, (void*)&key, (void*)get_data.data(), get_data.size());
size_t data_size = get_ret.first;
int32_t ret = get_ret.second;
printf("(get) key %lu, size=%lu, rc=%d\n", key, data_size, ret);
DIE_IF(ret != HG_SUCCESS, "kv_bulk_get");
memcpy(&get_val, get_data.data(), sizeof(get_val));
printf("key: %lu in: %d out: %d\n", key, put_val, get_val);
......@@ -130,7 +136,7 @@ int main(int argc, char *argv[])
MPI_Barrier(clientComm);
if (rank==1) {
printf("rank %d: sending server a shutdown request\n", rank);
kv_client_shutdown_server(context);
kv_client_signal_shutdown(context);
}
// now finish cleaning up
......
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