Skip to content
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

[LFRic] Support for user-defined kernels that operate on DoFs #1351

Open
TeranIvy opened this issue Jul 20, 2021 · 3 comments
Open

[LFRic] Support for user-defined kernels that operate on DoFs #1351

TeranIvy opened this issue Jul 20, 2021 · 3 comments
Assignees
Labels
enhancement LFRic Issue relates to the LFRic domain

Comments

@TeranIvy
Copy link
Collaborator

Originally we had preliminary support for user-defined kernels that operate on DoFs. However, it produced incorrect code and we removed it until the need arises.

There are several LFRic PSyKAl-lite routines that could be removed with this support, hence this issue. Furthermore, it seems that we need to differentiate between operates_on = DOF and operates_on = DOF_COLUMN.

@TeranIvy TeranIvy added enhancement LFRic Issue relates to the LFRic domain labels Jul 20, 2021
@arporter
Copy link
Member

Following on from our chat in the telco this morning, it sounds as though the random-number initialisation functionality needed for PSyAD should also be a dof-wise kernel. In fact, for the simplest case it could just be a built-in? I guess it depends on what Ben's existing kernel code already does?

@oakleybrunt
Copy link
Collaborator

oakleybrunt commented Oct 20, 2023

Proposed changes:

Allowed metadata types and access

  1. field (READ, WRITE, READWRITE)
  2. scalar (READ only)

LFRic Builtins metadata vs User defined kernels metadata

LFRic builtins use the LFRicKernelMetadata to store and validate their metadata. However, user-defined kernels use the newer LFRicKernMetadata, LFRicKern, and LFRicArgDescriptor to store and validate their metadata. This means that no checks are required to be added to LFRicKernelMetadata to validate user-defined kernels that operate on dofs since this isn't touched by LFRicKern.

Changes

  • 1. Add 'dof' to the list of USER_KERNEL_ITERATION_SPACES in LFRic Constants
  • 2. Edit LFRicKernCallFactory to check if iterates_over is equal to dof and modify loop_type to equal dof. This will then be picked up by LFRicLoop and set the iterator tag to df.
  • 3. operates_on = 'dof' is used by Builtins validating their metadata through LFRicKernelMetadata. Should just add a one line conditional to LFRicKern to check if self.name is the name of a builtin. This should add a little bit of protection.

No Change

  1. Fields are currently only allowed to be READ, WRITE, READWRITE, as defined in domain/lfric/lfric_arg_descriptor.py:
# Test allowed accesses for fields
field_disc_accesses = [AccessType.READ, AccessType.WRITE,
                       AcessType.READWRITE]
  1. Scalars also have the correct access types - only allowed to be READ as defined in domain/lfric/lfric_arg_descriptor.py:
# Test allowed accesses for scalars (read_only or reduction)
scalar_accesses = [AccessType.READ] + AccessType.get_valid_reduction_modes()

@oakleybrunt oakleybrunt self-assigned this Nov 8, 2023
oakleybrunt added a commit that referenced this issue Apr 23, 2024
also added checks in LFricKernelMetadata for operates_on=dof which check
if the kernel is a builtin and, if not, runs kernel checks similar to
generic and domain kernels."
oakleybrunt added a commit that referenced this issue Apr 23, 2024
oakleybrunt added a commit that referenced this issue Apr 23, 2024
oakleybrunt added a commit that referenced this issue Apr 23, 2024
oakleybrunt added a commit that referenced this issue May 13, 2024
arporter added a commit that referenced this issue May 13, 2024
#1351 - Support for user-defined kernels that operate on DoFs
@arporter
Copy link
Member

#2556 only added the documentation, not the implementation.

@arporter arporter reopened this May 13, 2024
oakleybrunt added a commit that referenced this issue May 14, 2024
oakleybrunt added a commit that referenced this issue May 16, 2024
oakleybrunt added a commit that referenced this issue Jul 23, 2024
oakleybrunt added a commit that referenced this issue Jul 26, 2024
oakleybrunt added a commit that referenced this issue Jul 26, 2024
oakleybrunt added a commit that referenced this issue Jul 31, 2024
oakleybrunt added a commit that referenced this issue Jul 31, 2024
oakleybrunt added a commit that referenced this issue Aug 2, 2024
oakleybrunt added a commit that referenced this issue Aug 6, 2024
oakleybrunt added a commit that referenced this issue Aug 8, 2024
arporter added a commit that referenced this issue Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement LFRic Issue relates to the LFRic domain
Projects
None yet
Development

No branches or pull requests

3 participants