Scientists like myself are famously bad at software engineering. I have a code I need to use with a horrible custom build system written in Perl.
I want to start a new project. I come here seeking advice on some of the initial decisions to try to start the project on the right foot. Iām going to write an OpenACC + MPI code that compiles to CPU or GPU, and I want to make it easy to build / use / maintain.
(1) As a build system, should I use fpm (āFortran Package Managerā) or Meson? Or something else? I have experience with neither. Whatās easy?
(2) There will be optional modules. Whatās a good way to turn modules on or off? My baseline plan is to recompile the code and use the cpp preprocessor that most compilers have to decide which modules get included. Does that sound like a good option?
(3) Iām going to need FFT, Linear Algebra, random numbers, etc. I could use CUDA libs when I compile to GPU and stdlib when I compile to CPU.
- Does that sound like a good idea?
- How mature is stdlib? Should I use it?
- What is the best way to switch between CUDA and stdlib? Should I use preprocessor macros and conditional compilation?
Iām also thinking about how these choices intersect. For example, stdlib doesnāt work with nvfortran
. Ok. No problem; nvfortran can be just for GPU when I use CUDA. Butā¦ one of the features of fpm is that you can mark dependencies. If I say that stdlib is a dependency, will that prevent me from compiling with nvfortran CUDA?
Oh, and would fpm limit my ability to change the compilation options? Like with the optional modules I mentioned in (2)?
(4) Iām going to need config files. Iām thinking of using TOML (Tomās Obvious Minimal Language). There is a Fortran library for TOML. I see options to ābuild with fpmā or āintegrate TOML Fortran in your meson projectā. Let me know if you have any thoughts about that.
Thanks for the help. Feel free to give any advice that you have in mind, or rant about the horrible code youāre forced to maintain so I can avoid making the same mistakes.
Thanks!