Submitted Successfully!
To reward your contribution, here is a gift for you: A free trial for our video production service.
Thank you for your contribution! You can also upload a video entry or images related to this topic.
Version Summary Created by Modification Content Size Created at Operation
1 handwiki -- 2073 2022-10-20 01:48:49

Video Upload Options

We provide professional Video Production Services to translate complex research into visually appealing presentations. Would you like to try it?

Confirm

Are you sure to Delete?
Cite
If you have any further questions, please contact Encyclopedia Editorial Office.
HandWiki. Dask. Encyclopedia. Available online: https://encyclopedia.pub/entry/30459 (accessed on 16 November 2024).
HandWiki. Dask. Encyclopedia. Available at: https://encyclopedia.pub/entry/30459. Accessed November 16, 2024.
HandWiki. "Dask" Encyclopedia, https://encyclopedia.pub/entry/30459 (accessed November 16, 2024).
HandWiki. (2022, October 20). Dask. In Encyclopedia. https://encyclopedia.pub/entry/30459
HandWiki. "Dask." Encyclopedia. Web. 20 October, 2022.
Dask
Edit

Dask is a flexible open-source Python library for parallel computing. Dask scales Python code from multi-core local machines to large distributed clusters in the cloud. Dask provides a familiar user interface by mirroring the APIs of other libraries in the PyData ecosystem including: Pandas, Scikit-learn and NumPy. It also exposes low-level APIs that help programmers run custom algorithms in parallel. Dask was created by Matthew Rocklin in December 2014 and has over 9.8k stars and 500 contributors on GitHub. Dask is used by retail, financial, governmental organizations, as well as life science and geophysical institutes. Walmart, Wayfair, JDA, GrubHub, General Motors, NVIDIA, Harvard Medical School, Capital One and NASA are among the organizations that use Dask.

multi-core python life science

1. Overview

Dask has two parts:[1]

  • Big data collections (high level and low level)
  • Dynamic task scheduling

Dask's high-level parallel collections – DataFrames,[2] Bags,[3] and Arrays[4]– operate in parallel on datasets that may not fit into memory.

Dask’s task scheduler[5] executes task graphs in parallel. It can scale to thousand-node clusters. This powers the high-level collections as well as custom, user-defined workloads using low-level collections.

2. Dask Collections

Dask supports several user interfaces[6] called high-level and low-level collections:

2.1. High-Level

  • Dask Array: Parallel NumPy arrays
  • Dask Bag: Parallel Python lists
  • Dask DataFrame: Parallel Pandas DataFrames
  • Machine Learning:[7] Parallel Scikit-learn
  • Others from external projects, like Xarray[8]

2.2. Low-Level

  • Delayed:[9] Parallel function evaluation
  • Futures:[10] Real-time parallel function evaluation

Under the hood, each of these user interfaces adopts the same parallel computing machinery.

3. High-Level Collections

Dask's high-level collections are the natural entry point for users who are interested in scaling up their pandas, NumPy or Scikit-learn work load. Dask’s DataFrame, Array and Dask-ML are alternatives to Pandas DataFrame, Numpy Array and Scikit-learn respectively with slight variations to the original interfaces.

3.1. Dask Array

Dask Array[4] is a high-level collection that parallelizes array-based workloads and maintains the familiar NumPy API, such as slicing, arithmetic, reductions, mathematics, etc., making it easy for Numpy users to scale up array operations.

A Dask array comprises many smaller n-dimensional Numpy arrays and uses a blocked algorithm to enable computation on larger-than-memory arrays. During an operation, Dask translates the array operation into a task graph, breaks up large Numpy arrays into multiple smaller chunks, and executes the work on each chunk in parallel. Results from each chunk are combined to produce the final output.

3.2. Dask DataFrame

Dask DataFrame[2] is a high-level collection that parallelizes DataFrame based workloads. A Dask DataFrame comprises many smaller Pandas DataFrames partitioned along the index. It maintains the familiar Pandas API, making it easy for Pandas users to scale up DataFrame workloads. During a DataFrame operation, Dask creates a task graph and triggers operations on the constituent DataFrames in a manner that reduces memory footprint and increases parallelism through sharing and deleting of intermediate results.

3.3. Dask Bag

Dask Bag[3] is an unordered collection of repeated objects, a hybrid between a set and a list. Dask Bag is used to parallelize computation of semi-structured or unstructured data, such as JSON records, text data, log files or user-defined Python objects using operations such as filter, fold, map and groupby. Dask Bags can be created from an existing Python iterable or can load data directly from text files and binary files in the Avro format.

4. Low-Level Collections

The Dask low-level interface allows for more customization. It is suitable for data that does not fall within the scope of a Dask DataFrame, Bag or Array. Dask has the following low-level collections:

  • Delayed: Parallel function evaluation
  • Futures: Real-time parallel function evaluation

4.1. Delayed

Dask delayed[9] is an interface used to parallelize generic Python code that does not fit into high level collections like Dask Array or Dask DataFrame. Python functions decorated with Dask delayed adopt lazy evaluation strategy by deferring execution and generating a task graph with the function and its arguments. The Python function will only execute when .compute is invoked. Dask delayed can be used as a function dask.delayed or as a decorator @dask.delayed.

4.2. Futures

Dask Futures,[10] an immediate (non-lazy) alternative to Dask delayed, provides a real-time task framework that extends Python’s concurrent.futures interface, which provides a high-level interface for asynchronous execution of callables. It is common to combine high and low-level interfaces. For example, users can run Dask array/bag/dataframe to load and pre-process data, then switch to Dask delayed for a custom algorithm that is specific to their domain, then switch back to Dask array/dataframe to clean up and store results.

5. Scheduling

Dask’s high and low-level collections create a directed acyclic graph of tasks,[11] which represents the relationship between computation tasks. A node in a task graph represents a Python function that performs a unit of computation and an edge represents the data dependency between the upstream and downstream task. After a task graph is generated, the task scheduler manages the workflow based on the given task graph by assigning tasks to workers in a manner that improves parallelism and respects the data dependencies.

Dask provides two families of schedulers: single-machine scheduler and distributed scheduler.

5.1. Single-Machine Scheduler

A single-machine scheduler is the default scheduler which provides basic features on local processes or thread pool and is meant to be used on a single machine. It is simple and cheap to use but does not scale.

Local threads
A threaded scheduler leverages Python’s concurrent.futures.ThreadPoolExecuter to execute computations. It has a low memory footprint and does not require any setup. As all the computations occur in the same process, threaded schedulers incur minimal task overhead and no cost from transfer of data between tasks. Due to Python’s Global Interpreter Lock, local threads provide parallelism only when the computation is primarily non-Python code, which is the case for Pandas DataFrame, Numpy arrays or other Python/C/C++ based projects.
Local process
A multiprocessing scheduler leverages Python’s concurrent.futures.ProcessPoolExecutor to execute computations. Tasks and its dependencies are transferred from the main process to a local process, executed, and the results are transferred back to the main process. This allows bypassing of issues with Python’s Global Interpretable Lock and provides parallelism for computation tasks with primarily Python code. However, transferring data between the main and local processes degrades performance, especially in cases when the size of data transferred is large.
Single thread
A single threaded scheduler executes computation with no parallelism. It is used for debugging purposes.

5.2. Distributed Scheduler

Dask’s distributed scheduler[12] can be set up on a local machine or scale out on a cluster. Dask can work with a number of different resource managers, such as Hadoop YARN, Kubernetes, or PBS, Slurm, SGD and LSF for High Performance Computing (HPC) clusters.

6. Dask-ML

Dask-ML is compatible with Scikit-learn’s estimator API of fit, transform and predict and is well integrated with other popular machine learning and deep learning frameworks such XGBoost, LightGBM, PyTorch, Keras and TensorFlow through Scikit-learn compatible wrappers.

7. Integrations

7.1. Scikit-Learn Integration

