Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and...

26
Scilab for Mathematical Education and High Performance Computing Tetsuya SAKURAI University of Tsukuba

Transcript of Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and...

Page 1: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Scilab for Mathematical Education and High Performance Computing

Tetsuya SAKURAI University of Tsukuba

Page 2: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Contents   Scilab for Math Education

  Promoting the use of ICT in classroom - Interactive white board, slate PC, projector, internet

  Math education with computer   Hands-on with graphs   Lecture in high school   Touch interface for inputting Math expressions

  Scilab for High Performance Computing (HPC)   Multicore and distributed computing platforms   Developing high performance applications   Examples   Scilab for application design

  Conclusions

2

Page 3: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Scilab for

Math Education

3

Page 4: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Promoting the use of ICT in Classroom   Promotion by MEXT (Ministry of Education, Culture, Sports, Science

and Technology of Japan):   assists improvements of ICT environment in school

- Interactive white board, PC, Internet, etc.   pursues to utilize ICT in classrooms   encourages to develop and to provide course materials

4

http://www.mext.go.jp/

Good computer tools for education are required.

Page 5: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Math Education with Computer   Computers provide various hands-on learning and teaching opportunities

in Math education   Computers help students to understand various Math concepts

  The skills for search, curation, analysis, etc., are useful not only for Math

  Such experiences lead to skills for real-world problem solving using a computer

  Animation of graphs   effective to visualize Math concepts

5

Graphs are static on a blackboard Graphs are dynamic on a screen

Page 6: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Programming Tools BASIC   BASIC is still used in high school textbooks in Japan

  requires some knowledge about declare of array, type of variables, etc.

  does not have operations for typical mathematical variables such as matrices, vectors, complex numbers and polynomials

  requires additional programming to draw graphs and figures

6

We need an alternative programming tool

Page 7: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Programming Tools

x = -16:0.1:16;

y = x^2 - 2*x - 1;

plot2d(x,y,rect=[-16,-10,16,10],

axesflag=5);

7

Scilab BASIC

Page 8: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Programming Tools Scilab   Scilab can be a better alternative for BASIC in Math education

  does not require knowledge about declare of array, type of variables, etc.

  has operations for typical mathematical variables such as matrices, vectors, complex numbers and polynomials

  provides functions to draw graphs and figures

  Useful toolboxes are provided for signal processing, control theory, simulations, etc.

  Low cost for installation and running

8

Page 9: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Hands-on with Graphs Draw a graph of x2 – 124 x + 1.

9

Interval [-1, 1]

Interval [-20, 160]

Many students draw a graph with the interval [-1, 1].

"The graph seems linear . . . something wrong with the program"

Page 10: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Hands-on with Graphs Draw a graph of data.

10

Linear plot Double logarithmic plot

Logarithmic plot gives rich information from the given data.

Page 11: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Hands-on with Graphs

x = linspace(0,10,100);!for t=1:3! y = x^2 - 4*t*x + 4*t^2 + t - 3;! plot2d(x,y,t,rect=[0,-4,10,10]);!end!

y = (1/2)*x - 3;!plot2d(x,y,5);!

11

Find the common tangent line of

with t = 1, 2, 3.

Page 12: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Scilab for Hands-on Tools   Scilab is easy to make Math education tools with GUI

12

Page 13: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Using Scilab as Backend Computing/Graphing Engine

Input Math Expressions Display Graph Output

Control Parameters

Display Numerical Results

13

MathGUIde (frontend tool) calls Scilab as a computing/graphing engine via Java interface

MathGUIde

Page 14: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

A Graph Tool in Classroom

Example of MathGUIde with an interactive whiteboard

Students can predict a next event by teacher's action

14

Page 15: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Example: Lecture in High School   Example of the use of a graphing tool at high school math class

Senior High School at Sakado, University of Tsukuba

15

Page 16: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Input Interface for Math Expressions

Input Field

Hold Touch

sin

x + ×

Multi-touch provides a good userbility for inputting Math expressions

16

Page 17: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Input Interface for Math Expressions

17

Demo movie

Page 18: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Scilab for

High Performance Computing (HPC)

18

Page 19: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Multicore and Distributed Computing Platforms   Multicore:

