Giter Site home page Giter Site logo

pandinosaurus / legate.numpy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nv-legate/cunumeric

0.0 1.0 0.0 3.36 MB

An Aspiring Drop-In Replacement for NumPy at Scale

License: Apache License 2.0

Python 36.80% Makefile 0.31% C++ 41.50% Cuda 20.97% C 0.41%

legate.numpy's Introduction

Legate NumPy

Legate NumPy is a Legate library that aims to provide a distributed and accelerated drop-in replacement for the NumPy API on top of the Legion runtime. Using Legate NumPy you do things like run the final example of the Python CFD course completely unmodified on 2048 A100 GPUs in a DGX SuperPOD and achieve good weak scaling.

drawing

Legate NumPy works best for programs that have very large arrays of data that cannot fit in the memory of a single GPU or a single node and need to span multiple nodes and GPUs. While our implementation of the current NumPy API is still incomplete, programs that use unimplemented features will still work (assuming enough memory) by falling back to the canonical NumPy implementation.

If you have questions, please contact us at legate(at)nvidia.com.

  1. Installation
  2. Dependencies
  3. Building from Source
  4. Usage and Execution
  5. Supported and Planned Features
  6. Supported Types and Dimensions
  7. Documentation
  8. Future Directions
  9. Known Bugs

Installation

Pre-built docker images containing all Legate libraries are available on the quickstart repo. The next sections describe how to build Legate NumPy from source.

Dependencies

Users must have a working installation of the Legate Core library prior to installing Legate NumPy.

Legate NumPy requires Python >= 3.6. We provide a conda environment file that installs all needed dependencies in one step. Use the following command to create a conda environment with it:

conda env create -n legate -f conda/legate_numpy_dev.yml

Building from Source

Installation of Legate NumPy is done with either setup.py for simple uses cases or install.py for more advanced use cases. The most common installation command is:

python setup.py --with-core <path-to-legate-core-installation>

This will build Legate NumPy against the Legate Core installation and then install Legate NumPy into the same location. Users can also install Legate NumPy into an alternative location with the canonical --prefix flag as well.

python setup.py --prefix <install-dir> --with-core <path-to-legate-core-installation>

Note that after the first invocation of setup.py this repository will remember which Legate Core installation to use and the --with-core option can be omitted unless the user wants to change it.

Advanced users can also invoke install.py --help to see options for configuring Legate NumPy by invoking the install.py script directly.

Of particular interest to Legate NumPy users will likely be the option for specifying an installation of OpenBLAS to use. If you already have an installation of OpenBLAS on your machine you can inform the install.py script about its location using the --with-openblas flag:

python setup.py --with-openblas /path/to/open/blas/

Usage and Execution

Using Legate NumPy as a replacement for NumPy is easy. Users only need to replace:

import numpy as np

with:

import legate.numpy as np

These programs can then be run by the Legate driver script described in the Legate Core documentation.

legate legate_numpy_program.py

For execution with multiple nodes (assuming Legate Core is installed with GASNet support) users can supply the --nodes flag. For execution with GPUs, users can use the --gpus flags to specify the number of GPUs to use per node. We encourage all users to familiarize themselves with these resource flags as described in the Legate Core documentation or simply by passing --help to the legate driver script.

Supported and Planned Features

Legate NumPy is currently a work in progress and we are gradually adding support for additional NumPy operators. Unsupported NumPy operations will provide a warning that we are falling back to canonical NumPy. Please report unimplemented features that are necessary for attaining good performance so that we can triage them and prioritize implementation appropriately. The more users that report an unimplemented feature, the more we will prioritize it. Please include a pointer to your code if possible too so we can see how you are using the feature in context.

Supported Types and Dimensions

Legate NumPy currently supports the following NumPy types: float16, float32, float64, int16, int32, int64, uint16, uint32, uint64, bool, complex64, and complex128. Legate currently also only works on up to 3D arrays at the moment. We're currently working on support for N-D arrays. If you have a need for arrays with more than three dimensions please let us know about it.

Documentation

A complete list of available features can is provided in the API reference.

Future Directions

There are three primary directions that we plan to investigate with Legate NumPy going forward:

  • More features: we plan to identify a few key lighthouse applications and use the demands of these applications to drive the addition of new features to Legate NumPy.
  • We plan to add support for sharded file I/O for loading and storing large data sets that could never be loaded on a single node. Initially this will begin with native support for h5py but will grow to accommodate other formats needed by our lighthouse applications.
  • Strong scaling: while Legate NumPy is currently implemented in a way that enables weak scaling of codes on larger data sets, we would also like to make it possible to strong-scale Legate applications for a single problem size. This will require leveraging some of the more advanced features of Legion from inside the Python interpreter.

We are open to comments, suggestions, and ideas.

Known Bugs

  • Legate NumPy can exercise a bug in OpenBLAS when it is run with multiple OpenMP processors
  • On Mac OSX, Legate NumPy can trigger a bug in Apple's implementation of libc++. The bug has since been fixed but likely will not show up on most Apple machines for quite some time. You may have to manually patch your implementation of libc++. If you have trouble doing this please contact us and we will be able to help you.

legate.numpy's People

Contributors

manopapad avatar magnatelee avatar marcinz avatar lightsighter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.