1. The domain.
Our language is based on the 164 language. Our plan is to implement the parallelism in this order:
1. General statements (var/function definitions, calculator statements, variable assignment)
2. Function calls (includes the loops)
3. Objects
4. Passing/returning of functions as first class data
5. coroutines
We believe that at this point we know how to implement the first three steps. We still have to think about the last two. Therefore, although our language will be a subset of the 164 language, it may not be equivalent (depending on how far we get). By the end of the project, we hope to simulate the parallel execution of divide and conquer algorithms like quicksort and merge sort.
Example programs:
- Any divide and conquer algorithm like merge sort.
- Programs that combine the results of subproblems like when a formula is split up into parts to make calculation simplier.
- Maybe algorithms that iterate over a list like in mapping.
The model of the language will be object oriented and imperative (like c++) and, depending on how far we get, may support functions as first class data (functional programming).
The method we have proposed converts a list of statements into a DAG. A program, however, is more than just a sequential list of statements: functions, which may be nested inside other functions, contain lists of statements. Thus, DAGs may be composed within other DAGs. But first, we will only focus on converting programs that are merely lists of statements into DAGs.
3. Example program:
def x = 0
def y = 0
def range(start,end){
def ret = {}
def i = 0
def length = end - start
while(i < length){
ret[i] = start+i
i = i+1
}
ret
}
for (i in range(0,10)){
x = x+1
}
for (i in range (0,20)){
y = y+1
}
print x+y
The idea behind this program is to have the for loops split into multiple processes since they do not depend on each other. Then when both processes are done, the program will continue by printing x+y .
No comments:
Post a Comment