Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Mars

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!

Metadata

Release files for pymars 0.2.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymars 0.2.0b2
File Size Uploaded
pymars-0.2.0b2.tar.gz 1.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for pymars 0.2.0b2
File
pymars-0.2.0b2-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
pymars-0.2.0b2-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
pymars-0.2.0b2-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ x86-64 Details
pymars-0.2.0b2-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
pymars-0.2.0b2-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
pymars-0.2.0b2-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 CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.7+ x86-64, macOS 10.9+ x86-64, macOS 10.10+ Intel (x86-64, i386) Details
pymars-0.2.0b2-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
pymars-0.2.0b2-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
pymars-0.2.0b2-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 CPython 3.5 CPython 3.5 pymalloc macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ Intel (x86-64, i386), macOS 10.6+ x86-64, macOS 10.10+ x86-64, macOS 10.9+ x86-64 Details
pymars-0.2.0b2-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details
pymars-0.2.0b2-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
pymars-0.2.0b2-cp27-cp27m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.9+ Intel (x86-64, i386), macOS 10.6+ x86-64, macOS 10.10+ x86-64, macOS 10.9+ x86-64, macOS 10.10+ Intel (x86-64, i386) Details

Total release size: 60.3 MB

Release files / pymars-0.2.0b2.tar.gz

Download URL pymars-0.2.0b2.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
559774e9a05779516f9a30eb4493d8ca6980846a0723094fbf8f172cea2d2f01
BLAKE2b-256 checksum
How to use checksums
259c2ecd94109ccbfa923fd03a71ebae6643d0bd2c97216636d897662f5ed59b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / pymars-0.2.0b2-cp37-cp37m-win_amd64.whl

Download URL pymars-0.2.0b2-cp37-cp37m-win_amd64.whl
Size 2.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
b3b5d7777a55abab1dc6b346dc9ae122987f5656091e38b7386296f110db401e
BLAKE2b-256 checksum
How to use checksums
2dc6b1844d109af248401d991fe86c108faaad54da1716a4c7812db7c204d31b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / pymars-0.2.0b2-cp37-cp37m-manylinux1_x86_64.whl

Download URL pymars-0.2.0b2-cp37-cp37m-manylinux1_x86_64.whl
Size 7.8 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
9ff177f1c0146b44d693441ab1a45715794cccb422b2da784397236955a60718
BLAKE2b-256 checksum
How to use checksums
3db59fed02e7e0a7fb5a7b2fd72723eb0caae609e3a1441793a73d59b59ab559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / pymars-0.2.0b2-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL pymars-0.2.0b2-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 3.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
dbe6ce197b0ff21a81ec3e3e1944dc0b291a3ed350377a0fc130a4b9aa1a9908
BLAKE2b-256 checksum
How to use checksums
bcbec8c5b48d27916a9ab205d5a0ddb156e36cb32995c3194c35f4b453a472b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / pymars-0.2.0b2-cp36-cp36m-win_amd64.whl

Download URL pymars-0.2.0b2-cp36-cp36m-win_amd64.whl
Size 2.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
ec10299cb19bd6cf1ccf6387b6111e982f44a5357aaacecefe90f6df44b49555
BLAKE2b-256 checksum
How to use checksums
e50b9d849ba8427c794cf92c26e26505a261a156564275720e28b14ee7db4509
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / pymars-0.2.0b2-cp36-cp36m-manylinux1_x86_64.whl

Download URL pymars-0.2.0b2-cp36-cp36m-manylinux1_x86_64.whl
Size 7.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
b2a273ad1110e6918d7db62e09fc6bb2b770f2e033d9e6f1f305802e1406247e
BLAKE2b-256 checksum
How to use checksums
66abba522367bdd9310d308dd111132d60fba97c607cf42123cd9e20de8dcc2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / pymars-0.2.0b2-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

Download URL pymars-0.2.0b2-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
Size 3.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.7+ x86-64 macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
ae4bbf21a2e40baa2fa7a388b7efdfd33e9f2291ce04bb385186bb113c8904c2
BLAKE2b-256 checksum
How to use checksums
af6b9dbbf75e94922dbcb9b5981efad006449029ebd44076c028425970df8262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / pymars-0.2.0b2-cp35-cp35m-win_amd64.whl

