scientific computing

29
Scientific Computing Dr. Guy Tel-Zur Version 28-05-2011.12:40

Upload: isaiah

Post on 22-Feb-2016

30 views

Category:

Documents


0 download

DESCRIPTION

Scientific Computing. Dr. Guy Tel- Zur. Version 28-05-2011.12:40. Agenda. Administration Visualization Visualization in Sage VisIt : Tutorial The Silo file format A demo program Animation Demo : AWS – HTC Instance for Parallel Computing and Cellular Automata / NKS demo on the cloud - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Scientific Computing

Scientific Computing

Dr. Guy Tel-Zur

Version 28-05-2011.12:40

Page 2: Scientific Computing

Agenda• Administration• Visualization

• Visualization in Sage• VisIt:

– Tutorial – The Silo file format– A demo program– Animation

• Demo: AWS – HTC Instance for Parallel Computing and Cellular Automata / NKS demo on the cloud

• Parallel Profiling

• Home assignment #3 (next week)

Page 3: Scientific Computing

Final Projects

• Please hurry to choose a topic!• Send an email to [email protected] with:

– Your name– Project title– An abstract– Computational tools, e.g. MPI, Condor…

Page 4: Scientific Computing

Sage Vmware Player

Shared folder under:/mnt/hgfs/shared/

Page 5: Scientific Computing

# reference: http://www.packtpub.com/article/plotting-data-sagep1 = plot(sin, (-2*pi, 2*pi), thickness=2.0, rgbcolor=(0.5, 1, 0), legend_label='sin(x)')p2 = plot(cos, (-2*pi, 2*pi), thickness=3.0, color='purple', alpha=0.5, legend_label='cos(x)')plt = p1 + p2plt.axes_labels(['x', 'f(x)'])

show(plt)

Page 6: Scientific Computing

# plotting a function with a polepole_plot = plot(1 / (x - 1), (0.8, 1.2), detect_poles='show', marker='.')print("min y = {0} max y = {1}".format(pole_plot.ymax(), pole_plot.ymin()))pole_plot.ymax(100.0)pole_plot.ymin(-100.0)# Use TeX to make nicer labelspole_plot.axes_labels([r'$x$', r'$1/(x-1)$'])pole_plot.show()

Page 7: Scientific Computing

# plotting a parametric functionvar('t')pp = parametric_plot((cos(t), sin(t)), (t, 0, 2*pi), fill=True, fillcolor='blue')pp.show(aspect_ratio=1, figsize=(3, 3), frame=True)

Page 8: Scientific Computing

# making a polar plot# A linear broadside array of short vertical dipoles# located along the z axis with 1/2 wavelength spacingvar('r, theta')N = 7normalized_element_pattern = sin(theta)array_factor = 1 / N * sin(N * pi / 2 * cos(theta)) \/ sin(pi / 2 * cos(theta))array_plot = polar_plot(abs(array_factor), (theta, 0, pi), color='red', legend_label='Array')radiation_plot = polar_plot(abs(normalized_element_pattern * array_factor), (theta, 0, pi), color='blue', legend_label='Radiation')combined_plot = array_plot + radiation_plotcombined_plot.xmin(-0.25)combined_plot.xmax(0.25)combined_plot.set_legend_options(loc=(0.5, 0.3))show(combined_plot, figsize=(2, 5), aspect_ratio=1)

Page 9: Scientific Computing

# plotting a vector fieldvar('x, y')a = plot_vector_field((x*x, y), (x, -3, 3), (y, -3, 3), color='blue')b = plot_vector_field((y, -x), (x, -3, 3), (y, -3, 3), color='red')show(a + b, aspect_ratio=1, figsize=(4, 4))

Page 10: Scientific Computing

# making a scatter plotdef noisy_line(m, b, x): return m * x + b + 0.5 * (random() - 0.5)

slope = 1.0intercept = -0.5x_coords = [random() for t in range(50)]y_coords = [noisy_line(slope, intercept, x) for x in x_coords]sp = scatter_plot(zip(x_coords, y_coords))sp += line([(0.0, intercept), (1.0, slope+intercept)], color='red')sp.show()

Page 11: Scientific Computing

# reference: http://diffusion.cgu.edu.tw/ftp/sage/# 2D plotplot(sin(x^2-x+1/(x-1)),(x,-pi,pi))

Page 12: Scientific Computing

# animation (not working in power point , do the real demoa=animate([sin(x^k)/x^k for k in srange(1,10)], xmin=-pi, xmax=pi, ymin=-0.3, ymax=1)a.show()

Page 13: Scientific Computing

# 3D plot for x^2-x*y+y^2+1 and surface x^2+y^2-1=0var('x, y, z')s1=plot3d(x^2-x*y+y^2+1,(x,-2,2),(y,-2,2),opacity=0.5)s2=implicit_plot3d(x^2+y^2-1,(x,-2,2),(y,-2,2),(z,0,10),color='red',opacity=0.7)show(s1+s2)

Page 14: Scientific Computing

Visualization: The Silo file format

• References:– Download:

https://wci.llnl.gov/codes/silo/release_notes.html(BSD License)– http://www.e-science.le.ac.uk/format/silo.shtml– http://www.e-science.le.ac.uk/format/silocode.sht

ml

Page 15: Scientific Computing

Visualization: A demo program

• Use VirtualBox Ubuntu Install Silo and VisIt

• Installation was not smooth on Ubuntu 10.4, I had to install libstdc++5 manually (an older version)

• Let’s look at “wave.c”– Open DevC++ with: C:\Users\telzur\Documents\My Talks\MIL_OSS\

silo\silo-4.8-bsd\tests\wave.c

Page 16: Scientific Computing

Silo

• Discuss in class the wave.c program• Run the program on the Virtual Machine• Make plot using VisIt• Make a mpeg movie!

Bulding silo:./configuremakesudo make installcd ./testsmake wave./wave

Page 17: Scientific Computing

wave.c silo file

Page 18: Scientific Computing

Mini Course: Performance Tuning

• Open VirtualBox SC10 demos:• Vampir (commercial, only a free viewer)

• TAU – Paraprof (free)• Scalasca (free)• Marmot (free)

Page 19: Scientific Computing

/home/livetau/workshop-point/ring$ mpirun -np 4 ./ring 0 started. 2 started. 3 started. 1 started. 0 done. 2 done. 3 done. 1 done./home/livetau/workshop-point/ring$pprof…

pprof profiler

Page 20: Scientific Computing

NODE 3;CONTEXT 0;THREAD 0:---------------------------------------------------------------------------------------%Time Exclusive Inclusive #Call #Subrs Inclusive Name msec total msec usec/call ---------------------------------------------------------------------------------------100.0 0.363 1,070 1 5 1070955 MAIN 97.3 1,041 1,041 1 0 1041995 MPI_Init() 1.8 0.26 19 1 4 19144 FUNC 1.6 17 17 1 0 17531 MPI_Barrier() 0.9 9 9 1 0 9439 MPI_Finalize() 0.1 1 1 1 0 1009 MPI_Bcast() 0.0 0.323 0.323 1 0 323 MPI_Recv() 0.0 0.021 0.021 1 0 21 MPI_Send() 0.0 0.007 0.007 1 0 7 MPI_Comm_rank() 0.0 0.007 0.007 1 0 7 MPI_Comm_size() ---------------------------------------------------------------------------------------

Page 21: Scientific Computing

FUNCTION SUMMARY (mean):---------------------------------------------------------------------------------------%Time Exclusive Inclusive #Call #Subrs Inclusive Name msec total msec usec/call ---------------------------------------------------------------------------------------100.0 0.242 1,087 1 5 1087028 MAIN 97.7 1,062 1,062 1 0 1062336 MPI_Init() 1.5 1 16 1 4 16716 FUNC 1.3 14 14 1 0 14208 MPI_Barrier() 0.7 7 7 1 0 7708 MPI_Finalize() 0.0 0.427 0.427 1 0 427 MPI_Bcast() 0.0 0.228 0.228 1 0 228 MPI_Recv() 0.0 0.0307 0.0307 1 0 31 MPI_Send() 0.0 0.0155 0.0155 1 0 16 MPI_Comm_size() 0.0 0.0105 0.0105 1 0 10 MPI_Comm_rank()

Page 22: Scientific Computing
Page 23: Scientific Computing

TAU –pprof, paraprofcd to: workshop-point/ring

Page 24: Scientific Computing

HPC – Performance Optimization Cycle

Source: Scalasca user guide

Page 25: Scientific Computing

Scalasca

Step1: scalasca –instrument mpicc –o jacobi ./main.c ./jacobi.c

Step 2: scalasca –analyze mpirun –np 4 ./jacobi

Step 3: scalasca –examine epick_<title>

Users guide: http://www.fz-juelich.de/jsc/datapool/scalasca/UserGuide.pdf

BTW: Virtual Box file sharing: as root:mount –t vboxsf guytmp ./guytmp

Page 26: Scientific Computing

HTC Cloud Computing Demo

Goal:Install Condor on the HPC cloud machine

Run many Cellular Automata jobs

Check graphical output

How to install Condor on Debian:http://www.cs.wisc.edu/condor/debian/

Page 27: Scientific Computing

AWS - CloudWatch

Page 28: Scientific Computing

8 cores !

Page 29: Scientific Computing

NKS

Reference: http://telzur.blogspot.com/2008/01/mysteries-of-cellular-automata.html