-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail_map.c
More file actions
47 lines (37 loc) · 803 Bytes
/
mail_map.c
File metadata and controls
47 lines (37 loc) · 803 Bytes
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
#include "mail.h"
int get_mailbox_GID(int lpid)
{
return lpid;
}
int get_post_office_GID(int lpid)
{
return total_mailboxes + lpid;
}
int get_assigned_post_office_LID(int lpid)
{
return lpid % total_post_offices;
}
int get_assigned_post_office_GID(int lpid)
{
return get_post_office_GID(get_assigned_post_office_LID(lpid));
}
tw_lpid lpTypeMapper(tw_lpid gid)
{
// printf("%llu\n",gid);
if (gid < total_mailboxes)
{
// printf("%llu < %i\n",gid,total_mailboxes);
return MAILBOX;
}
else
{
// printf("%llu >= %i\n",gid,total_mailboxes);
return POSTOFFICE;
}
}
//Given an LP's GID (global ID)
//return the PE (aka node, MPI Rank)
tw_peid mail_map(tw_lpid gid)
{
return (tw_peid) gid / g_tw_nlp;
}