Book Image

Julia 1.0 High Performance - Second Edition

By : Avik Sengupta
Book Image

Julia 1.0 High Performance - Second Edition

By: Avik Sengupta

Overview of this book

Julia is a high-level, high-performance dynamic programming language for numerical computing. If you want to understand how to avoid bottlenecks and design your programs for the highest possible performance, then this book is for you. The book starts with how Julia uses type information to achieve its performance goals, and how to use multiple dispatches to help the compiler emit high-performance machine code. After that, you will learn how to analyze Julia programs and identify issues with time and memory consumption. We teach you how to use Julia's typing facilities accurately to write high-performance code and describe how the Julia compiler uses type information to create fast machine code. Moving ahead, you'll master design constraints and learn how to use the power of the GPU in your Julia code and compile Julia code directly to the GPU. Then, you'll learn how tasks and asynchronous IO help you create responsive programs and how to use shared memory multithreading in Julia. Toward the end, you will get a flavor of Julia's distributed computing capabilities and how to run Julia programs on a large distributed cluster. By the end of this book, you will have the ability to build large-scale, high-performance Julia applications, design systems with a focus on speed, and improve the performance of existing programs.
Table of Contents (19 chapters)
Title Page
Dedication
Foreword
Licences

High-performance I/O

All I/O in Julia is built on top of libuv, an abstraction library originally built for use with Node.js. As we said earlier, this allows Julia to use a high-quality, OS-independent library for all I/O. Reading and writing to and from disks, networks, and terminals are all handled within it.

As a library built for Node.js, it is not a surprise that the libuv API is built around asynchronous I/O. However, Julia's task system makes it much easier to use from Julia. You do not have to write callback functions to handle return values from I/O calls. The code you write appears to be synchronous, straight-line code. Under the hood, the calls are made in a non-blocking manner. Not only is the current task yielded to allow other Julia code to run; all I/O is multiplexed onto a separate operating system thread, thereby allowing multiple I/O tasks to operate...