FREE ELECTRONIC LIBRARY - Abstract, dissertation, book

Pages:   || 2 | 3 | 4 |

«Steering Languages and Future Science Codes L. E. Busby October 3, 2014 Disclaimer This document was prepared as an account of work sponsored by an ...»

-- [ Page 1 ] --


Steering Languages and Future

Science Codes

L. E. Busby

October 3, 2014


This document was prepared as an account of work sponsored by an agency of the United States

government. Neither the United States government nor Lawrence Livermore National Security, LLC,

nor any of their employees makes any warranty, expressed or implied, or assumes any legal liability or

responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States government or Lawrence Livermore National Security, LLC. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States government or Lawrence Livermore National Security, LLC, and shall not be used for advertising or product endorsement purposes.

This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344.

Steering Languages and Future Science Codes Lee Busby, LLNL busby1@llnl.gov September 15, 2014 Rev. 11 Contents

1. Summary Recommendations........................................... 1

2. Structure of the Paper................................................. 1

3. What is a Steering Language? Why Use One?............................. 2

3.1. Background.................................................... 2

3.2. Your Point of View............................................... 2

4. Recommendation: Build a Pilot Code Using Lua........................... 4

4.1. Comparison of Source Code Size.................................... 5

4.2. Speed and Memory Benchmarks.................................... 5 Expression Parsers............................................ 5 Scimark Benchmarks.......................................... 6 Crosscheck.................................................. 9

5. Recommendation: Use Python More, not Less............................. 9

6. Recommendation: Consider Some

–  –  –

1. Summary Recommendations

• Build a pilot code using Lua as the steering language.1 Standard Lua was 3.5× smaller and 10× faster than Standard Python across five Scimark benchmarks. It may be more suitable for static linking and as an embedded steering language. It is mature, well-documented, and widely used in many areas, with a recent uptick in scientific users and codes. These points and others will be more fully developed in the sections that follow.

• Use Python more, not less. Python is a very good choice as a steering language. Moreover, it has become an excellent choice as a primary programming language for many application areas and uses. There are a wide variety of tools and techniques now that effectively allow the scientist/programmer to write (just) Python, then selectively choose how and how much to optimize their code as needed for speed. Consider purchasing support for a comprehensive Python user environment such as Anaconda [CON1] for a period of time.

• Consider some lessons from three components of the Basis project, and try to carry

some of their good ideas into future work:

A) The Basis run-time database (RDB), which is shared with and fully accessible from compiled code, using an ISO C API;

B) A data description language (DDL) that developers use to define and initialize the RDB;

C) A domain specific language (DSL) for use in building the user interface for each project.

The first two bullets taken together are not intended to suggest an either/or future. Python and Lua can work together well if and when that becomes desireable. However, the interfaces between codes will continue to be important. Interfaces that emphasize native types will usually be a good choice if language interoperability is important.

2. Structure of the Paper The rest of the paper is in five main parts. Some general background information and terminology is given in the next section. This will hopefully make it easier to follow the discussion in the remainder. Each of the three recommendations above will be discussed 1Disclaimer: The author is participating in an ongoing evaluation of Lua as a steering language for the Blast [KOL1] code.

–  –  –

separately, with a final section for concluding remarks and acknowledgements. Three appendices contain information to extend or complete earlier material.

3. What is a Steering Language? Why Use One?

3.1. Background In 1984, Paul Dubois [DUB1] introduced Basis and the idea of steering languages to LLNL. His work preceded Perl (1987), Tcl (1988), and Python (1989) by some years.

MATLAB [MOL1] the company was also founded in 1984. Basis had some similarities with MATLAB, but it went much further in defining ways to connect an interactive command interpreter to compiled code packages. John Ousterhout’s 1990 paper [OUS1] introduced the idea of a language-in-a-library (Tcl), embeddable in other tools, to many people outside our scientific community. He went on in 1998 [OUS2] to divide (most) programming languages into two main categories: Weakly typed scripting languages like Tcl, used on their own for rapid development, or to ‘‘glue’’ together components written in strongly typed system languages like C. He suggested that ‘‘Scripting and system programming are symbiotic’’, and, to paraphrase, that scripting languages allowed many more, and more casual programmers, to make effective use of computing power.

Python hardly needs further introduction now. Lua [LUA1], [IER1] is less well-known. It began in 1993 as a configuration language, mostly for industrial clients of Tecgraf, the Computer Graphics Technology Group of PUC-Rio in Brazil. It slowly evolved into a complete language over the next 7-10 years. In a 2011 paper, Ierusalimschy et al. [IER2] distinguish two ways that a scripting language can be integrated with code written in a system language: In the first form − extending − the main program is written in the scripting language, which is extended using libraries and functions written in the system language. In the second form − embedding − the main program is written in the system language, now called the host program, which can run scripts and call functions defined in the scripting language. Although this terminology is not precise, (most real codes have some of both types of integration), I will use their definitions for those terms in the rest of the paper. Also, the term steering language implies a context where two languages are being used together, one to ‘‘steer’’ the other, whereas scripting language may be just the one. It’s often fine to write complete programs using (only) Python, Lua, or Basis. I will use those terms synonymously, unless the context requires otherwise.

3.2. Your Point of View

Ok, let’s test your knowledge so far with a short quiz. The proper form for a next generation physics code is:

A) An ensemble of mostly independent compiled packages, glued together with and extending a central steering language that ‘‘knows all, sees all’’;

B) A coherent compiled core, composed of packages designed to know about one another and work together well, along with an embedded scripting language used for problem setup and such other tasks as found to be necessary;

C) Sometimes one, sometimes the other − I just do not know.

–  –  –

That is hardly significant in any statistical sense, of course, and if my sample failed to account for your opinions, I am sorry. However, our differences, such as they may be, are not just confined to LLNL. Game developer Tim Sweeney [SWE1] identified four reasons why mixing a scripting language into compiled code might create problems, which are

paraphrased here:

• [As a system grows] there is increasing pressure to expose more of its native C++ features to the scripting environment. [The system] eventually grows into a desert of complexity and duplication.

• There is a seemingly exponential increase in the cost and complexity [of the] “interop” layer where C++ and script code communicate. [Interop] becomes very tricky for advanced data types such as containers

• Developers seeking to take advantage of [...] native C++ features end up dividing their code unnaturally between the script world and the C++ world

• Developers need to look at program behavior holistically, but quickly find that script debugging tools and C++ debugging tools are separate and incompatible.

Sweeney and his team felt strongly enough about these issues to rip the existing (proprietary) scripting language back out of their popular C++ game engine, after putting it in and living with it for some years. Although I feel that scripting languages do bring net benefit to our physics codes, I acknowledge Sweeney’s points, and allow that I have encountered them in the past. The questionnaire also asked you to rate the relative importance of several ‘‘use cases’’ for a steering language. Here are the average scores from 25 replies. (In this case, AX− and B−division responses were lumped together.) Use Case Mean Score(L=1,M=2,H=3) Set up job input, check syntax 2.70 Postprocess output 2.61 Make custom output files 2.50 Steer code during run 2.44 Play around, learn code 1.78 Handle unusual input, etc. 1.86 Table 2 − Some Steering Language Use Cases Apparently we’re a little uncomfortable with the idea of playing around at work, even to learn how to use a new code. There isn’t a lot more to say about those specific results, but

–  –  –

defining a reasonable set of use cases is certainly part of a successful steering language project. One additional table (3) shows how the responders self-identified as a ‘‘designer’’ or as a ‘‘developer’’.

–  –  –

Finally, in B-division, the breakdown by years in field (10:10−20:20) was 1:3:2; AX was 6:4:9.

4. Recommendation: Build a Pilot Code Using Lua The primary purpose of this section is to draw out the differences between Python and Lua, in order to justify the recommendation. That said, the languages have quite a bit in common. Their syntax is generally procedural. Assignments, function definitions and function invocations are easy to recognize in either language. Python uses indentation to indicate block structure. Lua is more traditional in its use of keywords to indicate block structure. White space in Lua is freeform. Lua is simple, but it has some sophisticated features such as first-class functions, closures, coroutines, iterators, and more. (None of which a casual user needs to understand.) Syntactically, it seems fair to say that neither language requires much effort to learn and use. Unlike Python, Lua has no pre-defined class statement, but it does have mechanisms that allow object-oriented interfaces to be constructed, if desired. At the level of linking to C code, the Lua API contained about 113 functions in 2007, whereas the Python API had about 656 public functions. [MUH1] (Neither has changed greatly in the last seven years.) A short example below illustrates basic syntax. More example code is available in the Scimark benchmarks run as part of this study. [LEB1]

Python: Lua:

def factorial(n): function factorial(n) if n == 0: if n == 0 then return 1 return 1 else: else return n*factorial(n-1) return n*factorial(n-1) end end There are at least two major implementations of the Lua library and language. The first is ‘‘Standard Lua’’, the original version from Brazil. The second is Luajit, [LUJ1] which is a just-in-time compiler for Lua. To a first approximation, the two versions are compatible, and compatible at the application binary interface (ABI) level: A code can link to either library without recompiling or any special effort. Luajit is probably responsible for much of the recent surge in interest among scientific users of Lua. Besides being much faster in general, Luajit has an excellent foreign function interface that can simplify much of the

–  –  –

effort in linking to C libraries. For us at LLNL, however, it’s important to note that Luajit is not presently available for the PPC64 architecture (Sequoia). Standard Lua is famous for its portability, and is available for all our platforms.

–  –  –

We need to be careful in touting how small something is, of course. Small size is false economy if you give up required functionality. Python + Numpy + Scipy is an indispensable tool for many scientists. Together, they sum to more than 1½ million lines of code. Is that required for basic code steering? In my opinion, Standard Lua (13 KLOC) or Luajit (69 KLOC) are capable of handling the basic steering task, and enough smaller as to make a qualitative difference in planning for their support and maintenance within a development team.

4.2. Speed and Memory Benchmarks We can argue about functionality, but lines of code is fairly objective and easy to measure. Demonstrating differences in memory size and execution speed takes more work. To that end, I ran two separate sets of benchmarks that included the languages of interest.

Pages:   || 2 | 3 | 4 |

Similar works:

«punitive damages in securities arbitration after ‘mastrobuono’ by: Harry S. Miller In a landmark victory for investors and a major setback for stock brokerage firms, the U.S. Supreme Court recently ruled that arbitrators may award punitive damages in securities arbitration. Mastrobuono, et. 01. u. Shearson Lehman Hulton, Inc., et. al., 1995 WL 86555. Previously, this had been an area of controversy in light of 1st Circuit authority in Massachusetts which supported the power of arbitrators...»

«White Middle Class Identities And Urban Schooling Through performing your job in your thing and my Visits by your small sales, you might be spending goals of you can be to download in. More immediately, senior research surprises any loan in borrower, company plus name. It'd believe their sufficient confidence, you will allow outstanding to be more epub if your months, work facilities, because your online jet that can earn investing you decisions and markets through success for repeat to pdf....»

«Should the Norwegian Model of Direct State Participation in Petroleum Activities be used in Resource Rich Developing Countries as part of the Solution to the ‘Resource Curse’? University of Oslo Faculty of Law Candidate number: 8010 Submission deadline: 1st December 2012 Supervisor: Ivar Alvik Word count: 17,993 06.09.2012 Table of Contents CHAPTER 1 INTRODUCTION 1 1.1 Structure of the text 2 1.2 Legal sources 3 CHAPTER 2 BACKGROUND 4 2.1 The problem of the resource curse 4 2.2 Permanent...»

«THIS DISPOSITION IS NOT CITABLE AS PRECEDENT OF THE TTAB Mailed: June 30, 2004 csl UNITED STATES PATENT AND TRADEMARK OFFICE Trademark Trial and Appeal Board In re Precision Cuts, Inc. Serial No. 76342048 Lisa M. Caldwell of Klarquist Sparkman, LLP for Precision Cuts, Inc. Steven Foster, Trademark Examining Attorney, Law Office 106 (Mary Sparrow, Managing Attorney). _ Before Simms, Hanak and Chapman, Administrative Trademark Judges. Opinion by Simms, Administrative Trademark Judge:...»

«GENERAL REPORT Presented by KENNETH MYNETT, Q.C.INTRODUCTION English lawyers brought up in the traditions and usages of English law find considerable difficulty in dealing with the laws of other countries so very different in theory and content from their own. This must serve as an apology for the many shortcomings in this general Rapport. I would like to pay tribute to the clarity and detail in the papers written on this wide subject by the National Rapporteurs. I feel that rather than attempt...»

«Do You Know Juliette Low? MORE Games, Songs, Skits, Crafts and Learning Activities About Our Girl Scout Founder! Volunteer Learning & Development Daisy Low Story-Game for Girl Scout Daisies Leader: “Listen closely while I tell you the story of Juliette Gordon Law, who started the American Girl Scouts. Every time I say Mrs. Low‘s nickname, ‗Daisy,‘ YOU have to say ‗We‘re Daisies too!‘ Let‘s practice.‖ (Say “Daisy” and let girls reply.) [STORY] ―Once there was a girl named...»

«Adobe CC Help Legal notices Legal notices For legal notices, see http://help.adobe.com/en_US/legalnotices/index.html. Last updated 2/11/2016 iii Contents Chapter 1: What's New New features summary for Adobe Animate CC 2015.1...................................................................1 Chapter 2: Platforms Convert to other document formats.............................................»

«Comments on OKUDA, Statelessness and the Nationality Act of Japan: Baby Andrew Becomes a Teenager and other Changes? Stacey Steele * I. Introduction II. Commenting on Okuda’s Article 1. Okuda’s Article in Summary 2. The Universal Applicability of the United Nations Convention on the Rights of the Child?3. Nationality Law as International Family Law III. The Baby Andrew Case 1. “When Both Parents are Unknown” and the Burden of Proof 2. Controlling Social Change and the Ministry of...»

«Journal of Air Law and Commerce Presents the 49th Annual SMU Air Law Symposium March 26 27, 2015 WEDNESDAY, MARCH 25, 2015 6:00 p.m. – Early Check-in & Late Registration 9:00 p.m. Welcome Reception 6:00 p.m. THURSDAY, MARCH 26, 2015 Check-In and Late Registration 7:45 a.m.– 5:00 p.m Continental Breakfast 7:45 a.m. Morning Session Charles A. Tarpley, Presiding Welcoming Remarks 8:30 a.m. Jonathan S. Ziss 8:45 a.m. Goldberg Segalla LLP – Recent Developments in Aviation Law Bradley Preamble...»

«4 Contents Contents Preface Introduction Part 1 Habermas’s Understanding of Law Chapter 1 Law in the Theory of Communicative Action 1. The outline of the theory 2. The thrusts of juridification under scrutiny Chapter 2 Law in Between Facts and Norms 1. Law and the lifeworld 2. Reconstructive social theory 3. Discourse ethic 4. The system of rights Chapter 3 Law in the Postnational Constellation 1. The postnational constellation under scrutiny 2. Three areas of transnational law 3. Summary...»

«CCSU ELIHU Spring 2014 Volume 18, number 2 Elihu burritt library Newsletter From the Desk of the Table of Contents Library Director: Elihu Burritt Library Changes Lives In This Issue: On Wednesday, April 16th, the Elihu Burritt Library was part of the Libraries From the Desk of the Library Change Lives exhibit that took place in Director 1 the concourse of the Legislative Office Building in Hartford, Connecticut. LiNew Library Logo 1 brarians Renata Vickrey, Sarah Lawson Writing Hollywood Event...»

«VOTING OF PARTIALLY INSTRUCTED SHARES BY BROKERS I. INTRODUCTION Most shareholders in public companies own shares in nominee or “street name” accounts. 1 In these circumstances, banks and brokers (or a depository) hold record title and retain voting rights under state law. 2 Under the rules of the stock exchange, however, brokers must request voting instructions from beneficial owners. 3 Not all owners return voting instruction forms (VIF). In those circumstances, brokers have the legal...»

<<  HOME   |    CONTACTS
2016 www.abstract.xlibx.info - Free e-library - Abstract, dissertation, book

Materials of this site are available for review, all rights belong to their respective owners.
If you do not agree with the fact that your material is placed on this site, please, email us, we will within 1-2 business days delete him.