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

Raise ValueError when calling xxx_obj with ChainerX array in ChainerMN #8320

Merged
merged 3 commits into from
Nov 14, 2019

Conversation

belldandyxtq
Copy link
Member

@belldandyxtq belldandyxtq commented Oct 25, 2019

The chainerx array preserves device id inside, which will also be
pickled during the mpi communications and causes future errors.

This PR prevents such cases by raising ValueError when calling
x_obj with the chainerx array.

@belldandyxtq belldandyxtq added contribution-welcome Contribution is welcomed. If a ticket has this label, anyone is welcomed to work on it. ChainerMN Related to ChainerMN. labels Oct 25, 2019
The chainerx array preserves device id inside, which will also be
pickled during the mpi communications and causes future errors.

This commit prevent such cases by raising ValueError when calling
`x_obj` with the chainerx array.
@belldandyxtq belldandyxtq removed the contribution-welcome Contribution is welcomed. If a ticket has this label, anyone is welcomed to work on it. label Nov 14, 2019
@shu65 shu65 self-requested a review November 14, 2019 07:18
@shu65
Copy link
Member

shu65 commented Nov 14, 2019

Jenkins, test this please

xp = chainer.backend.get_array_module(value)
if xp == chainerx and value.device.name.startswith('cuda'):
return True
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about checking if obj is array object of numpy, 'cupy', and chainerx?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chainer.backend.get_array_module can accept any type and return numpy for types that are not cupy nor chainerx. So I don't think we have to check if they beforehand.

@chainer-ci
Copy link
Member

Jenkins CI test (for commit 0d10a8e, target branch master) succeeded!

@belldandyxtq
Copy link
Member Author

Jenkins, test this please

@chainer-ci
Copy link
Member

Jenkins CI test (for commit e7dc04d, target branch master) succeeded!

@shu65 shu65 merged commit 7bae43e into chainer:master Nov 14, 2019
@kmaehashi kmaehashi added this to the v7.0.0 milestone Dec 5, 2019
@kmaehashi kmaehashi added the cat:enhancement Implementation that does not break interfaces. label Dec 5, 2019
@emcastillo emcastillo changed the title Raise ValueError when calling xxx_obj with ChainerX array in ChianerMN Raise ValueError when calling xxx_obj with ChainerX array in ChainerMN Dec 5, 2019
@chainer-ci
Copy link
Member

Jenkins CI test (for commit e7dc04d, target branch master) succeeded!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Implementation that does not break interfaces. ChainerMN Related to ChainerMN.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants