Skip to main content

MARS: a tensor-based unified framework for large-scale data computation.

Project description

PyPI version Docs Build Coverage Quality License

Mars is a tensor-based unified framework for large-scale data computation. Documentation.

Installation

Mars is easy to install by

pip install pymars

When you need to install dependencies needed by the distributed version, you can use the command below.

pip install 'pymars[distributed]'

For now, distributed version is only available on Linux and Mac OS.

Developer Install

When you want to contribute code to Mars, you can follow the instructions below to install Mars for development:

git clone https://github.com/mars-project/mars.git
cd mars
pip install -e ".[dev]"

More details about installing Mars can be found at getting started section in Mars document.

Mars tensor

Mars tensor provides a familiar interface like Numpy.

Numpy

Mars tensor

import numpy as np
a = np.random.rand(1000, 2000)
(a + 1).sum(axis=1)
import mars.tensor as mt
a = mt.random.rand(1000, 2000)
(a + 1).sum(axis=1).execute()

The following is a brief overview of supported subset of Numpy interface.

  • Arithmetic and mathematics: +, -, *, /, exp, log, etc.

  • Reduction along axes (sum, max, argmax, etc).

  • Most of the array creation routines (empty, ones_like, diag, etc). What’s more, Mars does not only support create array/tensor on GPU, but also support create sparse tensor.

  • Most of the array manipulation routines (reshape, rollaxis, concatenate, etc.)

  • Basic indexing (indexing by ints, slices, newaxes, and Ellipsis)

  • Advanced indexing (except combing boolean array indexing and integer array indexing)

  • universal functions for elementwise operations.

  • Linear algebra functions, including product (dot, matmul, etc.) and decomposition (cholesky, svd, etc.).

However, Mars has not implemented entire Numpy interface, either the time limitation or difficulty is the main handicap. Any contribution from community is sincerely welcomed. The main feature not implemented are listed below:

  • Tensor with unknown shape does not support all operations.

  • Only small subset of np.linalg are implemented.

  • Operations like sort which is hard to execute in parallel are not implemented.

  • Mars tensor doesn’t implement interface like tolist and nditer etc, because the iteration or loops over a large tensor is very inefficient.

Eager Mode

Mars supports eager mode which makes it friendly for developing and easy to debug.

Users can enable the eager mode by options, set options at the beginning of the program or console session.

>>> from mars.config import options
>>> options.eager_mode = True

Or use a context.

>>> from mars.config import option_context
>>> with option_context() as options:
>>>     options.eager_mode = True
>>>     # the eager mode is on only for the with statement
>>>     ...

If eager mode is on, tensor will be executed immediately by default session once it is created.

>>> import mars.tensor as mt
>>> from mars.config import options
>>> options.eager_mode = True
>>> t = mt.arange(6).reshape((2, 3))
>>> print(t)
Tensor(op=TensorRand, shape=(2, 3), data=
[[0 1 2]
[3 4 5]])

Easy to scale in and scale out

Mars can scale in to a single machine, and scale out to a cluster with thousands of machines. Both the local and distributed version share the same piece of code, it’s fairly simple to migrate from a single machine to a cluster due to the increase of data.

Running on a single machine including thread-based scheduling, local cluster scheduling which bundles the whole distributed components. Mars is also easy to scale out to a cluster by starting different components of mars distributed runtime on different machines in the cluster.

Threaded

execute method will by default run on the thread-based scheduler on a single machine.

>>> import mars.tensor as mt
>>> a = mt.ones((10, 10))
>>> a.execute()

Users can create a session explicitly.

>>> from mars.session import new_session
>>> session = new_session()
>>> session.run(a + 1)
>>> (a * 2).execute(session=session)
>>> # session will be released when out of with statement
>>> with new_session() as session2:
>>>     session2.run(a / 3)

Local cluster

Users can start the local cluster bundled with the distributed runtime on a single machine. Local cluster mode requires mars distributed version.

>>> from mars.deploy.local import new_cluster

>>> # cluster will create a session and set it as default
>>> cluster = new_cluster()

>>> # run on the local cluster
>>> (a + 1).execute()

>>> # create a session explicitly by specifying the cluster's endpoint
>>> session = new_session(cluster.endpoint)
>>> session.run(a * 3)

Distributed

After installing the distributed version on every node in the cluster, A node can be selected as scheduler and another as web service, leaving other nodes as workers. The scheduler can be started with the following command:

mars-scheduler -a <scheduler_ip> -p <scheduler_port>

Web service can be started with the following command:

mars-web -a <web_ip> -s <scheduler_endpoint> --ui-port <ui_port_exposed_to_user>

Workers can be started with the following command:

mars-worker -a <worker_ip> -p <worker_port> -s <scheduler_endpoint>

After all mars processes are started, users can run

>>> sess = new_session('http://<web_ip>:<ui_port>')
>>> a = mt.ones((2000, 2000), chunk_size=200)
>>> b = mt.inner(a, a)
>>> sess.run(b)

Getting involved

Thank you in advance for your contributions!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymars-0.2.1.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pymars-0.2.1-cp37-cp37m-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.7mWindows x86-64

pymars-0.2.1-cp37-cp37m-manylinux1_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.7m

pymars-0.2.1-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.7mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

pymars-0.2.1-cp36-cp36m-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.6mWindows x86-64

pymars-0.2.1-cp36-cp36m-manylinux1_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.6m

pymars-0.2.1-cp36-cp36m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.6mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.7+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

pymars-0.2.1-cp35-cp35m-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.5mWindows x86-64

pymars-0.2.1-cp35-cp35m-manylinux1_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.5m

pymars-0.2.1-cp35-cp35m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.5mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.6+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

pymars-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl (7.1 MB view details)

Uploaded CPython 2.7mu

pymars-0.2.1-cp27-cp27m-manylinux1_x86_64.whl (7.1 MB view details)

Uploaded CPython 2.7m

pymars-0.2.1-cp27-cp27m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.2 MB view details)

Uploaded CPython 2.7mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.7+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

File details

Details for the file pymars-0.2.1.tar.gz.

File metadata

  • Download URL: pymars-0.2.1.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for pymars-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2fadbb740079d37efe353264fecb3ea724373cdafb6942653648947e83fd1917
MD5 e58b5e082340bf108e436436793da5b4
BLAKE2b-256 3e4d625830018462858b6199dfd057546cfa7264be5ac6ee8fa32c812701d085

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pymars-0.2.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5e7cf23b4ef8112e58395eecdb5d7ca30b56746d3b162c495acc722b21278741
MD5 9d24699ec0e49567d17e199480e082ba
BLAKE2b-256 ec3ed85addbfb242830ef374a780f94e96706b7dea7e0f080b2b334346e54f44

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pymars-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 708ffd4e5d2c63bce7ecf3a923217c16b5441bfa0482925d55363f628005c3cd
MD5 06d3ece8fc3a16dc68cbe905c752211b
BLAKE2b-256 f6490307497bbc0e4d804e2841ddb4c680a2a18961c64e73bf4b3f9a891cb9bc

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pymars-0.2.1-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 14cef42a67298419dc737e6974e695f1e2e394e3168643e5bdec8139f32ebfca
MD5 f2e71fd704db24833d544c17361b324b
BLAKE2b-256 3caf9bd19f4f561a672a65c2a988cc473e5fd50c4269a808c8ff6ae21eccd795

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for pymars-0.2.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 be4582a6fc6025e539d68c99261284782718f28aa99282c677241be782a9558a
MD5 5d5c0120c3ac4b1340569164352ac218
BLAKE2b-256 a208c7bf1a664cbfa8ee63400b33ef0e760d7e3596a731631a66fd305160f8e1

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 8.0 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for pymars-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1e3703ea5152eeb555a1116a8faf0948a6f6e5dc13e26d249326aa734aa0e656
MD5 da186b6dfd30bba2e5acfb08c27c5bc6
BLAKE2b-256 59d6da79265dcc4501e0257c345e7305496f91e589fb2c8c11a9a7a9d46cf572

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp36-cp36m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pymars-0.2.1-cp36-cp36m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 27d08730a4c35b3c8b22087c5f7bc2d72260dffab3078f3513357feac3d0bec7
MD5 3874e4aa8b61e870602af68bfbfd4aa7
BLAKE2b-256 0456d69eb0e9e9c1b8e25d48eabd965e02a15f94625e643d7f2cc1478a922b8a

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.4

File hashes

Hashes for pymars-0.2.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 0dfc5993188bf90765575952216f88a3db68e349c0f2476b0c1e590449de036c
MD5 15f760ab3467dbdb0e5185c64ce9a1c6
BLAKE2b-256 182c1fe57218828247f181896e35afed90b6cd69e8e742e0daa30e3c21afc4dc

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.8 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.6

File hashes

Hashes for pymars-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e668ccc455e4da820ffd55d8b415482741d177c1e534349fe77d88216837ead9
MD5 fe6b0f227717612cec91080eda54edc5
BLAKE2b-256 fad8ecd3dad51e624782dd60aadf8cb25f0ff3fa58b112c3962b0242734f18ff

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp35-cp35m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pymars-0.2.1-cp35-cp35m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 ff4d85691e78da256d93f665554523ffb6e120d8fd14ac37da9c15386d536153
MD5 516cf17b4bab9b457acda757b4ed677e
BLAKE2b-256 94b6850e5899affdb2c25dff08b40acbd38754b554aa6cfce1d4c7a39fc96362

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.16

File hashes

Hashes for pymars-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bb9c95e4ceecb922acbcd03d72c13fe4dfb735dd5eb65e95bf5b3401958f526b
MD5 9f8d7a056d603da512066286c5d36207
BLAKE2b-256 5faeb544f6b695fa44fb048697c37805b7c25e5c246e67f436be8f1914ffa744

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pymars-0.2.1-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.16

File hashes

Hashes for pymars-0.2.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f0975f636ab9414d7a24dd355943647e280b5ccf40d5ebb2db10dda8bf201ca8
MD5 b767fa2e3e7e2fa47aa996482a939048
BLAKE2b-256 489b53b3c089d46799e4107850ee6bf9e05b5cefe588b36003f02faae2f4b60f

See more details on using hashes here.

File details

Details for the file pymars-0.2.1-cp27-cp27m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pymars-0.2.1-cp27-cp27m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 b0b89d1cce9515a4252b8880e146ee708b4caa2a366e17ee613d1b356cc876b5
MD5 46510240b2903f9457e04e97341d7eb6
BLAKE2b-256 261142e82553a5047190fe3ad631c67338cd9ab6b3d31cf54e32705b527bcea9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page