model-net-method.h 2.89 KB
Newer Older
1
/*
2
 * Copyright (C) 2013 University of Chicago.
3
 * See COPYRIGHT notice in top-level directory.
4
 *
5 6 7 8 9 10 11
 */

#ifndef MODELNET_METHOD_H
#define MODELNET_METHOD_H

#include <ross.h>

12 13 14 15 16 17
// forward decl of model_net_method since we currently have a circular include
// (method needs sched def, sched needs method def)
struct model_net_method;

#include "codes/model-net-sched.h"

Jonathan Jenkins's avatar
Jonathan Jenkins committed
18 19
// interface that each model-net model implements

20 21
struct model_net_method
{
22
    uint64_t packet_size; /* packet size */
23
    void (*mn_configure)(); /* For initializing the network */
24 25 26 27 28
    /* Register lp types with ROSS. This may be left as NULL, in which case the
     * type corresponding to name "modelnet_<type>" will be registered
     * automatically. Most networks don't need this (currently, only dragonfly
     * uses it) */
    void (*mn_register)(tw_lptype *base_type);
29
    tw_stime (*model_net_method_packet_event)(
30
        char const * category, 
31
        tw_lpid final_dest_lp, 
32
        tw_lpid dest_mn_lp, // destination modelnet lp, computed by sender
33
        uint64_t packet_size, 
34 35
        int is_pull,
        uint64_t pull_size, /* only used when is_pull==1 */
36
        tw_stime offset,
37 38 39 40 41 42
        // this parameter is used to propagate message specific parameters
        // to modelnet models that need it. Required by routing-related
        // functions (currently just model_net_method_send_msg_recv_event)
        //
        // TODO: make this param more general
        const mn_sched_params *sched_params,
43 44 45 46
        int remote_event_size,  /* 0 means don't deliver remote event */
        const void* remote_event,
        int self_event_size,    /* 0 means don't deliver self event */
        const void* self_event,
47 48
        tw_lpid src_lp, // original caller of model_net_(pull_)event
        tw_lp *sender, // lp message is being called from (base LP)
49 50
	int is_last_pckt);
    void (*model_net_method_packet_event_rc)(tw_lp *sender);
51 52 53 54 55 56 57 58 59 60 61 62
    tw_stime (*model_net_method_recv_msg_event)(
            const char * category,
            tw_lpid final_dest_lp,
            uint64_t msg_size,
            int is_pull,
            uint64_t pull_size,
            tw_stime offset,
            int remote_event_size,
            const void* remote_event,
            tw_lpid src_lp, // original caller of model_net_(pull_)event
            tw_lp *sender); // lp message is being called from (base LP)
    void (*model_net_method_recv_msg_event_rc)(tw_lp *lp);
63 64
    const tw_lptype* (*mn_get_lp_type)();
    int (*mn_get_msg_sz)();
65
    void (*mn_report_stats)();
66
    void (*mn_collective_call)(char const * category, int message_size, int remote_event_size, const void* remote_event, tw_lp* sender);
67
    void (*mn_collective_call_rc)(int message_size, tw_lp* sender);    
68 69
};

70 71
extern struct model_net_method * method_array[];

72 73 74 75 76 77 78 79 80 81
#endif /* MODELNET_METHOD_H */

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */