Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TENSOR] eager mode support #28

Closed
qinxuye opened this issue Dec 13, 2018 · 2 comments
Closed

[TENSOR] eager mode support #28

qinxuye opened this issue Dec 13, 2018 · 2 comments

Comments

@qinxuye
Copy link
Collaborator

qinxuye commented Dec 13, 2018

Is your feature request related to a problem? Please describe.

Currently, the tensor can only be executed by the graph mode, we build a tensor graph, submit it to the cluster when users call the execute method.

Although the graph mode is born for performance, it's quite unfriendly for developing, and hard to debug. Thus, I suggest that we can provide an eager mode.

Describe the solution you'd like

We can enable the eager mode by the option.

Enable the eager mode globally.

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

Since every Tensor object is created by the new_tensors method defined in tensor/expressions/core.py, if the eager mode is on, we can trigger the submission graph there to make sure the tensor is executed eagerly.

Additional context

Maybe we can abstract a new_entities not only for the tensors, prepared for the coming dataframe module.

@qinxuye
Copy link
Collaborator Author

qinxuye commented Jan 3, 2019

I think in order to reach the availability of eager mode, we can separate the develop process into a few steps.

  • Record which tensor has been executed in a specified session. (Support fetch executed tensor data from server #80)
  • Update the shape and so forth after execute.(Update tensor shape after execution #120)
  • Handle the executed tensor by replacing it with tensor whose op is Fetch. Handling logic for local, local cluster and distributed session may be different.(Replace executed tensor with fetch tensor #180)
  • Provide a base class for the TensorOperandMixin which has a new_tensors method, maybe we need to implement a new_entities for the base class, and call it inside the new_tensors. This is a preparation for the coming dataframe module. (DataFrame initial support #173)
  • If eager mode is on, make the new_tensor(maybe new_entity) trigger the execution when building expressions, we need to take care of the case cautiously, because new_tensor is also widely used in the tile, we need to make sure that the new_tensor in tile would not trigger the execution.(Support eager mode #200)

cc @NJUPole if there is any additional suggestion.

@qinxuye
Copy link
Collaborator Author

qinxuye commented Feb 13, 2019

As all steps have been achieved, this summary issue can be closed.

@qinxuye qinxuye closed this as completed Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant