Exemple #1
0
int
main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    unsigned int number_of_peers;
    hg_return_t ret = HG_SUCCESS;

    hg_class = HG_Test_server_init(argc, argv, &na_addr_table,
            NULL, &number_of_peers, &context);

    do {
        unsigned int actual_count = 0;

        do {
            ret = HG_Trigger(hg_class, context, 0, 1, &actual_count);
        } while ((ret == HG_SUCCESS) && actual_count);

        if (hg_atomic_cas32(&hg_test_finalizing_count_g, 1, 1))
            break;

        ret = HG_Progress(hg_class, context, HG_MAX_IDLE_TIME);
    } while (ret == HG_SUCCESS);

    printf("# Finalizing...\n");
    HG_Test_finalize(hg_class);

    return EXIT_SUCCESS;
}
Exemple #2
0
/*---------------------------------------------------------------------------*/
int
main(int argc, char *argv[])
{
    struct hg_test_info hg_test_info = { 0 };
    hg_return_t hg_ret;
    int ret = EXIT_SUCCESS;

    /* Initialize the interface */
    HG_Test_init(argc, argv, &hg_test_info);

    /* Overflow RPC test */
    HG_TEST("overflow RPC");
    hg_ret = hg_test_overflow(hg_test_info.context, hg_test_info.request_class,
        hg_test_info.target_addr, hg_test_overflow_id_g,
        hg_test_rpc_forward_cb);
    if (hg_ret != HG_SUCCESS) {
        ret = EXIT_FAILURE;
        goto done;
    }
    HG_PASSED();

done:
    if (ret != EXIT_SUCCESS)
        HG_FAILED();
    HG_Test_finalize(&hg_test_info);
    return ret;
}
Exemple #3
0
int
main(int argc, char *argv[])
{
    struct hg_test_info hg_test_info = { 0 };
    unsigned int nhandles;
    size_t size;

    HG_Test_init(argc, argv, &hg_test_info);

    for (nhandles = 1; nhandles <= MAX_HANDLES; nhandles *= 2) {
        if (hg_test_info.na_test_info.mpi_comm_rank == 0) {
            fprintf(stdout, "# %s v%s\n", BENCHMARK_NAME, VERSION_NAME);
            fprintf(stdout, "# Loop %d times from size %d to %d byte(s) with "
                "%u handle(s)\n",
                MERCURY_TESTING_MAX_LOOP, 1, MAX_MSG_SIZE, nhandles);
#ifdef MERCURY_TESTING_HAS_VERIFY_DATA
            fprintf(stdout, "# WARNING verifying data, output will be slower\n");
#endif
            fprintf(stdout, "%-*s%*s\n", 10, "# Size", NWIDTH,
                "Bandwidth (MB/s)");
            fflush(stdout);
        }

        for (size = 1; size <= MAX_MSG_SIZE; size *= 2)
            measure_bulk_transfer(&hg_test_info, size, nhandles);

        fprintf(stdout, "\n");
    }

    HG_Test_finalize(&hg_test_info);

    return EXIT_SUCCESS;
}
Exemple #4
0
int
main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    hg_request_class_t *request_class = NULL;
    hg_addr_t addr;

    /* Initialize the interface (for convenience, shipper_test_client_init
     * initializes the network interface with the selected plugin)
     */
    hg_class = HG_Test_client_init(argc, argv, &addr, NULL, &context,
        &request_class);

    cancel_rpc(context, request_class, addr);

#ifdef NA_HAS_CCI
    if (strcmp(HG_Class_get_name(hg_class), "cci") == 0)
        cancel_bulk_transfer(hg_class, context, request_class, addr);
