GithubHelp home page GithubHelp logo

Comments (4)

m214089 avatar m214089 commented on September 1, 2024

@RobertPincus The NAG compiler is exactly following the Fortran standard. You can change meanwhile some other compilers to behave similar (comply with the standard).

However, we do need a solution for the given problem: What about assumed shape/size arrays as arguments? If one defines those as pointer and uses nullify and associated, you could mimic the optional/'present' - the array bounds can be set as local variables at the beginning of the executable statements section via the size intrinsic or ubound.

Another option would be a BIND(C) container type containing the respective arrays. Just some unspecific thinking.

from rte-rrtmgp.

peterukk avatar peterukk commented on September 1, 2024

Apparently optional arguments are C++ compatible under Fortran 2018, but I guess you need Fortran 2008 compatibility?

from rte-rrtmgp.

RobertPincus avatar RobertPincus commented on September 1, 2024

@m214089 Agreed that the NAG behavior is the Fortran standard.

@peterukk We could consider to update the standard although 2018 might not yet be supported by many compilers.

The tension, it seems, is between Fortran performance, C compatibility, and flexibility. Fortran performance is best with explicit arrays (assumed-size?); C bindings (important for interoperability of kernels and front-ends) mean no optional arguments and assumed-size arrays (not assumed size, @m214089). I tried having different kernels e.g. for broadband and spectrally-detailed fluxes but a) this leads to lots of repeated code, and b) there are multiple permutations (e.g. Jacobians x broadband/spectral).

Keep the ideas coming.

from rte-rrtmgp.

RobertPincus avatar RobertPincus commented on September 1, 2024

In commit 3b5d157 on the main branch we resolved this issue by allocating space for all output argument, even if they are not used. This lets the code conform to the Fortran standard for assumed-size array arguments, as noted by @m214089. It means that the memory footprint can't be reduced - but at least memory traffic can be made smaller.

from rte-rrtmgp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.