Selected Scikit-learn estimators and utilities can be parallelized [13] through executing jobs across multiple CPU cores using the Joblib library. The number processes are determined by the n_jobs parameters. By default, the Joblib library uses loky as its multi-processing backend. Dask offers an alternative Joblib backend which is useful for scaling of Joblib-backed Scikit-learn algorithms out to a cluster of machines for compute constrained workloads.

For memory constrained workloads, Dask offers alternatives, such as Parallel Meta-estimators[14] for parallelizing and scaling out tasks that are not parallelized within Scikit-learn and Incremental Hyperparameter Optimization[15] for scaling hyperparameter search and parallelized estimators.[16]

7.2. XGBoost & LightGBM Integrations

XGBoost [17] and LightGBM [18] are popular algorithms that are based on Gradient Boosting and both are integrated with Dask for distributed learning. Dask does not power XGBoost or LightGBM, rather it facilitates setting up of the cluster, scheduler, and workers required and hands off the data to the machine learning framework to perform distributed training.

To train an XGBoost model with Dask,[19] a Dask cluster is composed of a central scheduler and multiple distributed workers, spins up an XGBoost scheduler in the same process running the Dask central scheduler and XGBoost worker in the same process running the Dask workers. Dask workers then hand over the Pandas DataFrame to the local XGBoost worker for distributed training.

7.3. PyTorch Integration

Skorch [20] is a Scikit-learn compatible wrapper for PyTorch, which enables Dask-ML to be used together with PyTorch.

7.4. Keras and TensorFlow Integrations

SciKeras [21] is an Scikit-learn compatible wrapper for Keras models which enables Dask-ML to be used with Keras.

8. Applications

8.1. Retail

  • Walmart uses Dask for forecasting the demand for 500,000,000 store-item combinations. To provide in-demand items in sufficient quantities at all their outlets, they need to run huge computations. Using RAPIDS and XGBoost, supported by Dask, they reached 100x acceleration.[5]
  • Blue Yonder uses Dask to process terabytes of data on a daily basis.[22] They can write Pandas-like code in Dask, which can then be pushed directly to production. This helps keep their feedback cycles short and waste low.
  • Grubhub uses Dask[23][24] alongside TensorFlow for pre-processing and ETL. Dask allows them to continue working in Python and get the functionalities they need.

8.2. Life Sciences

Dask is used for high resolution, 4-dimensional, cellular imagery by Harvard Medical School, Howard Hughes Medical Institute, Chan Zuckerberg Initiative, and the UC Berkeley Advanced Bioimaging Center.[25] They record the evolution and movements of a 3-dimensional cell over time, in maximum detail. This generates large amounts of data that is difficult to analyze with traditional methods. Dask helps them scale their data analysis workflows with its familiar API that resembles NumPy, Pandas, and Scikit-learn code. Dask is also used at the Novartis Institute for Biomedical Research to scale machine learning prototypes.

8.3. Finance Industry

  • Capital One[26] uses Dask to accelerate ETL and ML pipelines
  • Barclays[27] for financial system modeling

8.4. Geophysical Sciences

Dask is used in Climate Science, Energy, Hydrology, Meteorology, and Satellite Imaging by companies such as NASA, LANL, PANGEO:[28] Earth Science and the UK Meteorology Office.[29]

With Dask, oceanographers can produce massive simulated datasets of the earth’s oceans and researchers can look at large seismology datasets from sensors around the world, collect a large number of observations from satellites and weather stations, and run big simulations.

8.5. Software Libraries

Dask is integrated into many libraries, such as Pangeo [30] and xarray;[8] time series software like Prophet [31] and tsfresh;[32] ETL/ML software like Scikit-learn,[33] RAPIDS,[34] and XGBoost;[17] workflow management tools like Apache Airflow[35] and Prefect.[36]

9. History

9.1. 2014-2015

Dask [37] was originally developed at Continuum Analytics, a for-profit Python consulting company that eventually became Anaconda, Inc.,[38] the creator of many open-source packages and the popular Anaconda Python distribution. Dask grew out of the Blaze [39] project, a DARPA [40] funded project to accelerate computation in open source.

Blaze was an ambitious project that tried to redefine computation, storage, compression, and data science APIs for Python, led originally by Travis Oliphant and Peter Wang, the co-founders of Anaconda. However, Blaze’s approach of being an ecosystem-in-a-package meant that it was harder for new users to easily adopt.

Instead of rewriting a whole software ecosystem, Dask’s team intended to augment the existing one with the right component. With this idea in mind, on December 21, 2014[41] Matthew Rocklin created Dask. The purpose[42] of Dask was originally to parallelize NumPy so that it could harness one full workstation computer, which was common in finance shops at the time.

9.2. 2015-2017

The first projects to really adopt Dask were Xarray [43](commonly used in geo sciences) and Scikit-Image[44] (commonly used in image processing). Dask was integrated into Xarray within a few months of being born. It provided Dask with its first user community, which remains strong to this day.

Understanding that there is huge demand for a lightweight parallelism solution for Pandas DataFrames[45] and machine learning tools, such as Scikit-learn,[33] Dask quickly evolved to support other projects as well.

9.3. 2018

Since 2018, not only grassroots community users, but also other teams and institutions in academia, tech companies, and large corporations such as NASA, UK Met Office, Blue Yonder and NVIDIA, became more interested in Dask and began actively integrating it into their systems.

Dask received support from a diverse set of sources:[46] the US Government (DARPA grant), the Gordon and Betty Moore Foundation, Anaconda, NSF and NASA (US research grants with collaborations like Pangeo) and Nvidia.

9.4. 2020 – Present

In 2020, Matthew Rocklin founded Coiled Computing, Inc.[47] to provide further support for Dask development and enable companies to deploy Dask clusters in the cloud. In May 2021, the company raised $21 million in series A funding led by Bessemer Venture Partners.[48]

