Question: Can someone write some C-like code that processes the grid in parallel, in accordance with the dependencies illustrated above?
bojianh
Here is some code in python for access pattern, hopefully, it is correct. In order to the make the below code parallel, have to make some foreach for the inner while loop
for t in range(rows+cols-1):
if t < cols:
i = 0
j = t - i
else:
j = cols - 1
i = t - j
while (i < rows and j >= 0):
do stuff
i += 1
j -= 1
bojianh
Here is a much better version
for iteration in range(rows+cols-1):
n = min(min(iteration+1, rows+cols-1-iteration),min(rows,cols))
Question: Can someone write some C-like code that processes the grid in parallel, in accordance with the dependencies illustrated above?
Here is some code in python for access pattern, hopefully, it is correct. In order to the make the below code parallel, have to make some foreach for the inner while loop
Here is a much better version
for iteration in range(rows+cols-1):
n = min(min(iteration+1, rows+cols-1-iteration),min(rows,cols))
if iteration < cols:
else:
# Convert this to foreach
for program_index in range(n):
void **process_2darray(double **input_array, int N) { for (int i=0; i<N; i++) { for (int j=0; j<=i, j++) { input_array[i][j-i] = do_some(); } }