Viva Group has been honoured with the Best Publisher Award 2022 by the Delhi State Booksellers & Publishers' Association.

Writing Fast Programs with CD

Writing Fast Programs with CD

Writing Fast Programs with CD

A Practical Guide for Scientists and Engineers

  • By: John Riley

₹895.50 ₹995.00 Save: ₹99.50 (10%)

Go to cart

ISBN: 9789386385901

Bind: Paperback

Year: 2017

Pages: 344

Size: 178 x 235 mm

Publisher: Cambridge International Science Publishing

Published in India by: Viva Books

Exclusive Distributors: Viva Books

Sales Territory: India, Nepal, Pakistan, Bangladesh, Sri Lanka


The book provides the basic elements of code optimization and provides strategies for reducing bottlenecks in practical simulation and numerical modeling code. The target audience is scientists and engineers and students in these fields. One pre-publication reviewer called this a much-needed intermediate text to bridge the gap between existing introductory and more advance programming books aimed at scientists. Writing Fast Programs does not teach basic programming; some programming proficiency is assumed, along with familiarity with the basic programming terminology. Code examples are presented in C, but BASIC (as a convenient pseudo-language) examples are provided for those not familiar with C. ln general, the strategies presented are not language specific and should therefore benefit a wide programming audience.

Target Audience:

Students and academicians of Computer Science.





List of Figures

List of Tables

Part I: The Foundations

Chapter 1: Introduction to Code Optimization • Motivation for Writing High Performance Code • Scientist Programmer vs. Computer Programmer • Programming Languages • One Extreme: BASIC for Ease of Use • Another Extreme: C For Speed • Program Development Efficiency • Scripting • Procedural vs Object Oriented Languages • General Thoughts on Optimization • Why Optimize • How Difficult is Optimization? • When and What to Optimize • Overview of Samples Presented in This Book • Additional Reading

Chapter 2: PC Hardware • Basic System Architecture • Numerical Representations • Addressing • Basic CPU Architecture and Introduction to ASSEMBLY Language • Code Execution and Timing • Pipelining, Speculative Execution and Branch Prediction • Optimization at the CPU Level • A Brief Historical Summary of Desktop Computer CPU's • Intel Processors • AMD Processors • Cyrix Processors • Motorola/IBM Processors • Modern Physical Memory Architectures • Basic Memory Architecture • SDRAM and DDR SDRAM Memory • RAMBUS Memory

Chapter 3: Operating System Considerations • The Operating System in Perspective • Operating Systems and Performance • Operating System Architectures • Specific PC Operating Systems • MS Windows • Linux • A Brief Comparison of Windows and Linux Performance • Simple Numerical Procedure • Thread/Process Creation • Context Switching

Chapter 4: Compiler Considerations • Interpreters vs. Compilers • Compiler Optimizations • Aliasing • Array Bounds Checking • Numerical Overflow Checking • Unrounded Floating Point Operations • FDIV Bug Checking • Inline and Intrinsic Functions • Common Sub Expressions • Using Programs Compiled with Old Compilers • C++ and Similar Compilers • MS Visual C++ • MS Visual C# • g++ • Vector C • KAI C++

Part II: Implementation

Chapter 5: Data Management • Implicit Declaration and the Variant Problem • Eliminating Implicit Type Conversions • Type Matching to Function Calls • Loop Counters • Immediates, Constants and Variables • Type Specific Operators • Variable Scope • Data Organization • Scalars, Arrays and Hashes • Pointers • Queues and Stacks • Linked Lists and Trees • Structures/User Defined Types • Objects and Classes • Data Alignment • Naming Variables, Functions, Objects and Classes

Chapter 6: Function and Procedure Calling: Optimizing Program Flow • Mechanism of Function Calling and Inline Code • Programming in the ?Sub-Routine Style? • Calling with Reduced Stack Overhead • Using Library Functions • Hand Coding vs: Using Language Functions - A Pseudo Random Number Generator • Recursive Functions - The Factorial • Function Calling Conventions

Chapter 7: Loops and Vectors • General Vector Concepts and the Potential for Complex Code Structures • Loop Unrolling in a Trade-Off with Generality - Matrix Multiplication • Partial Loop Unrolling - Simpson's Rule Integration • A Practical Example: Time Dependent Heat Flow

Chapter 8: Programming in the RISC Style • The KISS Principle • Practical Example - The Lennard Jones Energy • Practical Example - The Boltzmann Factor • Other Mathematical Tricks

Chapter 9: Look-Up Tables • Memory Access vs. Computation • The LUT in Action - 1 Dimensional Examples • Lennard Jones Energy • Other1 -D Examples • Introduced Error in the LUT Technique • The LDT in Action - 2-Dimensional Look-Ups • Distance • Heterogeneous Lennard Jones Energy • Virtual vs. Physical Memory

Chapter 10: Other Algorithm Optimization Techniques • The Use of Symmetry • Elimination of Nested Loops • Reducing Decision Logic Overhead - Bit Flag Encoding

Part III: Parallel Processing

Chapter 11: Multi-Tasking Basics • Multi-Tasking Terms • Multi-Threaded Programming • Simple Thread Creation and Termination • Communicating between Threads • When to Use Multiple Threads • Multi-Process Programming • Simple Process Creation and Termination • Communicating Between Processes • When to Use Multiple Processes

Chapter 12: Parallel Computation Basics • Parallel Architecture Basics • Multiple Execution Units in the CPU • Symmetric Multi-Processors • Single Instruction, Multiple Data (SIMD) • Multiple Instruction, Multiple Data (MIMD) • Algorithm Considerations • Performante Considerations in Parallel Systems • SIMD • Integer Array Addition with MMX • Floating Point SIMD and Testing for SlMD Capability • Vector Dot Product using SIMD • 4x4 Matrix Multiplication using SIMD • Simpson's Rule Integration using SIMD • A Comparison of 3dNow! to SSE SIMD Performance • Compilers for SIMD and Additional SIMD Extensions • MIMD • Networks of Workstations • Clusters • Distributed Computing • Implementing MIMD • Simple Parallel Computing Without Messages • Simple Master-Slave Parallel Computing • Simple Message Passing Parallel Computing • Message Passing Tools • Parallel Virtual Machine (PVM) • Message Passing Interface (MPI) • Other Tools

Appendix A: A List of Modern Development Tools

Appendix B: How to Buy A High Performance PC

Appendix C: Contents of the Included CD-Rom

Appendix D: Complete Code Listing of MCGas Demo Version

Appendix E: BASIC Listings for the Part I and Part II Demo Programs




About the Author:

John S. Riley began programming in the early 1980's and completed his first chemistry related software project in 1988: a custom microcomputer printer driver to print molecular orbitals on a dot matrix printer.

While earning his Ph.D. at the University of North Carolina Chapel Hill, he began to explore quantum chemistry and Monte Carlo calculations to model experimental ion dissociation dynamics data in addition to writing low level code to collect that data. It was at this time that he began to think about the practical limitations to useful modeling on microcomputers.

In his chemistry career, Riley has conducted ion dynamics and photochemistry research, built and managed a forensic laboratory, taught college level Chemistry and Physics and is currently the owner and manager of DSB Scientific Consulting. In this capacity, he is involved in researching theoretical decomposition mechanism of energetic materials and the numerical modeling of deflagration and detonation phenomena. His company provides computational chemistry and computational engineering services, including the development of highly optimized cross-platform numerical modeling applications.


Programming in R with Applicat..

By: Priyanka P. Shinde, Varsha P. ..

ISBN : 9789395654296

₹ 535.50 ₹ 595.00


Discrete Structures, Logic, an..

By: James L. Hein

ISBN : 9789384323264

₹ 895.50 ₹ 995.00


Analysis of Algorithms, 2/e

By: Jeffery J. McConnell

ISBN : 9789384323189

₹ 805.50 ₹ 895.00


An Introduction to Formal Lang..

By: Peter Linz

ISBN : 9789384323219

₹ 715.50 ₹ 795.00


Foundations of Algorithms, 5/e

By: Richard E Neapolitan

ISBN : 9789384323110

₹ 805.50 ₹ 895.00


Computer Science Illuminated, ..

By: Nell Dale & John Lewis

ISBN : 9789384323097

₹ 1,345.50 ₹ 1,495.00