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

Just do simple in test-mpi.

parent e431211a
......@@ -102,37 +102,34 @@ int main(int argc, char *argv[])
hret = kv_open(context, server_addr_str, (char*)db, KV_UINT, KV_BULK);
DIE_IF(hret != HG_SUCCESS, "kv_open");
// do a set of puts/gets
for (int i=0; i<rank; i++) {
uint64_t key = rank+i;
uint64_t key = rank+i;
// put
int put_val = rank+i;
std::vector<char> put_data;
put_data.resize(sizeof(put_val));
uint64_t data_size = put_data.size();
memcpy(put_data.data(), &put_val, data_size);
hret = kv_bulk_put(context, (void*)&key, (void*)put_data.data(), &data_size);
printf("(put) key %lu, size=%lu\n", key, data_size);
DIE_IF(hret != HG_SUCCESS, "kv_bulk_put");
sleep(2);
// get
int get_val;
std::vector<char> get_data;
get_data.resize(sizeof(get_val));
data_size = get_data.size();
printf("(get) key %lu, estimated size=%lu\n", key, data_size);
hret = kv_bulk_get(context, (void*)&key, (void*)get_data.data(), &data_size);
DIE_IF(hret != HG_SUCCESS, "kv_bulk_get");
printf("(get) key %lu, actual size=%lu\n", key, data_size);
get_data.resize(data_size);
memcpy(&get_val, get_data.data(), data_size);
printf("key: %lu in: %d out: %d\n", key, put_val, get_val);
}
// put
int put_val = rank;
std::vector<char> put_data;
put_data.resize(sizeof(put_val));
uint64_t data_size = put_data.size();
memcpy(put_data.data(), &put_val, data_size);
hret = kv_bulk_put(context, (void*)&key, (void*)put_data.data(), &data_size);
printf("(put) key %lu, size=%lu\n", key, data_size);
DIE_IF(hret != HG_SUCCESS, "kv_bulk_put");
sleep(2);
// get
int get_val;
std::vector<char> get_data;
get_data.resize(sizeof(get_val));
data_size = get_data.size();
printf("(get) key %lu, estimated size=%lu\n", key, data_size);
hret = kv_bulk_get(context, (void*)&key, (void*)get_data.data(), &data_size);
DIE_IF(hret != HG_SUCCESS, "kv_bulk_get");
printf("(get) key %lu, actual size=%lu\n", key, data_size);
get_data.resize(data_size);
memcpy(&get_val, get_data.data(), data_size);
printf("key: %lu in: %d out: %d\n", key, put_val, get_val);
// close
hret = kv_close(context);
......
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