#1065: Pass CCTK_ARGUMENTS more efficiently in Fortran -------------------------+-------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: new Priority: major | Milestone: Component: Other | Version: Keywords: | -------------------------+-------------------------------------------------- CCTK_ARGUMENTS is passed differently in C and in Fortran. In C, only a single pointer is passed, pointing to cctkGH. The cctk_... variables and pointers to grid functions are defined locally from cctkGH. This is efficient, because (a) only a single variable is passed, and (b) the compiler can eliminate unused definitions.
In Fortran, all the cctk_... variables and all grid functions are passed explicitly. This is expensive for the caller, because hundreds of arguments have to be set up and passed to the subroutine. The compiler cannot eliminate any unused variables.
I suggest to change the Fortran calling convention to be the same as the one for C. Since regular Fortran pointers differ significantly from C pointers, I suggest to use "Cray pointers" instead, which are very similar to C pointers. Cray pointers are an extension to the Fortran standard, and are supported by all Fortran compilers I know of.
I attach sample code that shows how to declare, define, and use this convention.