Changes between Initial Version and Version 1 of MessagePassing


Ignore:
Timestamp:
07/11/13 14:22:09 (13 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MessagePassing

    v1 v1  
     1= Message Passing =
     2
     3First attempt:
     4
     5{{{
     6$input int NPROCS;
     7$assume NPROCS >= 1;
     8$scope top;
     9$heap mp_heap;
     10$proc procs[NPROCS];
     11
     12typedef struct Message {
     13  struct Message *<top> next;
     14  struct Message *<top> prev;
     15  int tag;
     16  int size;
     17  void *<top> data;
     18} Message;
     19
     20typedef struct Comm {
     21  Message *<top> buf_front[NPROCS][NPROCS];
     22  Message *<top> buf_back[NPROCS][NPROCS];
     23} Comm;
     24
     25Comm _Comm_world;
     26
     27Comm *<top> COMM_WORLD = &_Comm_world;
     28
     29void init() {
     30  for (int i=0; i<NPROCS; i++)
     31    procs[i] = $spawn proc(i);
     32  for (int i=0; i<NPROCS; i++)
     33    for (int j=0; j<NPROCS; j++) {
     34      COMM_WORLD->buf_front[i][j] = NULL;
     35      COMM_WORLD->buf_back[i][j] = NULL;
     36    }
     37 
     38
     39
     40
     41
     42
     43}}}