Copyright R.A. van Engelen, FSU Department of Computer Science, 2000

# Problem-Solving Environments

• Supported by Center Of Excellence (Oceanography)
• Scientific application prototyping and development
• The CTADEL system is a translator of high-level model descriptions into efficient numerical (parallel) programs
• CTADEL used to generate codes for HIRLAM numerical weather forecast system
• Team members:

• Gerard Cats (Royal Netherlands Meteorological Institute)
Paul van der Mark
Prof. van Engelen
Prof. Dewar (Oceanography)
Prof. Wolters (Leiden University)

# Numerical Weather Forecast

• HIRLAM (HIgh Resolution Limited Area Model)
• Used in many European countries to predict weather
• 3D grid with 110x100x16 (LONGxLATxVERT) points covers prediction area
• Each grid point models local temperature, wind velocities and direction, humidity, etc.

# Automatic Code Generation

• Automatic code generation for weather forecast models involves the translation of model descriptions into (parallelized) Fortran programs
• An example translation of the surface pressure equation to discretized form is shown below
 Surface pressure field declaration Surface pressure equation Dimensional analysis Discretization

# Automatic Code Generation: Data Parallel Code

• The HPF data parallel Fortran program generated:
 ```      FORALL (j=1:nlat,i=1:nlon+1) t31(i,j) = 0       DO k = 1,nlev-1          FORALL (j=1:nlat,i=1:nlon+1) t31(i,j) = t31(i,j)+(p(i,j,k)      .   +p(i-1,j,k)-p(i,j,k+1)-p(i-1,j,k+1))*(u(i-1,j,k)+u(i-1,j,k+1))       ENDDO       FORALL (j=1:nlat,i=1:nlon+1) t31(i,j) = -0.25*t31(i,j)       FORALL (j=1:nlat+1,i=1:nlon) t35(i,j) = 0       DO k = 1,nlev-1          FORALL (j=1:nlat+1,i=1:nlon) t35(i,j) = t35(i,j)+(p(i,j,k)      .   +p(i,j-1,k)-p(i,j,k+1)-p(i,j-1,k+1))*(v(i,j-1,k)+v(i,j-1,k+1))       ENDDO       FORALL (j=1:nlat+1,i=1:nlon) t35(i,j) = -0.25*t35(i,j)       FORALL (j=1:nlat,i=1:nlon) pst(i,j) = -1.56961230576048E-7*(      .  (1/dlam*(hyu(i,j)*t31(i+1,j)-hyu(i-1,j)*t31(i,j))+1/dtheta      .  *(hxv(i,j)*t35(i,j+1)-hxv(i,j-1)*t35(i,j)))/(hxt(i,j)*hyt(i,j))      .  )```

# Automatic Code Generation: Data Distribution for Message Passing Code

• CTADEL can also generate Fortran with message passing code
• The horizontal component of the data is distributed among the available processors
• The Fortran code computes the forecast for each block in parallel
• When the horizontal is split in four by four blocks, we get:
• Each block has an overlap with neighboring blocks
• The overlap is the data that needs to be communicated between the neighboring processors

# Open Student Projects

• Code generation for coupled ocean-atmosphere models