References

  1. "Scalable computing with Dask". https://ulhpc-tutorials.readthedocs.io/en/latest/python/advanced/dask-ml/. 
  2. "DataFrame - Dask documentation". https://docs.dask.org/en/stable/dataframe.html. 
  3. "Bag - Dask documentation". https://docs.dask.org/en/stable/bag.html. 
  4. "Array - Dask documentation". https://docs.dask.org/en/stable/array.html. 
  5. "DASK". https://www.nvidia.com/en-us/glossary/data-science/dask/#:~:text=Dask%20%2B%20NVIDIA%3A%20Driving%20Accessible%20Accelerated%20Analytics&text=Seeing%20the%20power%20and%20accessibility,GPUs%20and%20GPU%2Dbased%20systems.. 
  6. Eswaramoorthy, Pavithra. "What is Dask?". coiled.io. https://coiled.io/blog/what-is-dask/. 
  7. "Dask-ML". https://ml.dask.org/. 
  8. "Parallel computing with Dask". https://docs.xarray.dev/en/latest/user-guide/dask.html. 
  9. "Delayed - Dask documentation". https://docs.dask.org/en/latest/delayed.html. 
  10. "Futures - Dask documentation". https://docs.dask.org/en/latest/futures.html. 
  11. "Specification - Dask documentation". https://docs.dask.org/en/latest/spec.html. 
  12. "Dask scheduler - Dask documentation". https://docs.dask.org/en/stable/deploying.html. 
  13. "Computing with scikit-learn". https://scikit-learn.org/stable/computing/parallelism.html. 
  14. "Parallel Prediction and Transformation - Dask documentation". https://ml.dask.org/meta-estimators.html#parallel-meta-estimators. 
  15. "Incremental Hyperparameter Optimization - Dask documentation". https://ml.dask.org/hyper-parameter-search.html#hyperparameter-incremental. 
  16. "API Reference - Dask documentation". https://ml.dask.org/modules/api.html#api. 
  17. "Distributed XGBoost with Dask". https://xgboost.readthedocs.io/en/stable/tutorials/dask.html. 
  18. "How Distributed LightGBM Works. Dask". https://lightgbm.readthedocs.io/en/latest/Parallel-Learning-Guide.html#dask. 
  19. Rocklin, Matthew. "Dask and Pandas and XGBoost". http://matthewrocklin.com/blog/work/2017/03/28/dask-xgboost. 
  20. "Skorch documentation". https://skorch.readthedocs.io/en/stable/. 
  21. "SciKeras documentation". https://www.adriangb.com/scikeras/stable/. 
  22. "Dask Usage at Blue Yonder". https://tech.blueyonder.com/dask-usage-at-blue-yonder/. 
  23. "Matthew Rocklin - Bio". https://matthewrocklin.com/bio.html. 
  24. Bowne-Anderson, Hugo. "Search at Grubhub and User Intent". coiled.io. https://coiled.io/blog/grubhub-science-thursday/. 
  25. Eswaramoorthy, Pavithra. "Who Uses Dask?". coiled.io. https://coiled.io/blog/who-uses-dask/. 
  26. McEntee Ryan, McCarty Mike. "Dask & RAPIDS: The Next Big Thing for Data Science & ML". capitalone.com. https://www.capitalone.com/tech/machine-learning/dask-and-rapids-data-science-and-machine-learning-at-capital-one/. 
  27. Patel, Harshil. "Which library should I use? Apache Spark, Dask, and Pandas Performance Compared (With Benchmarks)". censius.ai. https://censius.ai/blogs/apache-spark-vs-dask-vs-pandas. 
  28. "Adapting Dask to Data Intensive Geoscience Research". https://coiled.wistia.com/medias/kgu2m47eg9. 
  29. "Met Office". https://www.metoffice.gov.uk/. 
  30. "Pangeo". https://pangeo.io/. 
  31. "Forecasting with HEAVY.AI and Prophet". https://docs.heavy.ai/data-science/additional-examples/forecasting-with-omnisci-and-prophet. 
  32. "Dask - the simple way. Tsfresh documentation". https://tsfresh.readthedocs.io/en/latest/text/large_data.html. 
  33. "scikit-learn". https://scikit-learn.org/stable/. 
  34. "Scale Python with Dask on GPUs". https://rapids.ai/dask.html. 
  35. "Dask Executor - Apache Airflow Documentation". https://airflow.apache.org/docs/apache-airflow/stable/executor/dask.html. 
  36. "Deployment: Dask. Prefect Docs.". https://docs.prefect.io/core/advanced_tutorials/dask-cluster.html. 
  37. "Dask". https://dask.org/. 
  38. "Anaconda". https://www.anaconda.com/. 
  39. "The Blaze Ecosystem". http://blaze.pydata.org/. 
  40. "DARPA". https://www.darpa.mil/. 
  41. "GitHub, Dask, 2014". https://github.com/dask/dask/commit/05488db498c1561d266c7b676b8a89021c03a9e7. 
  42. "Dask History.". https://www.youtube.com/watch?v=5nJVg8j11h0&t=20s. 
  43. "Xarray". https://xarray.pydata.org/en/stable/. 
  44. "Image processing in Python". https://scikit-image.org/. 
  45. "pandas". https://pandas.pydata.org/. 
  46. Rocklin, Matthew. "Funding Dask, a brief history". https://matthewrocklin.com/blog/work/2020/01/08/founding-1. 
  47. "Coiled: Python for Data Science on the Cloud with Dask". https://coiled.io/. 
  48. Wiggers, Kyle. "Data and AI operations startup Coiled nabs $21M". VentureBeat. https://venturebeat.com/2021/05/18/data-and-ai-operations-startup-coiled-nabs-21m/. 
More
Information
Contributor MDPI registered users' name will be linked to their SciProfiles pages. To register with us, please refer to https://encyclopedia.pub/register :
View Times: 447
Entry Collection: HandWiki
Revision: 1 time (View History)
Update Date: 20 Oct 2022
1000/1000
ScholarVision Creations