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

Automatic device assignment #121

Open
shinh opened this issue Apr 4, 2019 · 1 comment
Open

Automatic device assignment #121

shinh opened this issue Apr 4, 2019 · 1 comment

Comments

@shinh
Copy link
Member

shinh commented Apr 4, 2019

Currently, when -d cuda is specified, some heuristics are currently used:

  1. all inputs will be allocated in GPU except ones which are directly fed to Reshape op as its output shape.
  2. results of Shape op will be stored in host.
  3. if the right hand side of Div is a single float value, chainerx::AsScalar is called internally in XCVM's Div (this weird hack is for y / x.shape[0] where x.shape[0] is a batch_size).

These actually work as mitigation for now, but we should design more sophisticated device assignments. The principle would be

  1. Shapes should be in CPU
  2. Make it possible to run cross-device binary ops when one of their inputs is a scalar.
  3. If requirements cannot be satisfied, insert a custom op (say OnikuxDeviceCopy) which explicitly copy data between devices, probably showing a warning to users.
@shinh
Copy link
Member Author

shinh commented May 8, 2019

Memo: classify-int64-2 branch in the pre-release repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant