Fortranpack: A Modern Fortran Numerical & Scientific Programming Package

Behold Fortranpack: A Modern Fortran Numerical & Scientific Programming Package

What is this you ask? It’s just an FPM manifest that imports all my other libraries! So, add it as a dependency and you get everything.

Genius or cursed?

It’s just an experiment really. I was wondering if there would be some utility in a meta-library like this. Rather than having everything in a single repository (like stdlib), things are split up and development separately. Something to think about. There are pros and cons to both approaches.

9 Likes

Super-packages are interesting and educational as github, fpm, and compilers all get exercised differently than when working piecemeal with smaller projects.

I have been using a slightly different approach, partly for testing fpm, since the inception of the Fortran branch of fpm.

GitHub - urbanjost/general-purpose-fortran: General Purpose Fortran Cooperative is a single library that was split into many subprojects specifically to be used more selectively, particularly via fpm.

As you mentioned, there are pros and cons to each approach, but I was expecting an fpm repository to have developed more than has occurred, which tends to favor smaller packages. Theoretically the repository seemed like it would be a natural hotbed for developing stdlib modules as well.

Combining many modules gives fpm a good workout as well. Do you see any unexpected recompilations when you change a program in app/ or test/ or example/ ?

1 Like

Here is the dependency graph as a SVG file. Generated using fpm-deps.

2 Likes

Fortranpack already has an index to all the dependencies but I did not realize till now that the output from the "--mermaid md" option can be used as-is in github markdown. I think I will spend a bit of time adding the dependency graphs to my README.md files.

Fortranpack is not only a good way to exercise fpm but a decent test of a Fortran compiler as well :melting_face:

2 Likes

Yes! @certik if you can get LFortran to compile this you are close to done! :grinning_face:

1 Like

I would like to nominate Jacob to be Fortran’s official “Leader of the Packs”. Do I hear a second :grinning_face_with_smiling_eyes:

2 Likes

Yes, it is part of both Github- and Gitlab-flavored markdown. I’m assuming the boxes are only clickable when included in the HTML, but I may be wrong. There is also a hover effect which displays the name. In principle one can also edit line styles, shapes, or add icons and images (Flowcharts Syntax | Mermaid).

Do let me know if you encounter any problems.

Thanks, we’ll get there!

It is clickable, the hover works, and a navigator allows zooming and panning. At the bottom of the README.md
I corrected it but the original output using

fpm deps --mermaid md --output deps.md

deps.md
the top link goes to the top of repositories instead of to the prep project, although it works as expected on other projects.

It might be nice if fpm-devs wrote other github markdown formats as well, like the index in Fortranpack. The graphs are great, but the table like Fortranpack has and a simple text listing for terminal output when using fpm as well would be useful. @jacobwilliams – is your index manually generated or automated?

I just manually made it. Wouldn’t be hard to automate it.

That is because of the homepage field in the prep fpm.toml: prep/fpm.toml at c0120b14d23097c704a0ecf1db6c87e08388ea18 · urbanjost/prep · GitHub

I haven’t really advertised it yet, but I also made text command fpm-tree (it is part of fpm-deps). For instance for fortranpack, it currently display the following:

~/fortran/fpm_packages/fortranpack$ fpm-tree
fortranpack
├── argv-fortran
├── bspline-fortran
├── carlson-elliptic-integrals
├── conmax
├── conmin
├── csv-fortran
├── daglib
├── ddeabm
│   └── roots-fortran
├── dop853
├── finterp
├── fortran-mach
├── fortran-search-and-sort
├── json-fortran
├── lbfgsb
├── mersenne-twister-fortran
├── nlesolver-fortran
│   ├── fmin
│   ├── LSQR
│   ├── lusol
│   └── LSMR
├── NumDiff
├── optgra
├── pchip
├── pikaia
│   └── mersenne-twister-fortran (*)
├── polyroots-fortran
├── popen-fortran
├── psqp
├── pyplot-fortran
├── quadpack
├── quadrature-fortran
├── regridpack
├── rklib
│   └── roots-fortran (*)
├── roots-fortran (*)
├── simulated-annealing
├── slsqp
├── splpak
├── stringsort
└── uuid-fortran

It has a nice clean tree structure with few package inter-dependencies.

Nice, thanks. Apart from FPM and fpm-tree, is there a tool that creates such a diagram for a program, showing the modules USEd by the main program and by each module?

I’ve done that too in a private fork of fpm. The information (with some caveats) is available from the fpm build model: Option to output dependency tree · Issue #687 · fortran-lang/fpm · GitHub

1 Like