bb-copy-to.c 1.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
/*
 * (C) 2015 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */

#include <stdio.h>
#include <assert.h>
#include <unistd.h>

#include "abt.h"
#include "abt-snoozer.h"
#include "bake-bulk.h"

/* client program that will shut down a BAKE bulk server. */

int main(int argc, char **argv) 
{
    int ret;
    bake_target_id_t bti;
    bake_bulk_region_id_t rid;
 
    if(argc != 2)
    {
        fprintf(stderr, "Usage: bb-copy-to <server addr>\n");
        fprintf(stderr, "  Example: ./bb-copy-to tcp://localhost:1234\n");
        return(-1);
    }       

    /* set up Argobots */
    ret = ABT_init(argc, argv);
    if(ret != 0)
    {
        fprintf(stderr, "Error: ABT_init()\n");
        return(-1);
    }
    ret = ABT_snoozer_xstream_self_set();
    if(ret != 0)
    {
        fprintf(stderr, "Error: ABT_snoozer_xstream_self_set()\n");
        return(-1);
    }

    ret = bake_probe_instance(argv[1], &bti);
    if(ret < 0)
    {
        fprintf(stderr, "Error: bake_probe_instance()\n");
        return(-1);
    }

    /* TODO: find local file, check it's size */

    /* TODO: create appropriate size region */
    ret = bake_bulk_create(bti, 1024, &rid);
Philip Carns's avatar
Philip Carns committed
55
    if(ret != 0)
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
    {
        fprintf(stderr, "Error: bake_bulk_create()\n");
        return(-1);
    }

    /* TODO: a way to print region id */

    /* TODO: data transfer */

    bake_release_instance(bti);
    
    ABT_finalize();

    return(0);
}