Siena Computational Crystallography School 2005

Slides:



Advertisements
Similar presentations
Chapt.2 Machine Architecture Impact of languages –Support – faster, more secure Primitive Operations –e.g. nested subroutine calls »Subroutines implemented.
Advertisements

Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Programming Languages WHY MORE? Wasn’t ONE ENOUGH? Introduction to CS260.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
Chapter 3.2 C++, Java, and Scripting Languages “The major programming languages used in game development.”
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
1 Programming Languages b Each type of CPU has its own specific machine language b But, writing programs in machine languages is cumbersome (too detailed)
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Development of Computer - Story of Steve. What is a computer A high intelligence machine A tool – make our life much convenient A very loyal servant Pretty.
Compilers and Interpreters. Translation to machine language Every high level language needs to be translated to machine code There are different ways.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Chapter 10 Application Development. Chapter Goals Describe the application development process and the role of methodologies, models and tools Compare.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
CSE305 Programming Languages Notes are based primarily on Sebesta text. Quotes are from Sebesta text (7 th edition), unless otherwise noted. Sources other.
Programming Concepts and Languages Chapter 12 – Computers: Understanding Technology, 3 rd edition 1November
COP4020 Programming Languages
Source Code Basics. Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code”
1 CS101 Introduction to Computing Lecture 19 Programming Languages.
Computers: Software Patrice Koehl Computer Science UC Davis.
© Paradigm Publishing Inc Chapter 12 Programming Concepts and Languages.
Programming Languages Lecture 12. What is Programming?  The process of telling the computer what to do  Also known as coding.
Name: Md. Iqbal Hossain Roll : Computer programming  Programming is a lot of fun and extraordinarily useful. While you learn to program,
Programming Languages: Telling the Computers What to Do Chapter 16.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Language Systems Chapter FourModern Programming Languages 1.
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
CS 355 – Programming Languages
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
CS101 Introduction to Computing Lecture Programming Languages.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
An overview of scripting languages Alexander Kanavin Teachers: Barbara Miraftabi, Jan Voracek.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.
Discovering Computers 2009 Chapter 13 Programming Languages and Program Development.
Modern approaches to programming Ralf W. Grosse-Kunstleve Computational Crystallography Initiative Lawrence Berkeley National Laboratory Siena Computational.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Lecture.1: Getting Started With Java Jiang (Jen) ZHENG May 9 th, 2005.
1CPSD Software Infrastructure for Application Development Laxmikant Kale David Padua Computer Science Department.
ITC Research Computing Support Using Matlab Effectively By: Ed Hall Research Computing Support Center Phone: Φ Fax:
LANGUAGE SYSTEMS Chapter Four Modern Programming Languages 1.
Programming language. Definition Programming language is a formal language designed to communicate instructions to a computer. Programming languages can.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
The course. Description Computer systems programming using the C language – And possibly a little C++ Translation of C into assembly language Introduction.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
Introduction to OOP CPS235: Introduction.
Software Development Introduction
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Programming Language Basics. What is a Programming Language? “A computer, human-created language used to write instructions for a computer.” “An artificial.
Applications Active Web Documents Active Web Documents.
CMIT100 Chapter 14 - Programming.
Before You Begin Nahla Abuel-ola /WIT.
1.1 Reasons to study concepts of PLs
Programming Concepts and Languages
High Level Programming Languages
Programming Language Basics
Reasons To Study Programming Languages
Presentation transcript:

Siena Computational Crystallography School 2005 Spectrum of languages Ralf W. Grosse-Kunstleve Computational Crystallography Initiative Lawrence Berkeley National Laboratory

Spectrum of implementation languages Python Interpreted, Object Oriented, Exception handling C++ Compiled, Object Oriented, Exception handling C Compiled, User defined data types, Dynamic memory management Fortran Compiled, Some high-level data types (N-dim arrays, complex numbers) Assembler Computer program is needed to translate to machine code Machine code Directly executed by the CPU

Matrix of language properties Dynamically typed -> convenience Statically -> speed Interpreted Python Java Compiled to machine code Psyco C++

Programmer Efficiency & Performance Python C++ C Fortran Assembler Machine code Maintainability Reusability Modularity

Choice of implementation languages Python Very high-level programming Easy to use (dynamic typing) Fast development cycle (no compilation required) Too slow for certain tasks C++ High-level or medium-level programming Many arcane details (strong static typing) Largely automatic dynamic memory management (templates) Much faster than Python With enough attention, performance even rivals that of FORTRAN

Happy marriage: Python and C++ Syntactic differences put aside, Python and C++ objects and functions are very similar. Flexibility (interpreted, dynamically typed) and Efficiency (compiled, statically typed) are complementary. Boost.Python (C++ library) provides the link: Non-intrusive on the C++ design Pseudo-automatic wrapping using C++ template techniques No external tools needed Creates sub-classable Python types Python bindings are very maintainable Tutorial and reference documentation class_<unit_cell>("unit_cell") .def("volume", &unit_cell::volume) .def("fractionalize", &unit_cell::fractionalize) ;

Vector operations Computer Science wisdom: Typically 90% of the time is spent in 10% of the code Similar to idea behind vector computers: Python = Scalar Unit C++ = Vector Unit Loading the vector unit: (8.7 seconds) miller_indices = flex.miller_index() for h in xrange(100): for k in xrange(100): for l in xrange(100): miller_indices.append((h,k,l)) Go! (0.65 seconds) space_group = sgtbx.space_group_info("P 41 21 2").group() epsilons = space_group.epsilon(miller_indices) Computing 1 million epsilons takes only 0.65 seconds!

Compiled vs. Interpreted Compiler generates fast machine code Interpreter (Python, Perl, TCL/TK, Java) may generate byte-code but not machine code

Compiled vs. Interpreted Compiler generates fast machine code needs arcane compilation commands needs arcane link commands generates object files (where?) may generate a template repository (where?) generates libraries (where?) generates executables (where?) needs a build tool (make, SCons) all this is platform dependent Interpreter (Python, Perl, TCL/TK, Java) may generate byte-code but not machine code

Conclusion languages It is important to know the modern concepts Especially for ambitious projects Syntax is secondary Anything that does the job is acceptable Python, C++, csh, sh, bat, Perl, Java There is no one size fits all solution But Python & C++ covers the entire spectrum Carefully weigh programmer efficiency vs. runtime efficiency Prefer a scripting language unless runtime efficiency is essential

Acknowledgements Organizers of this meeting Paul Adams Pavel Afonine Peter Zwart Nick Sauter Nigel Moriarty Erik McKee Kevin Cowtan David Abrahams Open source community http://www.phenix-online.org/ http://cctbx.sourceforge.net/