Cambridge-ICCS / FTorch

A library for directly calling PyTorch ML models from Fortran.
https://cambridge-iccs.github.io/FTorch/
MIT License
48 stars 11 forks source link

Add developer guide #106

Closed ElliottKasoar closed 2 months ago

ElliottKasoar commented 2 months ago

I may have missed it, but I don't think we mention the (optional) use of the pre-commit hook, which is slightly hidden away otherwise, or more significantly, fypp, in the README or longer documentation.

This could be added to a Developer Guide section alongside the User Guide.

Something along the lines of:

FTorch makes use of the fypp preprocessor to generate src/ftorch.f90 from src/ftorch.fypp.

When developing changes to src/ftorch.f90, the following steps should be taken:

  1. Install fypp
  2. Add desired changes to ftorch.fypp
  3. Run fypp (in src): fypp ftorch.fypp ftorch.f90

Use of the pre-commit hook in provided (.githooks/pre-commit) is also recommended. When moved to .git/hooks, this automatically checks that ftorch.f90 and ftorch.fypp are consistent when git commit is run.

There may be a other useful notes to add to, but I think this would be a good starting point.

Related, but not the focus of the issue, but I wonder whether it would be better to have the hook in place already, as it doesn't require fypp or any other set up.