-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support OpenCL PSy layer for GOcean 1.0 #174
Comments
Instead of calling kernel subroutines we must call |
I've had a change of plan and decided to go with using a Transformation to toggle whether or not to generate OpenCL. This allows it to be applied on a per-Schedule/Invoke basis rather than globally for an Algorithm file. Currently the transformation just sets |
More importantly, I need to work out how we are going to set the kernel arguments which, in OpenCL, is done via (many) API calls. Happily, I think I can generate the necessary code using the kernel meta-data and Algorithm argument list. I think the generated code should then be called within the |
For reference, the code to set kernel arguments looks like this (in Fortran):
The scalar argument ( |
We will need to create a routine to set the kernel arguments for each kernel that we come across. Given that we run PSyclone separately on each Algorithm file, there's currently no way to avoid creating such a routine several times. That's probably not a big deal though. I think the logical place to do this is after we've created the Algorithm and PSy code since at that point we know what all our kernels are. |
I've put the necessary code into |
I think I have all the basics covered now with the exception of the creation of buffers on the device. At the moment I assume the infrastructure has set-up |
I don't want dl_esm_inf to have to depend on PSyclone though so I think this means we nead YAR (yet another repository) containing the Fortran->OpenCL interface code. In a spirit of collaboration I've done a google for such a code and found hiCL but that is based on C/C++ with a Fortran wrapper. It also hasn't been updated for two years. |
I've created https://github.com/stfc/FortCL and moved my OpenCL wrapper code into there. This has the advantage that it's pure Fortran. dl_esm_inf now has FortCL as a submodule. |
Have now brought branch up-to-date with master and used the new |
In order to reduce code duplication I've added an |
Whoop! |
Generated (PSycloneBench) code now runs as far as the point where I need to set a kernel argument that is a grid property. I now realise that I haven't created the buffers on the device for grid properties... |
Code now runs through but some kernels fail because arguments aren't set. On closer inspection I realise that in Fortran, the momentum kernels have |
When we have a tool for converting Fortran kernels to OpenCL then we will be able to capture information on any such conversion of module variables into kernel arguments. In fact, we could do it now as part of the meta-data parsing (since we parse the kernel source anyway). I can break that out as a separate Issue. |
PR #216 has been merged to master. Closing this issue. |
In this issue we will extend PSyclone to support the (optional) generation of OpenCL code in the PSy layer. We will use the
clfortran
module so that we can stick with Fortran.Note that transforming existing kernels into OpenCL will be the subject of a separate issue.
We will target the GOcean 1.0 API first since that is what is required in EuroEXA.
The text was updated successfully, but these errors were encountered: