PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

Use Fab to collect module information?

Open hiker opened this issue 1 year ago • 2 comments

I've just opened https://github.com/MetOffice/fab/issues/333: basically, fab already creates 'analysis' files, which store (beside other information) which module(s) are contained in each file. It shouldn't be too hard to extend Fab to also write out the information which source file contains which module (e.g. either as the equivalent of .mod files, or maybe even one big file, or a DB?).

If Fab is then able to process all .f90 files first before adressing the .x90 files, PSyclone should be able to use the above information to immediately find a source file for a given module name (including kernel names), independent of coding style.

hiker avatar Aug 01 '24 05:08 hiker

While having this information available would be great, I'm not that keen on the idea of depending on Fab to do it. Perhaps we could have some mechanism that says that if files of a certain extension exist, they can be used to get this information? I say this because we could e.g. have fparser 'serialise' part of its parse tree to create '.mod' files. In fact, that would be a big help in determining more information in the parser.

arporter avatar Aug 01 '24 07:08 arporter

Yes, I was about to add that: we could take an (optional) parameter with a 'mod-info' file. PSyclone (or fparser??) could even update this file (e.g. if our current similar name matching reads several source files, this info could be added). And fab could just be another source of providing/updating this file. And/or we could provide a simple, grep-based script that creates this - as long as psyclone is robust enough to update this if it detects wrong information while parsing.

hiker avatar Aug 01 '24 11:08 hiker

Just determining all dependencies has already been implemented by @hiker and I propose a "reduced" version of this in a future PR: https://github.com/stfc/PSyclone/blob/martin_nemo_call_trace/src/psyclone/parse/module_manager_base.py This class is then inherited by another class, e.g. ModuleManagerAutoSearch (original version also written by @hiker), https://github.com/stfc/PSyclone/blob/martin_nemo_call_trace/src/psyclone/parse/module_manager_auto_search.py

The key is that the ModuleManagerBase keeps track of the dependencies. This is probably the right class where this dependency information should be cached to a file. Fab could then use this class or inherit from it.

schreiberx avatar Nov 17 '24 13:11 schreiberx