MARS: a tensor-based unified framework for large-scale data computation.
Project description
Mars is a tensor-based unified framework for large-scale data computation which scales Numpy, Pandas and Scikit-learn.
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 |
|
|
|
|
Mars can leverage multiple cores, even on a laptop, and could be even faster for a distributed setting.
Mars DataFrame
Mars DataFrame provides a familiar interface like pandas.
Pandas |
Mars DataFrame |
|
|
|
|
Mars learn
Mars learn provides a familiar interface like scikit-learn.
Scikit-learn |
Mars learn |
|
|
Mars remote
Mars remote allows users to execute functions in parallel.
Vanilla function calls |
Mars remote |
|
|
|
|
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, DataFrame etc will be executed immediately by default session once it is created.
>>> import mars.tensor as mt
>>> import mars.dataframe as md
>>> from mars.config import options
>>> options.eager_mode = True
>>> t = mt.arange(6).reshape((2, 3))
>>> t
array([[0, 1, 2],
[3, 4, 5]])
>>> df = md.DataFrame(t)
>>> df.sum()
0 3
1 5
2 7
dtype: int64
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()
>>> (a * 2).execute(session=session)
>>> # session will be released when out of with statement
>>> with new_session() as session2:
>>> (a / 3).execute(session=session2)
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)
>>> (a * 3).execute(session=session)
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)
>>> b.execute(session=sess)
Getting involved
Read development guide.
Join the mailing list: send an email to mars-dev@googlegroups.com.
Please report bugs by submitting a GitHub issue.
Submit contributions using pull requests.
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
Built Distributions
Hashes for pymars-0.5.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc2195f1e0a9b1739673a72e2383d5ef54e6c53af42517afebbdf2554f2df30d |
|
MD5 | 1223ed93fa0832137ab0c5dd9a2cf7f2 |
|
BLAKE2b-256 | 354081084a8200d12c1f38b034ff59b358d0f342f769a1d6b0ba6a4e47def13d |
Hashes for pymars-0.5.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c1727690087d1e741a260e5b0e4c9ff700ce9468415137f0eb8d29b646be004 |
|
MD5 | 97957f69744c216ea055fe10174a441f |
|
BLAKE2b-256 | 2ccf9b6b901e747bb9bbf2956344db939f7a87aa797ab9983955b84b6511b90f |
Hashes for pymars-0.5.0-cp38-cp38-macosx_10_15_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 | af44428ddd9900f858f08c1cc40332005950e909654448c87c63dd2200e79162 |
|
MD5 | a63a510ee1e3fd3d083c2df80a848831 |
|
BLAKE2b-256 | a58cce4c1ddb4b6e93fbabe525aa8347735a73a187d6df3b42c17ae5ba3d2f2a |
Hashes for pymars-0.5.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67bfeb51bd0b0dc3e1c6453e2873db28406ce1c9226d86d2087b5a4676a2d2cc |
|
MD5 | 5b3e9e9108b7bd02487355fe446806aa |
|
BLAKE2b-256 | 499027a93d3188fa56157d675a831171b5425a8fa0ca210e016b79778c662530 |
Hashes for pymars-0.5.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee9d380b0ad5a5662ed9772b2a59de748f4c2a8e2288bf3f830469fec2dada0b |
|
MD5 | 5299185845353acbbbf5d3e66a11ab11 |
|
BLAKE2b-256 | 20f27ff10b4b2a1464e643dac6c3e7b42deed9c10db011292174953758df62dd |
Hashes for pymars-0.5.0-cp37-cp37m-macosx_10_15_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 | 8f78bef46444a4a2dd823e65dc49800a7658d775f0a1b1174dced1353a374a01 |
|
MD5 | d85fd530a40b9a3d2ee7f1d2386065a4 |
|
BLAKE2b-256 | dffa78a7c3f07d1a5461d0f76b699e5a6a8e7ac60f85d59b1d08874b03392071 |
Hashes for pymars-0.5.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69928dcb5a80b3edb0e88f1ac431e83f98c94a9bc24aeb6c8db8943c29604575 |
|
MD5 | 0b35417f454b6eda3b24189271cc947e |
|
BLAKE2b-256 | fd7e2b689949d698c9936da1e9e2b2e9d3593b9d7d384a38528d44a99d5a9d07 |
Hashes for pymars-0.5.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e55fe207caba527ccbc2a95f4245aebae88d1a1d4ca7a6cdbebb2b214a44f81 |
|
MD5 | 553f25e00fad0ea8b57207d3ffa92240 |
|
BLAKE2b-256 | 4d8fb9636b2bc7e49c4792eb6e6c2ff15e1615d831069d8b20214009a03958b2 |
Hashes for pymars-0.5.0-cp36-cp36m-macosx_10_15_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 | a36781e4b9028d9fbad9a0f0af945bd751065086635ccba32f11019c6000af2e |
|
MD5 | 866af4625c592c0ae4fc7e4ca2bc15b9 |
|
BLAKE2b-256 | 269e89fec23ce3d6f2b674407d3256940476b4bc3e1e809377f5f3c4aa41cd37 |