Clock frequency of CPU hit a peak around 2004. -- Paradigm to increase a CPU performance had changed.

19

We can not enjoy the automatic performance improvements by clock speed.

Single-core Multi-core

Page 20: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Multicore and Distributed Computing Platforms   Distributed computing:

We need to develop high performance applications with over tens of thousands of nodes for large-scale simulations.

20

http://www.top500.org/

current future status #CPUs 68,544 over 80,000 #cores 548,352 over 640,000 performance 8.17 Peta FLOPs over 10 Peta

K computer: next generation supercomputer in Japan

Page 21: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Developing High Performance Applications   Process for developing a high performance application

  Phase 1: Application design   Phase 2: Performance evaluation   Phase 3: Tackle target problems

21

Phase 1: > Use a supercomputer with

middle size problems > Implement parallel codes > Find appropriate parameters > Evaluate a performance

> Use a supercomputer with large size problems

> Tackle target problems > Solve real problems and

obtain physical results > Try for grand challenge

> Use a workstation or a small cluster with small size problems

> Find appropriate algorithms and solvers

> Design an application

Phase 2: Phase 3:

Page 22: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Example of Phase 1 (Supernova)   Couple of radiative transfer equation and fluid-flow equation

Systems of linear equations Sumiyoshi, et.al. (1988)

A.K.Mann (1997) Test problem: matrix size = 85,680 (750MB)

GCR method without preconditioning

Number of iterations

Residual

GCR method with an effective preconditioner

Number of iterations

Residual

stagnated

22

Page 23: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Example of Phase 1 (Quantum Dot)   Quantum dot simulation

23

Asakura, et.al. (2010)

Polynomial eigenvalue problems Hwang, et.al. (2004)

n=32,401,863 (5.4 GB)

n=1,532,255 (258 MB)

Number of iterations

Res

idua

l

BiCGSTAB method without preconditioning When the matrix size exceeds ten million, the BiCGSTAB method without preconditioning does not converge.

Even in Phase 1, we need to treat relatively large-scale problems.

Software: C++/PETSc, Fortran90/OpenMP, . . . Hardware: AMD 48cores + 256GB of memory, Xeon 8cores + 48GB of memory + Tesla, . . .

Contour integral based eigensolver (Nonlinear SS method)

n=186,543 (30 MB)

systems of linear equations

Page 24: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

8 32 128 512 2048

2500

1000

500

100

sec Computational time on CRAY XT4

number of cores

Test problem: Accelerator design* *R. Lee (2007) Matrix size = 1,100,242 (linear part)

Language: Fortran90/MPI Linear solver: sparse direct solver

http://www.linearcollider.org/cms/

SS method

Lanczos method

  Contour integral based eigensolver (SS method*)

  A target subspace is constructed by a filter using contour integral

  The filter is derived by solving systems of linear equations, simultaneously

coarse grained parallelism

Example of Phase 2 (Accelerator Design) *Sakurai, et.al. (2003), Ikegami, et.al. (2010)

Input: random vectors

Solve systems of linear equations, simultaneously

Output: target eigenvectors

24

Page 25: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Scilab for Application Design   Scilab is useful in Phase 1

  Check matrix properties   Compare various algorithms   Try new ideas   Find good parameters   . . .

  Memory limit is the major restriction   Even in Phase 1, we need to treat relatively large-scale problems   Scilab for distributed computing is required

  We expect a toolbox for distributed computing which supports   Management of distributed data   Matrix-vector product, inner product, etc.   Krylov subspace methods, QR decomposition, Sparse LU factorization, etc.   Interface to libraries such as PETSc or Trilinos, etc.

(ex. Python + Trilinos)

25

Page 26: Scilab for Mathematical Education and High Performance ... · Scilab for Mathematical Education and High Performance Computing ... Scilab for application design ... Useful toolboxes

Conclusions   Scilab for Math education

  Now digital equipments are ready in classroom   Scilab can be used for hands-on Math education   Scilab is also useful as a backend computing/graphing engine

  Scilab for High Performance Computing   Scilab is useful in a process of HPC application design   Memory limit restricts scalability   Distributed computing is required

  New features of Scilab 6 -- new memory handling, thread safe, optimize for multicore, Scilab gateway, etc.

26