#endif

    HG_Test_finalize(hg_class);

    return EXIT_SUCCESS;
}
Exemple #5
0
int
main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    hg_request_class_t *request_class = NULL;
    hg_request_t *request = NULL;
    hg_handle_t handle;
    na_addr_t addr;
    rpc_open_in_t  rpc_open_in_struct;

    hg_const_string_t rpc_open_path = MERCURY_TESTING_TEMP_DIRECTORY "/test.h5";
    rpc_handle_t rpc_open_handle;
    hg_return_t hg_ret;

    /* Initialize the interface (for convenience, shipper_test_client_init
     * initializes the network interface with the selected plugin)
     */
    hg_class = HG_Test_client_init(argc, argv, &addr, NULL, &context,
            &request_class);

    request = hg_request_create(request_class);

    hg_ret = HG_Create(hg_class, context, addr, hg_test_rpc_open_id_g, &handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not start call\n");
        return EXIT_FAILURE;
    }

    /* Fill input structure */
    rpc_open_handle.cookie = 12345;
    rpc_open_in_struct.path = rpc_open_path;
    rpc_open_in_struct.handle = rpc_open_handle;

    /* Forward call to remote addr and get a new request */
    printf("Forwarding rpc_open, op id: %u...\n", hg_test_rpc_open_id_g);
    hg_ret = HG_Forward(handle, hg_test_rpc_forward_cb, request,
            &rpc_open_in_struct);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not forward call\n");
        return EXIT_FAILURE;
    }

    hg_request_wait(request, HG_MAX_IDLE_TIME, NULL);

    /* Complete */
    hg_ret = HG_Destroy(handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not complete\n");
        return EXIT_FAILURE;
    }

    hg_request_destroy(request);

    HG_Test_finalize(hg_class);

    return EXIT_SUCCESS;
}
Exemple #6
0
int
main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    hg_request_class_t *request_class = NULL;
    hg_request_t *request = NULL;
    hg_handle_t handle;
    hg_addr_t addr;
    hg_return_t hg_ret;

    /* Initialize the interface (for convenience, shipper_test_client_init
     * initializes the network interface with the selected plugin)
     */
    hg_class = HG_Test_client_init(argc, argv, &addr, NULL, &context,
            &request_class);

    request = hg_request_create(request_class);

    hg_ret = HG_Create(context, addr, hg_test_overflow_id_g, &handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not start call\n");
        return EXIT_FAILURE;
    }

    /* Forward call to remote addr and get a new request */
    printf("Forwarding call, op id: %u...\n", hg_test_overflow_id_g);
    hg_ret = HG_Forward(handle, hg_test_rpc_forward_cb, request, NULL);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not forward call\n");
        return EXIT_FAILURE;
    }

    hg_request_wait(request, HG_MAX_IDLE_TIME, NULL);

    /* Complete */
    hg_ret = HG_Destroy(handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not complete\n");
        return EXIT_FAILURE;
    }

    hg_request_destroy(request);

    HG_Test_finalize(hg_class);

    return EXIT_SUCCESS;
}
Exemple #7
0
int
main(int argc, char *argv[])
{
    unsigned int number_of_peers;
    unsigned int i;
    int hg_ret;

    /* Initialize the interface */
    network_class = HG_Test_server_init(argc, argv, NULL, NULL, &number_of_peers);

    hg_ret = HG_Init(network_class);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not initialize Mercury\n");
        return EXIT_FAILURE;
    }

    /* Register routine */
    MERCURY_HANDLER_REGISTER("bla_write", fs_bla_write, bla_write_in_t, bla_write_out_t);

    for (i = 0; i < number_of_peers; i++) {
        /* Receive new function calls */
        hg_ret = HG_Handler_process(HG_MAX_IDLE_TIME, HG_STATUS_IGNORE);
        if (hg_ret != HG_SUCCESS) {
            fprintf(stderr, "Could not receive function call\n");
            return EXIT_FAILURE;
        }
    }

    printf("Finalizing...\n");

    hg_ret = HG_Finalize();
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not finalize Mercury\n");
        return EXIT_FAILURE;
    }

    HG_Test_finalize(network_class);

    return EXIT_SUCCESS;
}
Exemple #8
0
int
main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    hg_request_class_t *request_class = NULL;
    na_addr_t addr;

    hg_class = HG_Test_client_init(argc, argv, &addr, &na_test_comm_rank_g,
            &context, &request_class);

    /* Run RPC test */
    measure_rpc(hg_class, context, addr, request_class);

    NA_Test_barrier();

    /* Run Bulk test */
    measure_bulk_transfer(hg_class, context, addr, request_class);

    HG_Test_finalize(hg_class);

    return EXIT_SUCCESS;
}
Exemple #9
0
int main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    hg_request_class_t *request_class = NULL;
    hg_request_t *request = NULL;
    hg_handle_t handle;
    hg_addr_t addr;

    bulk_write_in_t bulk_write_in_struct;

    int fildes = 12345;
    int *bulk_buf = NULL;
    void *buf_ptr[1];
    size_t count =  (1024 * 1024 * MERCURY_TESTING_BUFFER_SIZE) / sizeof(int);
    size_t bulk_size = count * sizeof(int);
    hg_bulk_t bulk_handle = HG_BULK_NULL;

    hg_return_t hg_ret;
    size_t i;

    /* Prepare bulk_buf */
    bulk_buf = (int*) malloc(bulk_size);
    for (i = 0; i < count; i++) {
        bulk_buf[i] = i;
    }
    *buf_ptr = bulk_buf;

    /* Initialize the interface (for convenience, shipper_test_client_init
     * initializes the network interface with the selected plugin)
     */
    hg_class = HG_Test_client_init(argc, argv, &addr, NULL, &context,
            &request_class);

    request = hg_request_create(request_class);

    hg_ret = HG_Create(context, addr, hg_test_bulk_write_id_g, &handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not start call\n");
        return EXIT_FAILURE;
    }

    /* Register memory */
    hg_ret = HG_Bulk_create(hg_class, 1, buf_ptr, &bulk_size,
            HG_BULK_READ_ONLY, &bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not create bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Fill input structure */
    bulk_write_in_struct.fildes = fildes;
    bulk_write_in_struct.bulk_handle = bulk_handle;

    /* Forward call to remote addr and get a new request */
    printf("Forwarding bulk_write, op id: %u...\n", hg_test_bulk_write_id_g);
    hg_ret = HG_Forward(handle, hg_test_bulk_forward_cb, request,
            &bulk_write_in_struct);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not forward call\n");
        return EXIT_FAILURE;
    }

    hg_request_wait(request, HG_MAX_IDLE_TIME, NULL);

    /* Free memory handle */
    hg_ret = HG_Bulk_free(bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not free bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Complete */
    hg_ret = HG_Destroy(handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not complete\n");
        return EXIT_FAILURE;
    }

    hg_request_destroy(request);

    HG_Test_finalize(hg_class);

    /* Free bulk data */
    free(bulk_buf);

    return EXIT_SUCCESS;
}
Exemple #10
0
int main(int argc, char *argv[])
{
    hg_class_t *hg_class = NULL;
    hg_context_t *context = NULL;
    hg_request_class_t *request_class = NULL;
    hg_request_t *request = NULL;
    hg_handle_t handle;
    hg_addr_t addr;

    bulk_write_in_t bulk_write_in_struct;

    int fildes = 12345;
    void **bulk_buf;
    size_t *bulk_sizes;
    size_t bulk_size = 1024 * 1024 * MERCURY_TESTING_BUFFER_SIZE / sizeof(int);
    size_t bulk_size_x = 16;
    size_t bulk_size_y = 0;
    size_t *bulk_size_y_var = NULL;
    hg_bulk_t bulk_handle = HG_BULK_NULL;

    hg_return_t hg_ret;
    size_t i, j;

    /* Initialize the interface (for convenience, shipper_test_client_init
     * initializes the network interface with the selected plugin)
     */
    hg_class = HG_Test_client_init(argc, argv, &addr, NULL, &context,
            &request_class);

    request = hg_request_create(request_class);

    hg_ret = HG_Create(context, addr, hg_test_bulk_seg_write_id_g, &handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not start call\n");
        return EXIT_FAILURE;
    }

    /* This will create a list of variable size segments */
    if (na_test_use_variable_g) {
        printf("Using variable size segments!\n");
        /* bulk_size_x >= 2 */
        /* 524288 + 262144 + 131072 + 65536 + 32768 + 16384 + 8192 + 8192 */
        bulk_size_x = 8;
        bulk_size_y_var = (size_t*) malloc(bulk_size_x * sizeof(size_t));
        bulk_size_y_var[0] = bulk_size / 2;
        for (i = 1; i < bulk_size_x - 1; i++) {
            bulk_size_y_var[i] = bulk_size_y_var[i-1] / 2;
        }
        bulk_size_y_var[bulk_size_x - 1] = bulk_size_y_var[bulk_size_x - 2];
    }
    /* This will use an extra encoding buffer */
    else if (na_test_use_extra_g) {
        printf("Using large number of segments!\n");
        bulk_size_x = 1024;
        bulk_size_y = bulk_size / bulk_size_x;
    }
    else {
        /* This will create a list of fixed size segments */
        bulk_size_y = bulk_size / bulk_size_x;
    }

    /* Prepare bulk_buf */
    bulk_buf = (void **) malloc(bulk_size_x * sizeof(void *));
    bulk_sizes = (size_t *) malloc(bulk_size_x * sizeof(size_t));
    if (bulk_size_y_var) {
        int val = 0;
        for (i = 0; i < bulk_size_x; i++) {
            bulk_sizes[i] = bulk_size_y_var[i] * sizeof(int);
            bulk_buf[i] = malloc(bulk_sizes[i]);
            for (j = 0; j < bulk_size_y_var[i]; j++) {
                ((int **) (bulk_buf))[i][j] = val;
                val++;
            }
        }
    } else {
        for (i = 0; i < bulk_size_x; i++) {
            bulk_sizes[i] = bulk_size_y * sizeof(int);
            bulk_buf[i] = malloc(bulk_sizes[i]);
            for (j = 0; j < bulk_size_y; j++) {
                ((int **) (bulk_buf))[i][j] = i * bulk_size_y + j;
            }
        }
    }

    /* Register memory */
    hg_ret = HG_Bulk_create(hg_class, bulk_size_x, bulk_buf, bulk_sizes,
            HG_BULK_READ_ONLY, &bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not create bulk data handle\n");
        return EXIT_FAILURE;
    }

    free(bulk_sizes);
    bulk_sizes = NULL;
    if (bulk_size_y_var) free(bulk_size_y_var);
    bulk_size_y_var = NULL;

    /* Fill input structure */
    bulk_write_in_struct.fildes = fildes;
    bulk_write_in_struct.bulk_handle = bulk_handle;

    /* Forward call to remote addr and get a new request */
    printf("Forwarding bulk_write, op id: %u...\n", hg_test_bulk_seg_write_id_g);
    hg_ret = HG_Forward(handle, hg_test_bulk_seg_forward_cb, request,
            &bulk_write_in_struct);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not forward call\n");
        return EXIT_FAILURE;
    }

    hg_request_wait(request, HG_MAX_IDLE_TIME, NULL);

    /* Free memory handle */
    hg_ret = HG_Bulk_free(bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not free bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Complete */
    hg_ret = HG_Destroy(handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not complete\n");
        return EXIT_FAILURE;
    }

    hg_request_destroy(request);

    HG_Test_finalize(hg_class);

    /* Free bulk_buf */
    for (i = 0; i < bulk_size_x; i++) {
        free(bulk_buf[i]);
        bulk_buf[i] = NULL;
    }
    free(bulk_buf);
    bulk_buf = NULL;

    return EXIT_SUCCESS;
}
Exemple #11
0
int main(int argc, char *argv[])
{
    na_addr_t addr;

    bulk_write_in_t bulk_write_in_struct;
    bulk_write_out_t bulk_write_out_struct;
    hg_request_t bulk_write_request;

    int fildes = 12345;
    int *bulk_buf;
    void *buf_ptr[1];
    size_t count = (1024 * 1024 * MERCURY_TESTING_BUFFER_SIZE) / sizeof(int);
    size_t bulk_size = count * sizeof(int);
    hg_bulk_t bulk_handle = HG_BULK_NULL;
    size_t bulk_write_ret = 0;

    hg_status_t bla_open_status;
    hg_return_t hg_ret;
    size_t i;

    /* Initialize the interface (for convenience, shipper_test_client_init
     * initializes the network interface with the selected plugin)
     */
    HG_Test_client_init(argc, argv, &addr, NULL);

    /* Prepare bulk_buf */
    bulk_buf = (int*) malloc(bulk_size);
    for (i = 0; i < count; i++) {
        bulk_buf[i] = (int) i;
    }
    *buf_ptr = bulk_buf;

    /* Register memory */
    hg_ret = HG_Bulk_handle_create(1, buf_ptr, &bulk_size,
            HG_BULK_READ_ONLY, &bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not create bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Fill input structure */
    bulk_write_in_struct.fildes = fildes;
    bulk_write_in_struct.bulk_handle = bulk_handle;

    /* Forward call to remote addr and get a new request */
    /* printf("Forwarding bulk_write, op id: %u...\n", hg_test_bulk_write_id_g); */
    hg_ret = HG_Forward(addr, hg_test_pipeline_write_id_g,
            &bulk_write_in_struct, &bulk_write_out_struct, &bulk_write_request);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not forward call\n");
        return EXIT_FAILURE;
    }

    /* Wait for call to be executed and return value to be sent back
     * (Request is freed when the call completes)
     */
    hg_ret = HG_Wait(bulk_write_request, HG_MAX_IDLE_TIME, &bla_open_status);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Error during wait\n");
        return EXIT_FAILURE;
    }
    if (!bla_open_status) {
        fprintf(stderr, "Operation did not complete\n");
        return EXIT_FAILURE;
    } else {
        /* printf("Call completed\n"); */
    }

    /* Get output parameters */
    bulk_write_ret = bulk_write_out_struct.ret;
    if (bulk_write_ret != bulk_size) {
        fprintf(stderr, "Data not correctly processed\n");
    }

    /* Free request */
    hg_ret = HG_Request_free(bulk_write_request);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not free request\n");
        return EXIT_FAILURE;
    }

    /* Free memory handle */
    hg_ret = HG_Bulk_handle_free(bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not free bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Free bulk_buf */
    free(bulk_buf);
    bulk_buf = NULL;

    HG_Test_finalize();

    return EXIT_SUCCESS;
}
Exemple #12
0
int main(int argc, char *argv[])
{
    struct hg_test_info hg_test_info = { 0 };
    hg_request_t *request = NULL;
    hg_handle_t handle;

    bulk_write_in_t bulk_write_in_struct;

    int fildes = 12345;
    int *bulk_buf = NULL;
    void *buf_ptrs[2];
    size_t buf_sizes[2];
    size_t count =  (1024 * 1024 * MERCURY_TESTING_BUFFER_SIZE) / sizeof(int);
    size_t bulk_size = count * sizeof(int);
    hg_bulk_t bulk_handle = HG_BULK_NULL;

    hg_return_t hg_ret;
    size_t i;

    /* Prepare bulk_buf */
    bulk_buf = (int *) malloc(bulk_size);
    for (i = 0; i < count; i++) {
        bulk_buf[i] = (int) i;
    }
    buf_ptrs[0] = bulk_buf;
    buf_sizes[0] = bulk_size;
    buf_ptrs[1] = NULL;
    buf_sizes[1] = 0;

    /* Initialize the interface */
    HG_Test_init(argc, argv, &hg_test_info);

    request = hg_request_create(hg_test_info.request_class);

    hg_ret = HG_Create(hg_test_info.context, hg_test_info.target_addr,
        hg_test_bulk_write_id_g, &handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not start call\n");
        return EXIT_FAILURE;
    }

    /* Register memory */
    hg_ret = HG_Bulk_create(hg_test_info.hg_class, 2, buf_ptrs,
        (hg_size_t *) buf_sizes, HG_BULK_READ_ONLY, &bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not create bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Fill input structure */
    bulk_write_in_struct.fildes = fildes;
    bulk_write_in_struct.bulk_handle = bulk_handle;

    /* Forward call to remote addr and get a new request */
    printf("Forwarding bulk_write, op id: %u...\n", hg_test_bulk_write_id_g);
    hg_ret = HG_Forward(handle, hg_test_bulk_forward_cb, request,
            &bulk_write_in_struct);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not forward call\n");
        return EXIT_FAILURE;
    }

    hg_request_wait(request, HG_MAX_IDLE_TIME, NULL);

    /* Free memory handle */
    hg_ret = HG_Bulk_free(bulk_handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not free bulk data handle\n");
        return EXIT_FAILURE;
    }

    /* Complete */
    hg_ret = HG_Destroy(handle);
    if (hg_ret != HG_SUCCESS) {
        fprintf(stderr, "Could not complete\n");
        return EXIT_FAILURE;
    }

    hg_request_destroy(request);

    HG_Test_finalize(&hg_test_info);

    /* Free bulk data */
    free(bulk_buf);

    return EXIT_SUCCESS;
}