

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


































Micael Oliveira
Octopus Course 2021, MPSD Hamburg
Unique challenges: Translating science into code Need to understand the science Scientist are often not trained in software engineering Software performance is often important Many codes need to be enabled for high-performance computing: Parallelism (MPI, OpenMP, etc) GPU’s Complex hardware Unusual architectures
Code is the enemy: it can have bugs and it needs maintenance Do not reinvent the wheel: reuse code Write code that is easy to read and that is mostly self-documented Comments about why the code does something are very important Test your code “Premature optimization is the root of all evil”
M. J. T. Oliveira, N. Papior, Y. Pouillon, V. Blum, E. Artacho et al, J. Chem. Phys. 153 , 024117 (2020)
Project formaly started in 2001 Free-software (GPL) Writen mainly in Fortran 2003 Fortran sources are preprocessed with cpp Some C, C++, perl and Bison (use the right tool for the job!) CUDA/OpenCL for GPU support Currently over 250,000 lines of code
Wiki based website A new website is under construction octopus-code.org/new-site/develop Ressources for users: Code download Compilation instructions (partially outdated) Manual (outdated) Tutorials Input variable reference ... Dedicated section for developers
“Starting to develop” guide (must read!) Workflow guide (must read!) Coding standards Input variable reference (development version) Some code documentation (partially outdated) ...
Octopus includes a large collection of regression tests Test suite covers ∼ 65% of the code Continuous integration (CI) using Buildbot Buildbot is interfaced with GitLab
Compilation and configuration is based on autotools Configure script is generated from configure.ac Makefiles are generated from Makefile.am files in each directory To generate the configure scripts run autoreconf -i VPATH builds are supported and suggested.
Set of rules and guidelines for writing code Deals with indentation, white spaces, naming conventions, etc Makes the code easier to read and understand Ideally the code should read like plain English
i f ( s p a c e%p e r i o d i c d i m > 0 ) t h e n
... end i f
i f ( s p a c e%i s p e r i o d i c ( ) ) t h e n
... end i f
Helps avoiding some errors
https://octopus-code.org/wiki/Developers:Coding_standards
Changes the source before compilation We use the C preprocessor: Standard Widely available Requires some tricks to work with Fortran code Imposes (few) limitations on Fortran code Several macros generated when running configure script Conditional compilation: #i f d e f HAVE MPI
... #e l s e ... #e n d i f
Templating to generate same subroutine with different data types (float/complex/integers, scalar/array, etc)
Calls allocate Returns error on failure Counts allocated memory for profiling PUSH SUB() / POP SUB() Generates a call stack used for debugging MAX DIM Maximum dimension the code can run Deprecated FLOAT, CMPLX Allow to change the real and complex types at compile time Was introduced to allow compilation in single precision Not really useful anymore; will likely be removed