Download URL pymars-0.2.0b2-cp35-cp35m-win_amd64.whl
Size 2.9 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
f6b81ba8458a687f9fc8111543380a04be905f2585689cd4d8eccb8256ccfc96
BLAKE2b-256 checksum
How to use checksums
eb9f9c1d14aac0e01f708ebb6e530df1aff951cb71aef6fac0a09046ec503f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

Release files / pymars-0.2.0b2-cp35-cp35m-manylinux1_x86_64.whl

Download URL pymars-0.2.0b2-cp35-cp35m-manylinux1_x86_64.whl
Size 7.6 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
1da96ebc239f311c4cae91e649b2ac18c915f8cd5f696906fe7bb3533d9d3d91
BLAKE2b-256 checksum
How to use checksums
cc2f88147985e84c72edf9befa554ddd073bf0e7ba1a6af0f4b67b7353f63190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.6

Release files / pymars-0.2.0b2-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

Download URL pymars-0.2.0b2-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
Size 3.2 MB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ x86-64 macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
af09aadb25525f88f5a8a447146abbd49d3b6568822f85b72d182d04cb772661
BLAKE2b-256 checksum
How to use checksums
39a86cc8fbc932aabc510f63656bcac9b09464e2b8fac40a74d30aa622d5352f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.6

Release files / pymars-0.2.0b2-cp27-cp27mu-manylinux1_x86_64.whl

Download URL pymars-0.2.0b2-cp27-cp27mu-manylinux1_x86_64.whl
Size 7.0 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8528fec2844ff95ea2e1a6b60c27590bb198c1b5e3ea3fa1fff3c5239f34efa6
BLAKE2b-256 checksum
How to use checksums
4bb7eb5634125306d789d58b410560d5a85392dbedb3d8a42f7a9605e56b7c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

Release files / pymars-0.2.0b2-cp27-cp27m-manylinux1_x86_64.whl

Download URL pymars-0.2.0b2-cp27-cp27m-manylinux1_x86_64.whl
Size 7.0 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
df0b9c97371b1a74aac260c45e2426594beac4bcdfd5ce84a250d3aae9dfd436
BLAKE2b-256 checksum
How to use checksums
352cf2f67df06b5b3739984078b5f5c3932451454334a5e7573441d459460859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

Release files / pymars-0.2.0b2-cp27-cp27m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL pymars-0.2.0b2-cp27-cp27m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 3.2 MB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ x86-64 macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
25497e37052935351fb50d445a88dfc71ce3f8c3cc152a9d393d5ff7e8f706e4
BLAKE2b-256 checksum
How to use checksums
f7d1c7142f38346bf86d52411a827abc07db4eeeb3c007c173639da147f2207a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

Release history Release notifications | RSS feed

0.9.0

23 release files

0.8.7

17 release files

0.8.4

17 release files

0.8.2

13 release files

0.8.0

13 release files

0.7.5

13 release files

0.7.3

13 release files

0.7.1

13 release files

0.6.8

13 release files

0.6.7

13 release files

0.6.5

13 release files

0.6.4

10 release files

0.6.3

10 release files

0.6.1

10 release files

0.5.5

10 release files

0.5.3

10 release files

0.5.2

10 release files

0.5.1

10 release files

0.5.0

10 release files

0.4.7

13 release files

0.4.6

13 release files

0.4.4

13 release files

0.4.3

13 release files

0.4.2

13 release files

0.4.1

13 release files

0.4.0

13 release files

0.3.4

16 release files

0.3.3

16 release files

0.3.2

16 release files

0.3.1

15 release files

0.3.0

16 release files

0.2.4

12 release files

0.2.3

12 release files

0.2.2

13 release files

0.2.1

13 release files

0.2.0

13 release files

This release

0.2.0b2 This release

13 release files

0.1.5

13 release files

0.1.3

12 release files

0.1.2

12 release files

0.1.0

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page