Psyclone creating incorrect ordering of dofmaps in kernel argument list? #608
Replies: 3 comments 5 replies
-
|
The order of the |
Beta Was this translation helpful? Give feedback.
-
|
"a) This is exactly the sort of bug that you can catch by testing bit-comparison on different processor decompositions. Why was this key safety-net quietly dropped in the move from um to lfric? We urgently need to implement a bit-comp test for the physics in lfric_apps rose-stem!" On this point, the option was not "quietly dropped". There was a lot of discussion, particularly with climate scientist strategic heads at the time because historically this ability has been more important for long running climate projections than for NWP. We still need to do work to ensure that we know how to regenerate an existing climate model generated dataset if the requirement arises. This will require remembering what resource was used to run it. As mentioned before on this discussion group, I'm sure it is feasible to implement bit comparison tests if a suitable physics configuration is required. I believe that, with work to create a reproducible global sum, we could retain bit comparison for different configurations by imposing compute order on the unstructured mesh. This would be for testing only as we would expect there to be an impact on compute performance. It's not something we could find time for now, though. Just to add to Andy's comment on b), it's not the order of the arguments that have to be right, it's the declarations that have to be right. i.e. real :: my_theta_field(undf_wtheta), where the dummy argument undf_wtheta has to be in the correct place in the argument list. But extracting that information from the kernel code is quite challenging as the declarations can be written in different ways by different people (and there might still be errors in the declaration, even if the argument list is consistently ordered). When development of PSyclone was started, it was decided that the key thing was to base generation on just metadata (the gubbins in the |
Beta Was this translation helpful? Give feedback.
-
|
Hi thanks all :) The stub generator thing sounds really handy; I'll try and remember to use that next time I make a new kernel... But I fear the greatest danger of making errors is not when making a new kernel (when the stub generator can be used to guarantee its all consistent), but when altering the argument list to an existing kernel. It'd be grand if the existing functionality in the stub generator (to autogenerate the argument list and argument declarations consistent with the meta-data) could be deployed in the regular compile? Another reason this would be good is that as it stands, the developer has to specify the list of arguments to a kernel 5 times:
This feels like way too much redundancy / duplication, and too much effort to keep all 5 of these consistent! Could we add one extra field to the (where we've redundantly had to add a comment to remind ourselves which local variable-name each argument corresponds to), we would write: And then with this information, psyclone would have all the meta-data it needs to autogenerate the kernel Cheers! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I have a branch which (among other things) is adding a new kernel to perform sanity-checks on the prognostic precip fraction used with CoMorph:
vn3.1_max_in_cloud_checks
(see this issue page for more details: MetOffice/lfric_apps#243).
Currently if I compile and run with this branch I get failures due to referencing
exnerout-of-bounds in my new kernel lsp_precfrac_checks_kernel_mod.F90, which is invoked from cld_alg_mod.x90.After a load of print statements, and hacking rose-stem so that it keeps the pre-processed source output by psyclone, I've finally found that the bug resides in some of the autogenerated code :( In my kernel's argument list I have:
Where this is to be called from
cld_alg, I have:(note the arguments
ndf_wth,undf_wth,map_wth,ndf_w3,undf_w3,map_w3are intentionally missing as psyclone is meant to put them in automatically when it converts the above into a call to the subroutinelsp_precfrac_checks_code).But if I look at the autogenerated code made by psyclone which actually calls this subroutine (the file called
algorithm/cld_alg_mod_psy.f90), what it has autogenerated is:Comparing this with my kernel argument list above, psyclone has wrongly changed the ordering of the arguments. I have
ndf_w3,undf_w3,map_w3at the end of the argument list in subroutinelsp_precfrac_checks_code, but in the call from the autogenerated code these arguments have been moved to beforendf_wtheta. Hence inside my subroutine, the dofmap which I've labelled asmap_w3is actually pointing atmap_wtheta, which has one extra level in each column, causing myexnerarray to be vertically misaligned and be referenced out-of-bounds.Anyone have any idea what's going on / how I can fix this? Is it a bug in psyclone? Or does psyclone just have a pre-defined order in-which the dofmaps must appear in the argument list, and I need to change my kernel interface to have the
_w3dofmap first, to match what it expects?? (some kernels use quite a few different dofmaps; if they must appear in a specific order in the argument list, what is that order / where is this documented??)Cheers!
Mike
Beta Was this translation helpful? Give feedback.
All reactions