You are previewing Julia High Performance.
O'Reilly logo
Julia High Performance

Book Description

Design and develop high performing programs with Julia

About This Book

  • Learn to code high reliability and high performance programs

  • Stand out from the crowd by developing code that runs faster than your peers’ codes

  • This book is intended for developers who are interested in high performance technical programming.

  • Who This Book Is For

    This book is for beginner and intermediate Julia programmers who are interested in high performance technical computing. You will have a basic familiarity with Julia syntax, and have written some small programs in the language.

    What You Will Learn

  • Discover the secrets behind Julia’s speed

  • Get a sense of the possibilities and limitations of Julia’s performance

  • Analyze the performance of Julia programs

  • Measure the time and memory taken by Julia programs

  • Create fast machine code using Julia’s type information

  • Define and call functions without compromising Julia’s performance

  • Understand number types in Julia

  • Use Julia arrays to write high performance code

  • Get an overview of Julia’s distributed computing capabilities

  • In Detail

    Julia is a high performance, high-level dynamic language designed to address the requirements of high-level numerical and scientific computing. Julia brings solutions to the complexities faced by developers while developing elegant and high performing code.

    Julia High Performance will take you on a journey to understand the performance characteristics of your Julia programs, and enables you to utilize the promise of near C levels of performance in Julia.

    You will learn to analyze and measure the performance of Julia code, understand how to avoid bottlenecks, and design your program for the highest possible performance. In this book, you will also see how Julia uses type information to achieve its performance goals, and how to use multuple dispatch to help the compiler to emit high performance machine code. Numbers and their arrays are obviously the key structures in scientific computing – you will see how Julia’s design makes them fast. The last chapter will give you a taste of Julia’s distributed computing capabilities.

    Style and approach

    This is a hands-on manual that will give you good explanations about the important concepts related to Julia programming.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Julia High Performance
      1. Table of Contents
      2. Julia High Performance
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Julia is Fast
        1. Julia – fast and dynamic
        2. Designed for speed
          1. JIT and LLVM
          2. Types
        3. How fast can Julia be?
        4. Summary
      9. 2. Analyzing Julia Performance
        1. Timing Julia code
          1. Tic and Toc
          2. The @time macro
          3. The @timev macro
        2. The Julia profiler
          1. Using the profiler
          2. ProfileView
        3. Analyzing memory allocation
          1. Using the memory allocation tracker
        4. Statistically accurate benchmarking
          1. Using Benchmarks.jl
        5. Summary
      10. 3. Types in Julia
        1. The Julia type system
          1. Using types
          2. Multiple dispatch
          3. Abstract types
          4. Julia's type hierarchy
          5. Composite and immutable types
          6. Type parameters
          7. Type inference
        2. Type-stability
          1. Definitions
          2. Fixing type-instability
          3. Performance pitfalls
          4. Identifying type-stability
          5. Loop variables
        3. Kernel methods
        4. Types in storage locations
          1. Arrays
          2. Composite types
          3. Parametric composite types
        5. Summary
      11. 4. Functions and Macros – Structuring Julia Code for High Performance
        1. Using globals
          1. The trouble with globals
          2. Fixing performance issues with globals
        2. Inlining
          1. Default inlining
          2. Controlling inlining
          3. Disabling inlining
        3. Closures and anonymous functions
          1. FastAnonymous
        4. Using macros for performance
          1. The Julia compilation process
          2. Using macros
          3. Evaluating a polynomial
          4. Horner's method
          5. The Horner macro
        5. Generated functions
          1. Using generated functions
          2. Using generated functions for performance
          3. Using named parameters
        6. Summary
      12. 5. Fast Numbers
        1. Numbers in Julia
          1. Integers
          2. Integer overflow
          3. BigInt
          4. The floating point
          5. Unchecked conversions for unsigned integers
        2. Trading performance for accuracy
          1. The fastmath macro
          2. The K-B-N summation
        3. Subnormal numbers
          1. Subnormal numbers to zero
        4. Summary
      13. 6. Fast Arrays
        1. Array internals in Julia
          1. Array representation and storage
          2. Column-wise storage
        2. Bound checking
          1. Removing the cost of bound checking
          2. Configuring bound checks at startup
        3. Allocations and in-place operations
          1. Preallocating function output
          2. Mutating versions
        4. Array views
        5. SIMD parallelization
        6. Yeppp!
        7. Writing generic library functions with arrays
        8. Summary
      14. 7. Beyond the Single Processor
        1. Parallelism in Julia
          1. Starting a cluster
          2. Communication between Julia processes
        2. Programming parallel tasks
          1. @everywhere
          2. @spawn
          3. Parallel for
          4. Parallel map
          5. Distributed arrays
        3. Shared arrays
          1. Threading
        4. Summary
      15. Index