Skip to content

multiPrebas axis order #106

@olli4

Description

@olli4

Could nSites be moved to be the last dimension in multi-site Fortran data? It would (Edit: or not) resolve the following problems:

Single-site subroutines such as prebas() and initBiomasses() require contiguous data because the arrays have explicit shapes. However, in Fortran's column-major memory layout, single-site slices of multiPrebas() data are strided (non-contiguous) because nSites is the first dimension in the multi-site data.

GFortran plays it safe and automatically generates contiguous copies of the data for the subroutines. This works correctly but is relying on undefined behavior and is unnecessary work.

I've been working on building Rprebasso for WebR. The compiler in the standard workflow is Flang which doesn't create contiguous temporaries for explicit-shape arrays. Instead, subroutines get the wrong data.

Edit: I'm starting to think I was a bit naive and this is not the only change needed to ensure contiguity of slices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions