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

[PSyData] Kernel driver contains unnecessary modules with references to yaxt #2888

Open
hiker opened this issue Feb 9, 2025 · 0 comments
Open
Labels
NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH PSyData

Comments

@hiker
Copy link
Collaborator

hiker commented Feb 9, 2025

If a kernel (directly or indirectly) uses for example chi2llr from sci_chi_transform_mod, the whole sci_chi_transform_mod is inlined, which includes init_chi_transforms -> local_mesh_mod -> halo_comms_mod -> yaxt

In this case, init_chi_transform is not called, so de-facto there is no dependency to yaxt, but the driver will not compile.

Of course, yaxt could be linked in - and while in general just linking with yaxt would not work since the initialisation is not done, but since the halo functions that use yaxt are not called, this solves the problem. But a better solution would be exclude subroutines that are not called.

While in the above example, the code is clean:

    SUBROUTINE init_chi_transforms(mesh_collection, north_pole_arg, equator_lat_arg)

    USE local_mesh_mod, ONLY: local_mesh_type
    USE mesh_collection_mod, ONLY: mesh_collection_type
    USE mesh_mod, ONLY: mesh_type

All the used modules will sooner or later call import halo_comms_mod, so removing this subroutine is enough. But it could be that a module is used in the outer module scope, which might also need to be removed:

module sci_chi_transform_mod
    USE local_mesh_mod, ONLY: local_mesh_type
contains
    SUBROUTINE init_chi_transforms(mesh_collection, north_pole_arg, equator_lat_arg)
     ... do something with local_mesh_type

In this case the local_mesh_mod in the module declaration would also need to be removed :(

@hiker hiker added PSyData NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH labels Feb 9, 2025
@hiker hiker changed the title [PSyData] Kernel driver contains unnecessary modules [PSyData] Kernel driver contains unnecessary modules with references to yaxt Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH PSyData
Projects
None yet
Development

No branches or pull requests

1 participant