Skip to content

Instantly share code, notes, and snippets.

@kaushikcfd
Last active January 23, 2018 23:48
Show Gist options
  • Save kaushikcfd/bc3942fa53c14d1eaeb60315d2578016 to your computer and use it in GitHub Desktop.
Save kaushikcfd/bc3942fa53c14d1eaeb60315d2578016 to your computer and use it in GitHub Desktop.

We had our earlier scatter kernel as follows:

coords[iel, i_bf, i_dim] = coords_global[ltg[iel, i_bf], i_dim]

And coords being implemented as a 3-dimensional array in the element kernel. This was not a problem.

But the "new" tsfc element kernel, flatten out the 3rd dimension of coords. Making the the coords a 2-dimensional array in the element kernel.

Hence, I would need to change the scatter kernel. So I tried 2 approaches to this problem:

  1. Making the new scatter kernel look like:
coords[iel, dim*i_bf + i_dim] = coords_global[ltg[iel, i_bf], i_dim]

But the assignment to substitution over here starts to complain. As the LHS in of the assignment is expected to have indices free of any expressions.

  1. Defining the a "new" iname:
coords[iel, i_bf_dim] = coords_global[ltg[iel, i_bf], i_bf_dim - dim*i_bf]

This would get me through with the assignment_to_substion(...), but then we would encounter some reductions which are independent of involved inames. Precisely the error being instruction 'sum_tmp_i10_update' references inames 'i_bf_0' that the instruction does not depend on.

A side note: coords is just an example. This change is needed for all the arguments that are given to the loopy kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment