model-net.c 21.3 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
#include <string.h>
#include <assert.h>

10
#include "codes/model-net.h"
11
#include "codes/model-net-method.h"
12
#include "codes/model-net-lp.h"
13
#include "codes/model-net-sched.h"
14
#include "codes/codes.h"
15
#include <codes/codes_mapping.h>
16

17

18 19 20 21
#define STR_SIZE 16
#define PROC_TIME 10.0

extern struct model_net_method simplenet_method;
22
extern struct model_net_method simplep2p_method;
23
extern struct model_net_method torus_method;
24
extern struct model_net_method dragonfly_method;
25
extern struct model_net_method dragonfly_custom_method;
26 27
extern struct model_net_method dragonfly_plus_method;
extern struct model_net_method dragonfly_plus_router_method;
28
extern struct model_net_method slimfly_method;
29
extern struct model_net_method fattree_method;
30
extern struct model_net_method dragonfly_router_method;
31
extern struct model_net_method dragonfly_custom_router_method;
Philip Carns's avatar
Philip Carns committed
32
extern struct model_net_method loggp_method;
33 34
extern struct model_net_method express_mesh_method;
extern struct model_net_method express_mesh_router_method;
35

36 37 38 39 40 41 42 43 44 45 46 47
#define X(a,b,c,d) b,
char * model_net_lp_config_names[] = {
    NETWORK_DEF
};
#undef X

#define X(a,b,c,d) c,
char * model_net_method_names[] = {
    NETWORK_DEF
};
#undef X

48
/* Global array initialization, terminated with a NULL entry */
49
#define X(a,b,c,d) d,
50
struct model_net_method* method_array[] = {
51 52 53
    NETWORK_DEF
};
#undef X
54

55
// counter and offset for the MN_START_SEQ / MN_END_SEQ macros
56
int mn_in_sequence = 0;
57 58
tw_stime mn_msg_offset = 0.0;

59 60
// message parameters for use via model_net_set_msg_param
static int is_msg_params_set[MAX_MN_MSG_PARAM_TYPES];
61 62
static mn_sched_params sched_params; // MN_MSG_PARAM_SCHED
static tw_stime start_time_param; // MN_MSG_PARAM_START_TIME
Nikhil's avatar
Nikhil committed
63
static double cn_bandwidth = 20;
Nikhil's avatar
Nikhil committed
64 65
tw_stime codes_cn_delay;
static int codes_node_eager_limit = 16000;
66

67 68 69 70 71 72 73 74 75 76 77
// global listing of lp types found by model_net_register
// - needs to be held between the register and configure calls
static int do_config_nets[MAX_NETS];

void model_net_register(){
    // first set up which networks need to be registered, then pass off to base
    // LP to do its thing
    memset(do_config_nets, 0, MAX_NETS * sizeof(*do_config_nets));
    for (int grp = 0; grp < lpconf.lpgroups_count; grp++){
        config_lpgroup_t *lpgroup = &lpconf.lpgroups[grp];
        for (int lpt = 0; lpt < lpgroup->lptypes_count; lpt++){
78
            char const *nm = lpgroup->lptypes[lpt].name.ptr;
79
            for (int n = 0; n < MAX_NETS; n++){
80
                if (!do_config_nets[n] &&
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
                        strcmp(model_net_lp_config_names[n], nm) == 0){
                    do_config_nets[n] = 1;
                    break;
                }
            }
        }
    }
    model_net_base_register(do_config_nets);
}

int* model_net_configure(int *id_count){
    // first call the base LP configure, which sets up the general parameters
    model_net_base_configure();

    // do network-specific configures
    *id_count = 0;
    for (int i = 0; i < MAX_NETS; i++) {
        if (do_config_nets[i]){
99 100 101 102
            // some don't need configuration (dragonfly router is covered by
            // dragonfly)
            if (method_array[i]->mn_configure != NULL)
                method_array[i]->mn_configure();
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
            (*id_count)++;
        }
    }

    // allocate the output
    int *ids = malloc(*id_count * sizeof(int));
    // read the ordering provided by modelnet_order
    char **values;
    size_t length;
    int ret = configuration_get_multivalue(&config, "PARAMS", "modelnet_order",
            NULL, &values, &length);
    if (ret != 1){
        tw_error(TW_LOC, "unable to read PARAMS:modelnet_order variable\n");
    }
    if (length != (size_t) *id_count){
        tw_error(TW_LOC, "number of networks in PARAMS:modelnet_order "
                "do not match number in LPGROUPS\n");
    }
    // set the index
    for (int i = 0; i < *id_count; i++){
        ids[i] = -1;
        for (int n = 0; n < MAX_NETS; n++){
            if (strcmp(values[i], model_net_method_names[n]) == 0){
                if (!do_config_nets[n]){
                    tw_error(TW_LOC, "network in PARAMS:modelnet_order not "
                            "present in LPGROUPS: %s\n", values[i]);
                }
                ids[i] = n;
                break;
            }
        }
        if (ids[i] == -1){
            tw_error(TW_LOC, "unknown network in PARAMS:modelnet_order: %s\n",
                    values[i]);
        }
        free(values[i]);
    }
    free(values);

142 143 144
    // init the per-msg params here
    memset(is_msg_params_set, 0,
            MAX_MN_MSG_PARAM_TYPES*sizeof(*is_msg_params_set));
145

Nikhil's avatar
Nikhil committed
146 147 148 149 150 151 152 153 154 155 156
    ret = configuration_get_value_double(&config, "PARAMS", "intra_bandwidth", NULL,
            &cn_bandwidth);
    if(ret && !g_tw_mynode) {
        fprintf(stderr, "Bandwidth of compute node channels not specified, "
                "setting to %lf\n", cn_bandwidth);
    }

    codes_cn_delay = 1/cn_bandwidth;
    if(!g_tw_mynode) {
        printf("within node transfer per byte delay is %f\n", codes_cn_delay);
    }
157

Nikhil's avatar
Nikhil committed
158 159 160 161 162 163
    ret = configuration_get_value_int(&config, "PARAMS", "node_eager_limit", NULL,
            &codes_node_eager_limit);
    if(ret && !g_tw_mynode) {
        fprintf(stderr, "Within-node eager limit (node_eager_limit) not specified, "
                "setting to %d\n", codes_node_eager_limit);
    }
164

165
    return ids;
166 167
}

168 169 170
int model_net_get_id(char *name){
    int i;
    for(i=0; method_array[i] != NULL; i++) {
171
        if(strcmp(model_net_method_names[i], name) == 0) {
172 173 174 175 176 177
            return i;
        }
    }
    return -1;
}

178 179 180
void model_net_write_stats(tw_lpid lpid, struct mn_stats* stat)
{
    int ret;
181
    char id[19+CATEGORY_NAME_MAX+1];
182 183 184
    char data[1024];

    sprintf(id, "model-net-category-%s", stat->category);
185
    sprintf(data, "lp:%ld\tsend_count:%ld\tsend_bytes:%ld\tsend_time:%f\t"
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
        "recv_count:%ld\trecv_bytes:%ld\trecv_time:%f\tmax_event_size:%ld\n",
        (long)lpid,
        stat->send_count,
        stat->send_bytes,
        stat->send_time,
        stat->recv_count,
        stat->recv_bytes,
        stat->recv_time,
        stat->max_event_size);

    ret = lp_io_write(lpid, id, strlen(data), data);
    assert(ret == 0);

    return;
}

void model_net_print_stats(tw_lpid lpid, mn_stats mn_stats_array[])
{

    int i;
    struct mn_stats all;

    memset(&all, 0, sizeof(all));
    sprintf(all.category, "all");

    for(i=0; i<CATEGORY_MAX; i++)
    {
        if(strlen(mn_stats_array[i].category) > 0)
        {
            all.send_count += mn_stats_array[i].send_count;
            all.send_bytes += mn_stats_array[i].send_bytes;
            all.send_time += mn_stats_array[i].send_time;
            all.recv_count += mn_stats_array[i].recv_count;
            all.recv_bytes += mn_stats_array[i].recv_bytes;
            all.recv_time += mn_stats_array[i].recv_time;
            if(mn_stats_array[i].max_event_size > all.max_event_size)
                all.max_event_size = mn_stats_array[i].max_event_size;

            model_net_write_stats(lpid, &mn_stats_array[i]);
        }
    }
    model_net_write_stats(lpid, &all);
}

