Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Julia High Performance

You're reading from   Julia High Performance Optimizations, distributed computing, multithreading, and GPU programming with Julia 1.0 and beyond

Arrow left icon
Product type Paperback
Published in Jun 2019
Publisher Packt
ISBN-13 9781788298117
Length 218 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Avik Sengupta Avik Sengupta
Author Profile Icon Avik Sengupta
Avik Sengupta
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Julia is Fast FREE CHAPTER 2. Analyzing Performance 3. Types, Type Inference, and Stability 4. Making Fast Function Calls 5. Fast Numbers 6. Using Arrays 7. Accelerating Code with the GPU 8. Concurrent Programming with Tasks 9. Threads 10. Distributed Computing with Julia 11. Licences
12. Other Books You May Enjoy

Threaded libraries

In this chapter, we have shown you how to write multithreaded code to make full use of modern computers with multiple CPU cores. However, sometimes you do not have to make any effort to use multiple threads in your program. Many libraries bundled with Julia create their own threads. Most important among these is OpenBLAS, the library used in Julia for matrix operations. OpenBLAS is very efficient at using threads, and hence, if your algorithm is mainly performing matrix multiplication or factorization, you will get multi-core performance automatically.

You can verify the fact that running the following code exercises all your cores by watching performance counters on your machine:

julia> a = rand(1000, 1000);

julia> b = rand(1000, 1000);

julia> @btime $a*$b;
34.593 ms (2 allocations: 7.63 MiB)

On macOS or Linux, the htop command shows us CPU usage, which...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime