GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a...

22
GPU HACKATHON #gpucesgahack 29 mayo - 1 junio Santiago de Compostela TEAM 3 Francisco Padilla Benítez

Transcript of GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a...

Page 1: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

GPU HACKATHON#gpucesgahack

29 mayo - 1 junio Santiago de Compostela

TEAM 3

Francisco Padilla Benítez

Page 2: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Integrated Numerical Modeling of Water Flow

Freshwater

Saltwater

Surface water

Groundwater

ETS Ingenieros de Caminos, Canales y Puertos de la Universidad de La CoruñaGrupo de Ingeniería del Agua y del Medio Ambiente

F. Padilla

F.Padilla - Universidad de La Coruña

2017, 29 May

Page 3: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Finite element model for surface/groundwater hydrology of saltwater/freshwater in

watersheds

Groundwater freshwater saltwater

Surface water

F.Padilla - Universidad de La Coruña

FRESHWATERSHEDSea water

freshwaterwatershed

Page 4: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

4

Horizontal numerical simulation of hydrological, environmental and water engineering problems

F.Padilla – ETSICCPUniversidad de La Coruña

Page 5: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

5

Geographical and hydrological regional analysisNumerical simulation

• GIS (parameters and simulation conditions)• Mesh builder (triangular elements)• Numerical software (Fortran 77, 32, GMRS, ram)

F.Padilla - Universidad de La Coruña FRESHWATERSHED

• Interface (Matlab)

Page 6: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

6

Scaling up the numerical simulation (a spatial and transient problem)

F.Padilla - Universidad de La Coruña

Page 7: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

7

Finite elementsspatial mesh

F.Padilla - Universidad de La Coruña

Page 8: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

8

Temporal Scale

• of calculation (seconds, minutes, hours)

• of simulationn (days, months, years)

F.Padilla - Universidad de La Coruña FRESHWATERSHED

Page 9: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

9

Velocity field evolution of surface water on the reservoir 2008-2012

F.Padilla – ETSCCPUniversidad de La Coruña

Longitudinal ProfileDam

Page 10: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

10

Phreatic Levels and

Water depths

F.Padilla - Universidad de La Coruña

Page 11: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

11

Increasing the spatial and temporal scale of the applications

Page 12: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

ANALYSIS (DRAFT)

1. Algorithmic features (Fortran FreshWaterSheds: i.e. routine AL2HKC)

2. Parallel design patterns (parallel sparse reduction)3. Implementation features

Page 13: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Algorithmic features● Spatial discretization?

○ Finite differences?○ Finite elements○ Finite volumes?○ Type of elements: triangle, square?

● Type of solver?○ Direct vs Iterative (convergence criteria) YES○ Adaptive discretization of the domain? NO○ Sparse/Irregular computations (e.g. sparse matrices -CRS-)? NO○ Based on solving systems of linear equations? YES

● Compute-bounded? YES● Memory-bounded? NO

Page 14: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Parallel design patterns● Fully parallel loops? no● Parallel scalar reductions?no● Parallel sparse reductions?yes

Page 15: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

AL2HKCC------ BOUCLE SUR LES �ELE�MENTSC ======================= DO 10 IC = 1,NELCOLCDIR$ IVDEP DO 20 IE = KELCOL(1,IC),KELCOL(2,IC) NO1 = KNG(1,IE) NO2 = KNG(2,IE) NO3 = KNG(3,IE)--C------ ASSEMBLAGE VFG(1,NO1)=VFG(1,NO1)+(VSX*DFX+VSY*DFY)*ALFAPAS+AM1 VFG(1,NO2)=VFG(1,NO2)+(VKX*DFX+VKY*DFY)*ALFAPAS+AM2VFG(1,NO3)=VFG(1,NO3)+(VEX*DFX+VEY*DFY)*ALFAPAS+AM320 CONTINUE10 CONTINUE

Page 16: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Parallel design patterns● Fully parallel loops? no● Parallel scalar reductions? no● Parallel sparse reductions? yes

Page 17: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Compiling on Windows the Fortran 77 code supporting OpenMP

- Installation of free Eclipse (Photran) and GCC (Fortran)

- Compilation and Linkage of the sequential Fortran code.

- Quite long,. to realize that GCC does not support Fortran 77.

- No execution available.

Page 18: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Compiling on Finisterrae the sequential Fortran 77 code

- On Linux, not too much problem (thanks to Jose Mourinho)

- A short sequential case (10 minutes) accelerates (2

minutes) about 5 times the Windows execution.

- A long term problem (36 hours), after running on the tail

of Finisterrae, accelerates (12 hours) about 3 times the

Windows execution.

Page 19: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Appraisal of the Finisterrae results and execution

- Levels of convergence aren’t equals.

- Some results (execution variables) aren’t exactly the

same (initially quite similar, afterwards less similar).

- Obviously, some Subroutines (posttreatment variables)

aren’t working properly.

Page 20: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Measure of sequential execution for a Long term run (Windows vs Linux)

Execution variable

Windows Linux

Page 21: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

Measure of sequential execution for a Long term run (Windows vs Linux) Posttreatment

variable

Windows Linux

Page 22: GPU HACKATHON TEAM 3 - Appentra• Interface (Matlab) 6 Scaling up the numerical simulation (a spatial and transient problem) F.Padilla - Universidad de La Coruña. 7 ... *ALFAPAS+AM2

New developments

- Find out a new “free” Compiler for Fortran 77 supporting

OpenMP on Windows.

- Work out the problems of Compilation and Linkage on

Windows and Linux.

- Parallelize a “Hot Spot” Subroutine for Windows (LabTop)

and Linux (Finisterrae), and seek out for the time

differences of calculus.