Chapter 2. Getting Started with Ray Core
For a book on distributed Python, it’s not without a certain irony that Python on its own
is largely ineffective for distributed computing.
Its interpreter is effectively single threaded.
For instance, this makes it difficult to leverage multiple CPUs on the same machine,
let alone a whole cluster of machines, using plain Python.
That means you need extra tooling, and luckily the Python ecosystem has some options for you.
Libraries like multiprocessing
can help you distribute work on a single machine,1 but not beyond.
Seen as a Python library, the Ray Core API is powerful enough to make general distributed programming more accessible to the Python community as a whole. By way of analogy, some companies get by with deploying pretrained ML models for their use cases, but that strategy is not always effective. It’s often inevitable to need to train custom models to be successful. In the same way, your distributed workloads might just fit into the (potentially limiting) programming model of existing frameworks, but Ray Core can unlock the full spectrum of building distributed applications, due to its generality.2 As it is so fundamental, we dedicate this whole chapter to the basics of Ray Core and spend all of Chapter 3 on building an interesting application with the Core API. This way you’re equipped with practical knowledge about Ray Core and can use it in later chapters and your own projects.
In this chapter you’ll understand how Ray Core ...
Get Learning Ray now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.