Scientific Computing Dr. Guy Tel-Zur 2011B Sunny Yellow Flower. Picture by Sharee Basinger, publicdomainpictures.net Version: 14-10-2010 15:50 Survey • • • • Linux? C/C++? Python? Parallel Computing? • CS, Biology, Chemistry, Other Fields? The Course Vision “The crucial need for today's students and readers is to move forward from the older "formula-based" emphasis toward a solution-based course. Solving problems is the heart of modern engineering mathematics and scientific computing. “ – Gilbert Strang – Computational Science and Engineering, page 7, SIAM (2007). What is Computational Physics? Reference: Resource Letter CP-2: Computational Physics Rubin H. Landau, Am. J. Phys. 76 4&5, April/May 2008 A broader view – Computational Science X=Physics, Biology, Chemistry, … X Computational X CS Math Reference: Resource Letter CP-2: Computational Physics Rubin H. Landau, Am. J. Phys. 76 4&5, April/May 2008 3 Pillars Theory Computational Science Experiment 4 Pillars? Theory Computational Science Data Mining Experiment 2 Computational Pillars See next slide, from Communications of the ACM, http://cacm.acm.org/magazines/2010/9/98038-science-has-only-two-legs/fulltext September 2010 issue NVIDIA CEO at the GTC2010, Sept. 2010 The 3rd Pillar of Science is HPC !!! HPC = High – Performance Computing Journals and Magazines… Springer Journal of Scientific Computing SIAM Journal on Scientific Computing (SISC) International Journal of Modeling, Simulation, and Scientific Computing (IJMSSC) Journal of Advanced Research in Scientific Computing (JARSC) Career Opportunities for Computational Physicists • A graduate degree in physics in areas such as biophysics, condensed matter physics, particle physics, astrophysics to name a few. • A career in High-performance and scientific computing, in the energy and aerospace sectors, with chemical and pharmaceutical companies, with environmental management agencies. • Employment in firms that develop scientific software, as well as computer games. • A research career in an academic, industrial, or national laboratory • A teaching career in physics • A job in Wall Street. Even Wall Street employers are interested in people with a background in computational physics. Source: http://www.sru.edu/academics/colleges/ches/physics/Pages/ComputationalPhysics%28BS%29.aspx Source: COMPUTATIONAL PHYSICS FOR UNDERGRADUATES THE CPUG DEGREE PROGRAM AT OREGON STATE UNIVERSITY By Rubin H. Landau. CS&E March/April 2004 Source: COMPUTATIONAL PHYSICS FOR UNDERGRADUATES THE CPUG DEGREE PROGRAM AT OREGON STATE UNIVERSITY By Rubin H. Landau. CS&E March/April 2004 Course Building Blocks Tools Methods Mathematics Case Studies “Mini-Courses” Physics Practice Rubin Landau et al, “A Survey of Computational Physics” Parallel and distributed computing Rubin Landau et al, “A Survey of Computational Physics” Scheme on previous slide refers to at least 2 quarters (20 weeks) course Source: http://www.princeton.edu/as/LNL/presentations/spring2010/LnL031010TangFusionSimulation.pdf What V&V Means? The problem of quantifying uncertainty: Validation "Solving the right equations" Verification "Solving the equations right" Tools • Programming Languages – C/C++ – Fortran – Python +OpenMP +MPI +Condor • Numerical Tools – CERN paw/root/Matlab/Octave/Scilab • Visualization – VTK - grace - Paraview -VisIt -Mayavi – Vpython - GNUplot – Workflow – Kepler(?) Full Scientific Research Study – “Workflow” Raw Data Number Crunching/Data Analysis Reduced Data Visualization Prototyping (Matlab) “Batch” “Data Base” Specific Format , e.g. NetCDF Interactive mode Parallelism Introducing Parallelism whenever possible is going to be my own “twist” to the course AMD Magny-Cours 12-core processor Power7: IBM’s Next-Generation Server Processor with 8 cores. The chip is 567 mm2 and contains 1.2 billion transistors Recommended Reading: http://www.computer.org/cms/Computer.org/ComputingNow /homepage/2010/0710/W_MI_Power7.pdf NVIDIA CEO at GTC2010 GPGPU increase presence at the Top500 Supercomputers Serial vs. Parallel - demo Execute: C:\FlexPDE5student\samples_student\steady_state\fluids\swirl Low cpu utilization Uses only one core Some highlights of the course – Next slides We will have: 1. Standard “Classical” text PLUS 2. Several “Mini-Courses” – My add-ons 1. Parallel Computing – MPI, OpenMP 2. Batch/Grid Computing – Condor 3. Visualization (next slide) 4. Cluster Computing Let’s have a demo Go to: C:\Users\telzur\Documents\Weizmann\ScientificComputing\SC2011B\ Lectures\01\code\HelloOMP Open the solution file in Visual Studio Execute in 1 and 4 threads, watch the “Task Manager” while running. How to build a parallel computing cluster – hands on demo Course Web Site http://tel-zur.net/teaching/weizmann/sc/2011B/ Course Duties • 3 home assignments • Final Projects – Presentations – Final report • You are encouraged to bring laptops to class! Course’s Load The following is from: Old Dominion University Physics 420/520 Spring 2010 Keys to success Right motivation, working diligently, effectively and efficiently is the key to success. If you work regularly and allocate enough time each day to practice and complete the assignments on time and keep up with the course, you will get the most out of the course both intellectually and grade-wise. You should invest about 4-5 hours per week outside of class to succeed in this course. This is consistent with university guidelines (i.e. two to three hours of outside preparation time for every credit hour). Students with little or no programming experience (or those who love the subject and wish to do extremely well in it) may want to put in more hours. Please, let me know as soon as possible if you have difficulties and may need extra help. You are recommended to start you assignments well before the last night when your assignments are due. It is a general experience that a computer program usually does not work correctly (if works at all) at the beginning. A search for a problem, or a computer bug, may take more time that you expect. Home Assignments • • • • • • • • 3 sets of homework problems will be assigned. The students will write computer programs based on computational algorithms discussed in class. These assignments constitute a very important part of the course, since the thinking involved in scientific programming can only be developed through practical work. The assignments must be returned by their stated due dates, unless an extension is granted by the instructor. For late return of assignments, a 10% point deduction will be applied for each late day. Programs should be written in Fortran 90/95 or in C/C++ or in Python. The programs as well as a short report discussing the results should be handed in to the instructor by the stated due date. The solution programs should be sent as an attachment in an e-mail to the address tel-zur@computer.org. The report (hardcopy required) should be handed to the instructor in class before the deadline. Every student is expected to work independently on the assignments. However, discussions with fellow students are allowed, indeed encouraged, as long as they are kept on a general level and do not amount to direct copying of ideas or programming solutions. Although discussions and some degree of cooperation between students is allowed, The material turned in must be independently written. Inspired from: http://physics.bu.edu/~py502/syllabus.pdf The Final Projects • Each student will present his/her topic in front of the class • A list of suggested topics will be published at the course website, however • You are encouraged to suggest your own topics • Have a look at: http://physics.usc.edu/~shaas/516/projects.html The Final Projects • In the presentations: Describe the project, the computational challenge and the suggested way to the solution (10%) • The final project will consist of: a stand alone document that will summarize the whole project and any other relevant file including the source codes and instructions how to compile and execute the programs The Studnts’ presentations • Format: PPT, PPTX, Open Office, PDF, HTML… • Language: English • Send me the presentations no later than midnight before class day • Send them to: gtelzur@gmail.com The final report • Some of the reports will be uploaded to the course website • Report structure: – Cover page: Your name, title – Abstract, Introduction, the main part which deals with your work, conclusions, references and appendices – It is recommended to include graphs, charts and tables to demonstrate the properties and results of your work • Format: doc(x), TeX, Open Office, PDF • Submission by Email to tel-zur@computer.org More tips about the Final Projects • Consult these links: 1. http://www.odu.edu/~agodunov/teaching/p hys420_10/organize_comp_proj.pdf 2. http://www.odu.edu/~agodunov/teaching/p hys420_10/Sample_Project.pdf 3. http://www.odu.edu/~agodunov/teaching/n otes/Intr02_projects.pdf Programming Languages • C/C++ • Fortran 90/95 • Python • Please: No Java! Visualization Tools • Xmgrace – 2D, Linux only • Python, Python Python! – vPython – included in Python(x,y) – Gnuplot – included in Python(x,y) – Matplotlib, MayaVi2, • Qtiplot – Free for Linux OS (Origin clone) http://soft.proindependent.com/qtiplot.html • CERN’s PAW/Root (if time will permit) • Please no graphics using: MS - Excel LaTeX • Learn LaTex, here are a few links to tutorials: – http://www.cs.cornell.edu/Info/Misc/LaTeXTutorial/LaTeX-Home.html – http://www.pages.drexel.edu/~pyo22/students/la texRelated/latexTutorial.html – Getting Started With LaTex: http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ GSWLaTeX.pdf LaTeX Recommended Environment (install it on your laptops) • MikTeX: http://www.miktex.org/ • LaTeX Editor: Led http://www.latexeditor.org/index.html • Optional: LyX - http://www.lyx.org/ (less recommended) • Online check your LaTeX equations with Texify: http://www.texify.com/links.php Linux Background Check: http://www.physics.udel.edu/~bnikolic/teaching/phys660/RUTE/rute/index.html Recommended Working Environment Other Options • • • • Linux (stand alone / cluster) Dual boot Linux/Windows Windows + Cygwin Windows only + ports of the needed packages, e.g MinGW • Mac Books - I • Computational Science and Engineering by Gilbert Strang • http://math.mit.edu/cse/ • http://www-math.mit.edu/~gs/ • MIT Opencourseware: http://ocw.mit.edu/courses/mathematics/18085-computational-science-and-engineering-ifall-2008/ Books - 2 • Python Scripting for Computational Science, 3rd. Edition by H. P. Langtangen • TOC: http://folk.uio.no/hpl/scripting/Langtangen_TCSE 3_3rd_ed_TOC.pdf • Book web site: http://folk.uio.no/hpl/scripting/ • Teaching slides: http://heim.ifi.uio.no/~hpl/scripting/all-nosplit/ Books - 3 • "Computational Physics" By Professor Morten Hjorth-Jensen from the University of Oslo, Lecture notes in Computational Physics (2009) • http://www.uio.no/studier/emner/matnat/fys /FYS3150/h09/ • An Open Source book! • In my slides I will give references to Morten Hjorth-Jensen by mentioning “MHJ” Books -4 • Introduction to High-Performance Scientific Computing by Victor Hijkhout, 2010 • Free download: http://www.tacc.utexas.edu/˜eijkhout/istc/istc.html Or from Lulu.com: http://www.lulu.com/product/filedownload/introduction-to-high-performancescientific-computing/14605650 • Rev. #311, 6-Feb.-2011 From the back cover: The goal of this book is to teach computational scientists how to develop tailored, flexible, and human-efficient working environments built from small programs (scripts), written in the easy-to-learn, high-level language Python. The focus is on examples and applications of relevance to computational scientists: gluing existing applications and tools, e.g. for automating simulation, data analysis, and visualization; steering simulations and computational experiments; equipping old programs with graphical user interfaces; making computational Web applications; and creating interactive interfaces with a Maple/Matlab-like syntax to numerical applications in C/C or Fortran. In short, scripting with Python makes you much more productive, increases the reliability of your scientific work and lets you have more fun - on Unix, Windows and Macintosh. All the tools and examples in this book are open source codes. Books - 5 Scientific Computing: An Introductory Survey This book presents a broad overview of numerical methods for solving all the major problems in scientific computing, including linear and nonlinear equations, least squares, eigenvalues, optimization, interpolation, integration, ordinary and partial differential equations, fast Fourier transforms, and random number generators. The treatment is comprehensive yet concise, software-oriented yet compatible with a variety of software packages and programming languages. The book features more than 160 examples, 500 review questions, 240 exercises, and 200 computer problems. http://www.cse.illinois.edu/heath/scicomp/notes/index.html Join: http://www.meetup.com/ComputationalScience/ Stay in Contact • My email address: tel-zur@computer.org • Please visit often the course web site! • We can setup a google group, facebook, twitter… Let’s get started!