source: CIVL/notes/notes.txt@ dfb0fef

1.23 2.0 main test-branch
Last change on this file since dfb0fef was 1f2361e, checked in by Stephen Siegel <siegel@…>, 12 years ago

Added MPI Send statement interface. Minor clean up of comments in test file to remove fake javadoc

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@486 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 4.6 KB
Line 
1
2TASS incorporation:
3
4Model:
5
6 Types:
7 MPIComm
8 MPIStatus
9 MPIRequest
10
11 Constants:
12 MPI_INT, MPI_DOUBLE, MPI_FLOAT, MPI_CHAR, ...
13 MPI_
14
15 Statements:
16 MPISendStatement
17 MPIRecvStatement
18 MPIBarrierStatement
19 MPIIsendStatement
20 MPIIrecvStatement
21 MPIWaitStatement
22
23 Expressions:
24 NemptyExpression
25 NfullExpression
26
27State: communicator? good enough for blocking communication.
28nonblocking requires more stateful message (see MPI Spin)
29
30ModelBuilder:
31needs to work from AST which is C+MPI code.
32
33--
34
35
36
37Fundamentals:
38
39expression: $length(array)
40expression: $append(array, element)
41$concatenate, $remove,
42
43/* A system type for any segment of memory used as a buffer,
44 * formed using union types */
45typedef struct __bundle__ $bundle;
46
47/* Creates a buffer from the memory region specified by
48 * ptr and size, copying the data into the new buffer */
49$bundle $bundle_pack(void *ptr, int size);
50
51/* Copies the data out of the buffer into the region
52 * specified */
53void $bundle_unpack($bundle bundle, void *ptr, int size);
54
55/* creates a new comm from the given sequence of processes,
56 * by allocating memory and copying the process sequence;
57 * the new comm has no messages */
58$comm $comm_create(int nprocs, $proc * procs);
59
60/* adds the message to the comm */
61void $comm_enqueue($comm * comm, $message * message);
62
63/* finds the first matching message, removes it from
64 * comm, and returns pointer to message */
65$message * $comm_dequeue($comm * comm, int source, int dest, int tag);
66
67
68Action Plan:
69 - add a CIVLBundleType, similar to CIVLHeapType
70 - collect all types during model building
71 - complete the CIVLBundleType by giving it the list of all types,
72 and the symbolic type which is the union of array of t_i
73 - defined $bundle_pack in executor by:
74 1. let v = dereference ptr* (just first element)
75 2. let t = v.type();
76 3. array-of-t is the type of the bundle you will make by cases:
77a. is ptr to a variable, or an array element pointer, etc.
78create the new value of type array-of-t.
79 4. cast that to type bundleSymbolicType.
80 5. assign it to lhs.
81
82
83
84
85Consider CIVL-C dropping C's awful pointer-array pun.
86No automatic conversions. (Just drop them if language is CIVL-C).
87
88f(double[] a) : really takes an array of double, not pointer.
89double[] f(...) : returns an array of double
90
91To get the C behavior:
92
93f(double *p) {...}
94
95to call f: f(&a[0]);
96
97
98
99
100
101
102How hard would it be to add a new type: $sequence<T>
103to the language? Like vector or variable length array.
104Then define functions like $append, $add, $remove,
105$subseq, blah blah: but these are all generic.
106Need concept of generic functions. Could make them
107operations.
108
109$buffer $buffer_create(void *ptr, $type element_type, int count);
110
111$buffer $buffer_pack(void *ptr, int size);
112
113Problem: what if type of ptr is just void*. Won't know statically
114all the types to form the union type. Without some sort of flow
115analysis, will have to assume every type is possible.
116
117flow analysis: look at occurrences of $buffer_pack
118if type of expression ptr is void*, look at what goes into that
119expression. pointer arithmetic: ptr argument, trace back
120through assignments, function calls. forget it.
121
122need union of all types.
123
124**** collect all types used in model **** easy
125
126
127
128do essentially the same thing, but take different args.
129If the element type is complete (and hence can use sizeof)
130the first can be defined as
131 $buffer_pack(ptr, count*sizeof(t))
132
133
134
135Messages:
136
137$message_pack has to produce a message, but how?
138Use union type.
139Union over all types which can occur in message_pack.
140Inject.
141Need to extract value from slice of array.
142Wish I had symbolic operators for that.
143Could be single variable, entire array, slice of array
144slice of array: copy elements if concrete bounds, else
145need array - lambda (not yet implemented)
146
147stick in union type.
148
149tyedef struct __buffer__ __buffer__;
150typedef struct __message__ {
151 int source;
152 int dest;
153 int tag;
154 __buffer__ data;
155 int size;
156}
157
158Translate __buffer__ to CIVLBufferType.
159Symbolic type: symbolicBufferType:
160Union-of-array-of-t_i, where t_i ranges over all types
161occuring in message pack calls.
162
163Implement $message_pack : just to create buffer
164
165
166How about relaxing restriction from C that element types of
167arrays must be complete? Instead just generate error
168if you try to take sizeof such a thing.
169Instead of
170(double*)$malloc(&h, size)
171 how about
172$alloc(&h, typeof(double), count);
173
174void* $alloc($heap *h, $type type, int count);
175
176Add to grammar: "$typeof(sizeable)" just like sizeof, but
177don't care about completeness.
178no sizeof required. Type of typeof is $dynamic. Why not "type".
179---
Note: See TracBrowser for help on using the repository browser.