NERSCPowering Scientific Discovery Since 1974

Object-Oriented Programming in Fortran 2003

DamianR5x

Damian Rouson

March 26-28, 2012
Berkeley, CA

and repeated on

April 10-12, 2012
Oakland, CA

Fortran 2003 explicitly supports object-oriented programming (OOP). OOP aims to increase a program's maintainability in part by reducing cross-module data dependencies and to increase a program's reusability in part by providing for extensible derived types. Emerging compiler support for Fortran 2003 inspires a more modern program design and implementation style. This course provides the requisite skills. Day 1 introduces OOP in Fortran 2003. Day 2 introduces patterns of best practice in program organization. Day 3 explores several paths toward parallel OOP. Examples will utilize introductory-level numerical algorithms from linear algebra and differential equations inspired by multiphysics modeling that is coupled field problems common to many interdisciplinary, engineering, and physical science simulations.

This course will be given by Damian Rouson and Karla Morris from Sandia National Laboratories in the US. Damian is the manager of the Reacting Flow Research Department and a Visiting Assistant Professor at the University of Cyprus. His research interests focus on scalable scientific software design. He has recently written a book on the subject, Scientific Software Design: The Object Oriented Way . He is also the software architect of the object oriented Fortran interface to Trilinos, ForTrilinos. ForTrilinos provides Fortran applications direct access to capabilities in the Trilinos project

Karla is a senior member of technical staff in the Reacting Flow Research Department at Sandia. She is the lead developer of ForTrilinos. Her research interests include computational fluid dynamics to multiphysics flows and scientific software architectur

Locations & Dates

Sutardja Dai Hall  (March 26-28)
Room 250
University of California
Berkeley, CA

Sutardja Dai Hall on the University of California camput is home to the headquarters of the Center for Information Technology Research in the Interest of Society (CITRIS). Lawrence Berkeley National Laboratory is nearby.

NERSC OSF (April 10-12)

Room 238

415 20th Street (Thomas L Berkley Way)

Oakland, CA

The Berkeley Lab Oakland Scientific Facility in downtown Oakland, CA houses  NERSC staff, computers and storage systems.

Web Streaming (April 10-12)

The April 10-12 class will be streamed over the web. Depending on the number of registrants, instructors may not be available for Q&A.

 

Getting Around

Visting and Getting Around UC-Berkeley

OSF Visitor Information

Registration

Registration is required. There is no registration fee. Registration is limited to 40 in Berkeley and 25 in Oakland and is on a first-come, first-served basis.

Prerequisites

  • Familiarity  with  Fortran  90  modules  and  derived  types.
  • Undergraduate-­‐level  familiarity  with  differential  equations  &  matrices.

Course Syllabus

Day  1:  Object‐Oriented  Analysis,  Design  &  Programming  

Why  Object-­‐Oriented  Programming  (OOP)?  

Conventional  programming  costs  and  complexity;  Alternative  programming  paradigms;   How  performance  informs  design;  How  design  informs  performance.

The  Object-­‐Oriented  Way  

Object-­‐Oriented  Analysis  (OOA).    Object-­‐Oriented  Design  (OOD).    Unified  Modeling   Language  (UML):  use  case  and  class  diagrams.    OOP  in  Fortran  2003:  User-­‐defined   structure  constructors;  encapsulation  and  information  hiding  via  modules  and  private   scoping;  composition,  aggregation,  and  inheritance  via  extensible  derived  types;  static   and  dynamic  polymorphism  via  generic  interfaces  and  class  variables.

Scientific  OOP  

User-­‐defined  operators  and  assignments;  Abstract  data  type  calculus;  Object-­‐oriented   design  metrics.

Day  2:  Best  Practices  in  OOD  

OOD  patterns:  Design  patterns  essentials  and  application  prototypes;  General  patterns:   Strategy,  Surrogate,  Abstract  Factory,  and  Factory  Method.  Domain-­‐specific  patterns:   Abstract  Calculus  and  Puppeteer.    UML  object  and  sequence  diagrams. 

Day  3:  Parallel  OOP  

 Multithreaded  objects  via  OpenMP.    Distributed-­‐memory  objects  via  the  ForTrilinos   interfaces:  Encapsulating  the  Message  Passing  Interface  (MPI)  in  classes.    Platform-­‐ independent  parallelism  via  Fortran  2008  coarrays. 

Background  Materials  

The  course  will  draw  material  from  Ref.  1  below.  Ref.  2  is  recommended  for  Fortran   background.    Ref.  3  links  to  open-­‐source  software  that  will  be  used  extensively  on  Day  3.  

1. Rouson,  D.,  J.  Xia,  and  X.  Xu  (2011)  Scientific  Software  Design:  The  Object-­‐ Oriented  Way.  Cambridge  University  Press,  Cambridge,  UK.

2. Metcalf,  M.,  J.  Reid,  and  M.  Cohen  (2011)  Modern  Fortran  Explained.  Oxford   University  Press,  Oxford,  UK.  

3. http://trilinos.sandia.gov/packages/fortrilinos/

Appendix  A  of  Ref.  1  summarizes  useful  mathematical  material.

Downloads