230
struct mn_stats* model_net_find_stats(char const * category, mn_stats mn_stats_array[])
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
{
    int i;
    int new_flag = 0;
    int found_flag = 0;

    for(i=0; i<CATEGORY_MAX; i++)
    {
        if(strlen(mn_stats_array[i].category) == 0)
        {
            found_flag = 1;
            new_flag = 1;
            break;
        }
        if(strcmp(category, mn_stats_array[i].category) == 0)
        {
            found_flag = 1;
            new_flag = 0;
            break;
        }
    }
    assert(found_flag);

    if(new_flag)
    {
        strcpy(mn_stats_array[i].category, category);
    }
    return(&mn_stats_array[i]);
}

260 261 262 263
static model_net_event_return model_net_noop_event(
        tw_lpid final_dest_lp,
        int is_pull,
        tw_stime offset,
Nikhil's avatar
Nikhil committed
264
        uint64_t message_size,
265 266 267 268 269 270 271 272
        int remote_event_size,
        void const * remote_event,
        int self_event_size,
        void const * self_event,
        tw_lp *sender)
{
    model_net_event_return num_rng_calls = 0;
    tw_stime poffset = mn_in_sequence ? mn_msg_offset : 0.0;
Nikhil's avatar
Nikhil committed
273 274 275
    tw_stime delay = codes_local_latency(sender);

    tw_stime sendTime = message_size * codes_cn_delay;
276 277

    if (self_event_size && self_event != NULL) {
Nikhil's avatar
Nikhil committed
278
        poffset += delay;
279
        num_rng_calls++;
Nikhil's avatar
Nikhil committed
280
        tw_event *e = tw_event_new(sender->gid, poffset+offset+sendTime, sender);
281 282 283 284 285
        memcpy(tw_event_data(e), self_event, self_event_size);
        tw_event_send(e);
    }

    if (remote_event_size && remote_event != NULL) {
Nikhil's avatar
Nikhil committed
286
        poffset += delay;
287
        num_rng_calls++;
288 289 290
        /* special case - in a "pull" event, the "remote" message is actually
         * to self */
        tw_event *e = tw_event_new(is_pull ? sender->gid : final_dest_lp,
Nikhil's avatar
Nikhil committed
291
                poffset+offset+sendTime, sender);
292 293 294 295 296 297 298 299 300 301 302
        memcpy(tw_event_data(e), remote_event, remote_event_size);
        tw_event_send(e);
    }

    if (mn_in_sequence)
        mn_msg_offset += poffset;

    return num_rng_calls;
}

static model_net_event_return model_net_event_impl_base(
303
        int net_id,
304 305
        struct codes_mctx const * send_map_ctx,
        struct codes_mctx const * recv_map_ctx,
306 307 308
        char const * category,
        tw_lpid final_dest_lp,
        uint64_t message_size,
309 310 311
        int is_pull,
        tw_stime offset,
        int remote_event_size,
312
        void const * remote_event,
313
        int self_event_size,
314
        void const * self_event,
315
        tw_lp *sender) {
316

317
    if (remote_event_size + self_event_size + sizeof(model_net_wrap_msg)
318 319 320 321 322
            > g_tw_msg_sz){
        tw_error(TW_LOC, "Error: model_net trying to transmit an event of size "
                         "%d but ROSS is configured for events of size %zd\n",
                         remote_event_size+self_event_size+sizeof(model_net_wrap_msg),
                         g_tw_msg_sz);
323
        return -1;
324
    }
325

326 327 328 329 330
    tw_lpid src_mn_lp = model_net_find_local_device_mctx(net_id, send_map_ctx,
            sender->gid);
    tw_lpid dest_mn_lp = model_net_find_local_device_mctx(net_id, recv_map_ctx,
            final_dest_lp);

331
    if (src_mn_lp == dest_mn_lp && message_size < (uint64_t)codes_node_eager_limit)
Nikhil's avatar
Nikhil committed
332
        return model_net_noop_event(final_dest_lp, is_pull, offset, message_size,
333 334 335
                remote_event_size, remote_event, self_event_size, self_event,
                sender);

336
    tw_stime poffset = codes_local_latency(sender);
337
    if (mn_in_sequence){
338 339 340 341
        tw_stime tmp = mn_msg_offset;
        mn_msg_offset += poffset;
        poffset += tmp;
    }
342 343

    tw_event *e = tw_event_new(src_mn_lp, poffset+offset, sender);
344 345

    model_net_wrap_msg *m = tw_event_data(e);
346
    msg_set_header(model_net_base_magic, MN_BASE_NEW_MSG, sender->gid, &m->h);
347

348
    // set the request struct
349
    model_net_request *r = &m->msg.m_base.req;
350
    r->final_dest_lp = final_dest_lp;
351
    r->dest_mn_lp = dest_mn_lp;
352
    r->src_lp = sender->gid;
353 354 355 356 357 358 359 360 361 362
    r->is_pull = is_pull;
    if (r->is_pull) {
        r->msg_size = PULL_MSG_SIZE;
        r->pull_size = message_size;
    }
    else {
        r->msg_size = message_size;
        r->pull_size = 0;
    }
    r->net_id = net_id;
363 364 365 366
    r->remote_event_size = remote_event_size;
    r->self_event_size = self_event_size;
    strncpy(r->category, category, CATEGORY_NAME_MAX-1);
    r->category[CATEGORY_NAME_MAX-1]='\0';
367

368 369 370 371 372
    if (is_msg_params_set[MN_MSG_PARAM_START_TIME])
        r->msg_start_time = start_time_param;
    else
        r->msg_start_time = tw_now(sender);

373 374
    // this is an outgoing message
    m->msg.m_base.is_from_remote = 0;
Nikhil's avatar
Nikhil committed
375
    m->msg.m_base.isQueueReq = 1;
376

377 378 379 380
    // set the msg-specific params
    if (is_msg_params_set[MN_SCHED_PARAM_PRIO])
        m->msg.m_base.sched_params = sched_params;
    else // set the default
381
        model_net_sched_set_default_params(&m->msg.m_base.sched_params);
382
    // once params are set, clear the flags
383 384 385
    memset(is_msg_params_set, 0,
            MAX_MN_MSG_PARAM_TYPES*sizeof(*is_msg_params_set));

386 387 388
    void *e_msg = (m+1);
    if (remote_event_size > 0){
        memcpy(e_msg, remote_event, remote_event_size);
389
        e_msg = (char*)e_msg + remote_event_size;
390 391 392 393
    }
    if (self_event_size > 0){
        memcpy(e_msg, self_event, self_event_size);
    }
394

395 396
    //print_base(m);
    tw_event_send(e);
397 398

    return 1;
399 400 401
}
static void model_net_event_impl_base_rc(tw_lp *sender){
    codes_local_latency_reverse(sender);
402
}
403

404
model_net_event_return model_net_event(
405
    int net_id,
406 407 408
    char const * category,
    tw_lpid final_dest_lp,
    uint64_t message_size,
409 410
    tw_stime offset,
    int remote_event_size,
411
    void const * remote_event,
412
    int self_event_size,
413
    void const * self_event,
414 415
    tw_lp *sender)
{
416 417 418 419
    return model_net_event_impl_base(net_id, CODES_MCTX_DEFAULT,
            CODES_MCTX_DEFAULT, category, final_dest_lp, message_size, 0,
            offset, remote_event_size, remote_event, self_event_size,
            self_event, sender);
420 421
}

422
model_net_event_return model_net_event_annotated(
423
        int net_id,
424
        char const * annotation,
425 426 427
        char const * category,
        tw_lpid final_dest_lp,
        uint64_t message_size,
428 429
        tw_stime offset,
        int remote_event_size,
430
        void const * remote_event,
431
        int self_event_size,
432
        void const * self_event,
433
        tw_lp *sender){
434
    struct codes_mctx mc = codes_mctx_set_group_modulo(annotation, false);
435
    return model_net_event_impl_base(net_id, &mc, &mc, category, final_dest_lp,
436 437
            message_size, 0, offset, remote_event_size, remote_event,
            self_event_size, self_event, sender);
438 439
}

440
model_net_event_return model_net_event_mctx(
441 442 443
        int net_id,
        struct codes_mctx const * send_map_ctx,
        struct codes_mctx const * recv_map_ctx,
444 445 446
        char const * category,
        tw_lpid final_dest_lp,
        uint64_t message_size,
447 448 449 450 451 452
        tw_stime offset,
        int remote_event_size,
        void const * remote_event,
        int self_event_size,
        void const * self_event,
        tw_lp *sender){
453 454 455 456
    return model_net_event_impl_base(net_id, send_map_ctx, recv_map_ctx,
            category, final_dest_lp, message_size, 0, offset,
            remote_event_size, remote_event, self_event_size, self_event,
            sender);
457 458
}

