stfc / RegentParticleDSL

A particle-method DSL based on Regent programming language
MIT License
1 stars 0 forks source link

Allow inline multilaunching of Kernels #61

Closed LonelyCat124 closed 3 years ago

LonelyCat124 commented 3 years ago

At the moment we require the user to do:

local kernel_one_launch = neighbour_search_function(kernel_one)
local kernel_two_launch = neighbour_search_function(kernel_two)

task main()
...
[kernel_one_launch];
[kernel_two_launch];
end

It might be easier if the user could just do


task main()

[invoke_pairwise( variables,
                             kernel_one, kernel_two, .....)];
[invoke_perpart( variable,
                           kernel_perpart)];
...
end

Makes programming simpler slightly. Relies on privileges working out if neighbour_search update is needed being automatic.

LonelyCat124 commented 3 years ago

Ok, so I think something like

function invoke_pairwise_symmetric(variables, ...)
print(select("#",...))
kernels = terralib.newlist()
for i = 2, select("#",...) do
  kernels:insert(create_symmetric_pairwise_runner(select(i, ...), variables.config, variables.cell_space))
end

local kernels_quote = rquote
  [kernels];
end

end

should be approximately correct. One thing that would be worth gauging is whether separating symmetric/asymmetric kernels is better, of whether users pass something like (variables, kernel1, ASYM, kernel2, SYM, kernel3, SYM) and so on, where ASYM and SYM are predefined.

LonelyCat124 commented 3 years ago

Implemented.