Learning a programming language is great. But there is a difference between knowing to program and to actually produce a working piece of software that other people in your community can (re-)use easily.
There are tools out there that can make your life easier and you should use them (for your own sake and for others)!
I do not plan to give a comprehension of a full list of tools. This is not possible because
- the tools depend on the language and
- I do not know all tools.
I will instead mention some tools and comment on how I use them to make my life (and other’s life) easier. For some techniques I have examples on GitHub that you can look at and use for your own purpose.
C++ for Scalable and Robust Numerical Codes
It is a great (general purpose) tool but requires some time to learn. Rule of thumb is about 9 months to a year to know what you are doing. Note that similarly to the C languange (which is a subset of C++) C++ allows to make all mistakes that are possible on low and high levels of programming. I am using C++ for teaching purposes and to implement methods in a robust and parallel way. Note that you should be careful when planning code in C++ and really take some time to think about your code (use mind maps and maybe UML diagrams). If you don’t you will run into trouble after some time. I promise.
Once you pass the stage of getting familiar with the language I highly recommend these books:
I am using may libraries incl. these:
Deal.ii allows for large-scale parallel implementations of DG or FEM methods for all kinds prototypical and application problems while still maintaining the ability to go deep into low-level routines. It is a great compromise of maintainability (through the object oriented concept) and speed which is close to C/Fortran90. Some templating techniques (template metaprogramming) such as expression templates can even come close or beat Fortran77 code in speed.
Developing C++ code should be done alongside the help of productivity tools such as
- mind maps
- UML modelers (such as the free Umbrello)
- Git (distributed version control system)
- Gitlab (great code management interface), I sometimes use Github for public code hosting
- Doxygen for generating clean documentations from code comments
- CMake to generate Makefiles
- a unit test library such as (Boost.test)
- IDEs (such as Visual Studio Code or the Eclipse IDE)
- debuggers (I use the GNU debugger gdb)
- CI/CD (continuous integration/continuous deployment) tools such as Jenkins
- Docker is a very effective way to containerize your applications and run them in different environments
In addition Spack is an extremely useful package manager for cluster environments used in high-performance computing.
There are many more very useful tools out there but they are often “overkill” for academic software development. I will elaborate on in all tools in a different post.
Python for prototyping
Python is a multi-purpose language created in the 1990s. It is interpreted (although creating LLVM-compiled code is possible) and offers a concise and easy-to-understand style. It is great for interactive applications but less powerful when it comes to scientific computing. However, it can still be used for scientific computing since it offers great interfaces to code written lower-level languages such as C/C++, Fortran, Lua etc. I recommend to use it in virtual environments in order not to mess with your system. A good way is he Anaconda implementation. Try to use Python3 since many packages are out there unless you have to stick with Python2 (for using legacy code or other reasons).
Important: Python allows to use an object oriented programming (OOP) style which makes it a good tool to prototype before writing production code in C++. But note that while Python allows OOP features such as classes and inheritance it does not support strong data encapsulation.
Python modules I often use include:
Python is also used as an interface to powerful deep learning libraries such as
I sometimes use
- Firedrake (powerful and fast finite element package)
Julia for prototyping
(may be outdated)
Julia is a fast (LLVM-compiled) language that you can also use interactively to “quick and dirty” test new ideas (at least I use it that way). The developers emphasize that you can also use it for scalable (parallel) software. It uses multiple dispatch and has the ability to make your code type-aware (in contrast to Matlab and Python). With this you can implement a variety of techniques from object-oriented paradigms and procedural ones. It is available for all common operating systems and many great packages exist for it. The handling of the package system is particularly easy.It also has great interfacing with C/C++ and Fortran.
I use it with Sublime3 and the Julia package but there may be more efficient ways.
Debugging was a bit painful but recently a new set of debugging tools has been introduced (read this). I recommend to keep track of these.
Packages I frequently use are:
You can use Julia for teaching purposes also in a notebook similarly to Python with the IJulia package.