Fortran for Scientific and High Performance Computing

Description: This course attempts to answer the question often asked from the research community: Do you still support FORTRAN? While to many FORTRAN sounds like Latin, a dead, ancient language with its glory in the past, the reality is quite different. Modern Fortran, as its name, is spelled differently today and very much alive, still widely used. Fortran has undergone significant modifications and improvement in the past two decades -- an evolution on a scale rarely seen in any other languages. If you use MATLAB, you will find Fortran has the identical syntax and simplicity in array operations, yet achieves a much higher performance.

With the latest Fortran standard, the language has gained many modern features, become very different from its ancestor, leaving behind archaic ones like column-oriented formatting, common blocks and a proclivity for UPPER CASE EVERYTHING. Inherited from old FORTRAN standards and enhanced by the newer ones, Fortran is still among the top candidates for scientific computing for its strength in REAL and COMPLEX intrinsics, array processing and floating point operations. Its array handling, enhanced by index looping, makes array processing similar or identical to its counterparts, such as MATLAB, hence superior to other programming languages. The unified interface of intrinsic functions for all data types makes translating mathematical expressions to computer programmes much cleaner and easier. Lastly, the SPMD (single program, multiple data) parallelization scheme supported by the intrinsic partitioned global address space (PGAS) model since Fortran 2008 standard enables scientists and engineers to write parallel code extremely easily without using MPI or OpenMP.

In this one day course, we will cover the following

  • Review of the language basics and the latest standard 2018
  • Compilers and development environment
  • Data I/O
  • Useful features one should know, e.g. specifiable precision, taking command line arguments, executing system commands, timers, optional arguments in functions and subroutines
  • Array slicing and loop constructs
  • Random number generators, using libraries
  • Writing and compiling source code in multiple files
  • Calling C/C++ functions and interoperability
  • Parallel processing with coarrays and co-routines on shared and distributed memory systems made extremely simple!

The targeted audience would be physicists, mathematicians, engineers, economists and others who are using Fortran in their research. Throughout the day, the participants shall expect do hands-on exercises ranging from simple tryout examples to moderate and advanced parallel code.

Instructor: Ge Baolai, SHARCNET, Western University.

Prerequisites: No prior experience is required, however, knowing a programming language such as C or C++ would be helpful. Being familiar with MATLAB will be an asset. The attendees are assumed to have some knowledge in numerical methods, as the examples presented in the class will be given in the context of scientific computing.

Requirements: It is strongly recommended that one has the following installed on a laptop to be used at the summer school.

Windows Subsystem for Linux
For Windows users, it is highly recommended to install Windows Subsystem for Linux (WSL) and a Linux distro. The following URL gives a set of easy to follow, step by step instructions

https://docs.microsoft.com/en-us/windows/wsl/install-win10

For the Linux distro, either Debian or Ubuntu is recommended if you do not have a preference.

Cygwin for Windows
Alternatively, one can install the Unix-like environment cygwin running on Windows. Cygwin can be downloaded at the URL below

http://x.cygwin.com/

For both Linux and Windows users, after a base installation, one may choose to add components needed. In particular the following packages are recommended:
  • An editor, e.g. vi or nano;
  • GCC and GNU Fortran compilers (gcc, gfortran);
  • OpenMPI libary (openmpi);
  • Open Coarrays (opencoarrays);
  • SSH client (openssh-client).
Open Coarrays is not included in cygwint. One would need to download the source from the Open Coarray Project:

http://www.opencoarrays.org/