459
model_net_event_return model_net_pull_event(
460
        int net_id,
461
        char const *category,
462 463 464 465
        tw_lpid final_dest_lp,
        uint64_t message_size,
        tw_stime offset,
        int self_event_size,
466
        void const *self_event,
467 468 469
        tw_lp *sender){
    /* NOTE: for a pull, we are filling the *remote* event - it will be remote
     * from the destination's POV */
470 471 472
    return model_net_event_impl_base(net_id, CODES_MCTX_DEFAULT,
            CODES_MCTX_DEFAULT, category, final_dest_lp, message_size, 1,
            offset, self_event_size, self_event, 0, NULL, sender);
473 474
}

475
model_net_event_return model_net_pull_event_annotated(
476
        int net_id,
477 478
        char const * annotation,
        char const *category,
479 480 481 482
        tw_lpid final_dest_lp,
        uint64_t message_size,
        tw_stime offset,
        int self_event_size,
483
        void const *self_event,
484 485 486
        tw_lp *sender){
    /* NOTE: for a pull, we are filling the *remote* event - it will be remote
     * from the destination's POV */
487
    struct codes_mctx mc = codes_mctx_set_group_modulo(annotation, false);
488
    return model_net_event_impl_base(net_id, &mc, &mc, category, final_dest_lp,
489 490
            message_size, 1, offset, self_event_size, self_event, 0, NULL,
            sender);
491 492
}

493
model_net_event_return model_net_pull_event_mctx(
494
        int net_id,
495 496
        struct codes_mctx const * send_map_ctx,
        struct codes_mctx const * recv_map_ctx,
497 498 499 500 501 502 503 504 505
        char const *category,
        tw_lpid final_dest_lp,
        uint64_t message_size,
        tw_stime offset,
        int self_event_size,
        void const *self_event,
        tw_lp *sender){
    /* NOTE: for a pull, we are filling the *remote* event - it will be remote
     * from the destination's POV */
506 507
    return model_net_event_impl_base(net_id, send_map_ctx, recv_map_ctx,
            category, final_dest_lp, message_size, 1, offset, self_event_size,
508 509 510
            self_event, 0, NULL, sender);
}

511 512 513 514 515 516 517 518
void model_net_event_rc2(
        tw_lp *sender,
        model_net_event_return const * ret)
{
    for (int i = 0; i < *ret; i++)
        codes_local_latency_reverse(sender);
}

519 520 521 522
void model_net_event_rc(
        int net_id,
        tw_lp *sender,
        uint64_t message_size){
523 524
    (void)net_id;
    (void)message_size;
525
    model_net_event_impl_base_rc(sender);
526 527 528 529 530
}

void model_net_pull_event_rc(
        int net_id,
        tw_lp *sender) {
531
    (void)net_id;
532
    model_net_event_impl_base_rc(sender);
533 534
}

535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
void model_net_set_msg_param(
        enum msg_param_type type,
        int sub_type,
        const void * params){
    switch(type){
        case MN_MSG_PARAM_SCHED:
            is_msg_params_set[MN_MSG_PARAM_SCHED] = 1;
            switch(sub_type){
                case MN_SCHED_PARAM_PRIO:
                    sched_params.prio = *(int*)params;
                    break;
                default:
                    tw_error(TW_LOC, "unknown or unsupported "
                            "MN_MSG_PARAM_SCHED parameter type");
            }
            break;
551 552 553 554 555 556 557 558 559 560 561
        case MN_MSG_PARAM_START_TIME:
            is_msg_params_set[MN_MSG_PARAM_START_TIME] = 1;
            switch(sub_type){
                case MN_MSG_PARAM_START_TIME_VAL:
                    start_time_param = *(tw_stime*)params;
                    break;
                default:
                    tw_error(TW_LOC, "unknown or unsupported "
                            "MN_MSG_PARAM_START_TIME parameter type");
            }
            break;
562 563 564 565 566
        default:
            tw_error(TW_LOC, "unknown or unsupported msg_param_type");
    }
}

