Exemplo n.º 1
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;
}
Exemplo n.º 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;
}
Exemplo n.º 3
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;
}