567
/* returns the message size, can be either simplenet, dragonfly or torus message size*/
568
int model_net_get_msg_sz(int net_id)
569
{
570 571 572 573
    (void)net_id;
    // TODO: Add checks on network name
    // TODO: Add dragonfly and torus network models
    return sizeof(model_net_wrap_msg);
574
#if 0
575 576 577 578 579
    if(net_id < 0 || net_id >= MAX_NETS)
    {
        printf("%s Error: Uninitializied modelnet network, call modelnet_init first\n", __FUNCTION__);
        exit(-1);
    }
580

581
    return method_array[net_id]->mn_get_msg_sz();
582
#endif
583 584 585
}

/* returns the packet size in the modelnet struct */
586
uint64_t model_net_get_packet_size(int net_id)
587
{
588
  if(net_id < 0 || net_id >= MAX_NETS)
589 590 591 592 593 594 595
     {
       fprintf(stderr, "%s Error: Uninitializied modelnet network, call modelnet_init first\n", __FUNCTION__);
       exit(-1);
     }
  return method_array[net_id]->packet_size; // TODO: where to set the packet size?
}

596
/* This event does a collective operation call for model-net */
597
void model_net_event_collective(int net_id, char const * category, int message_size, int remote_event_size, const void* remote_event, tw_lp* sender)
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
{
  if(net_id < 0 || net_id > MAX_NETS)
     {
       fprintf(stderr, "%s Error: Uninitializied modelnet network, call modelnet_init first\n", __FUNCTION__);
       exit(-1);
     }
  return method_array[net_id]->mn_collective_call(category, message_size, remote_event_size, remote_event, sender);
}

/* reverse event of the collective operation call */
void model_net_event_collective_rc(int net_id, int message_size, tw_lp* sender)
{
  if(net_id < 0 || net_id > MAX_NETS)
     {
       fprintf(stderr, "%s Error: Uninitializied modelnet network, call modelnet_init first\n", __FUNCTION__);
       exit(-1);
     }
  return method_array[net_id]->mn_collective_call_rc(message_size, sender);
}

618 619 620
/* returns lp type for modelnet */
const tw_lptype* model_net_get_lp_type(int net_id)
{
621
    if(net_id < 0 || net_id >= MAX_NETS)
622 623 624 625 626 627 628 629 630 631
     {
       fprintf(stderr, "%s Error: Uninitializied modelnet network, call modelnet_init first\n", __FUNCTION__);
       exit(-1);
     }

   // TODO: ADd checks by network names
   // Add dragonfly and torus network models
   return method_array[net_id]->mn_get_lp_type();
}

632
const st_model_types* model_net_get_model_stat_type(int net_id)
633
{
634 635
    if (!method_array[net_id]->mn_get_model_stat_types)
        tw_error(TW_LOC, "mn_get_model_stat_types not defined for network model with net_id: %d\n", net_id);
636
   return method_array[net_id]->mn_get_model_stat_types();
637 638
}

639 640
void model_net_report_stats(int net_id)
{
641
  if(net_id < 0 || net_id >= MAX_NETS)
642 643 644 645 646 647 648
  {
    fprintf(stderr, "%s Error: Uninitializied modelnet network, call modelnet_init first\n", __FUNCTION__);
    exit(-1);
   }

     // TODO: ADd checks by network names
     //    // Add dragonfly and torus network models
649 650
   method_array[net_id]->mn_report_stats();
   return;
651
}
652

653
tw_lpid model_net_find_local_device(
654 655 656
        int          net_id,
        const char * annotation,
        int          ignore_annotations,
657 658 659 660 661 662 663 664 665
        tw_lpid      sender_gid)
{
    struct codes_mctx const * mc_p;
    struct codes_mctx mc;
    if (ignore_annotations)
        mc_p = CODES_MCTX_DEFAULT;
    else {
        mc = codes_mctx_set_group_modulo(annotation, ignore_annotations);
        mc_p = &mc;
666
    }
667
    return model_net_find_local_device_mctx(net_id, mc_p, sender_gid);
668 669
}

670 671 672 673
tw_lpid model_net_find_local_device_mctx(
        int net_id,
        struct codes_mctx const * map_ctx,
        tw_lpid sender_gid)
674
{
675 676
    return codes_mctx_to_lpid(map_ctx, model_net_lp_config_names[net_id],
            sender_gid);
677 678
}

679 680 681 682 683
#ifdef ENABLE_CORTEX
/* structure that gives access to the topology functions */
cortex_topology model_net_topology;
#endif

684 685 686 687 688 689 690 691
/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */