Skip to content

Conversation

@guoyuhong
Copy link
Contributor

@guoyuhong guoyuhong commented Feb 27, 2019

What do these changes do?

  1. Use strongly typed IDs in C++. Now, the compiler will complain about misusing of ids. The user needs to call the explicit constructor to cast the type.
  2. Update cython part to adapt the c++ changes.

Related issue number

#3721

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12364/
Test FAILed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really want to allocate this on the heap? Seems like for such a small object it would be better to do it inline, can that be made to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I removed all the heap allocations.

@pcmoritz
Copy link
Contributor

The C++ changes are great, for the cython ones, is there a way to get rid of the heap allocations (and also the code duplications if possible).

@robertnishihara
Copy link
Collaborator

This is a huge improvement. I've had plenty of bugs in the past where I mixed up the ID types (e.g., passed ID arguments into a function in the wrong order) that would have been caught by this.

@robertnishihara
Copy link
Collaborator

This should fix #3721, right?

@guoyuhong
Copy link
Contributor Author

@robertnishihara Yes, that will fix #3721 .

@guoyuhong guoyuhong changed the title Use strongly typed IDs for C++. Use strongly typed IDs in C++. Feb 28, 2019
@guoyuhong guoyuhong force-pushed the strongTypeID branch 2 times, most recently from 178fcba to a880709 Compare February 28, 2019 10:53
@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12387/
Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12388/
Test PASSed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12390/
Test FAILed.

@guoyuhong
Copy link
Contributor Author

@AmplabJenkins retest this, please.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12393/
Test FAILed.

@guoyuhong
Copy link
Contributor Author

@AmplabJenkins retest this, please.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12403/
Test FAILed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be invoked in a situation where self is not of type ObjectID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this is only useful in __cinit__ and it is not necessary in __init__. I will do a double confirm. For __cinit__, the functions of derived class and base class will both be called, so using this if statement will avoid duplicated initiation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pcmoritz In cython, __init__ behaves the same as python's. This function will be called only once. On the contrast, __cinit__ will be called in both base class and derived class. I have removed the type check. Thanks!

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12424/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12469/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12500/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12526/
Test FAILed.

Copy link
Contributor

Choose a reason for hiding this comment

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

it seems that these constructors aren't used in Cython. We can remove them to minimize redundant code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed both constructors for each cppclass.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12598/
Test FAILed.

@guoyuhong
Copy link
Contributor Author

Do you have more comments? I rebased the PR every day avoid logic conflicts with other PRs.

Copy link
Contributor

@pcmoritz pcmoritz left a comment

Choose a reason for hiding this comment

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

This is great!

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12651/
Test FAILed.

@guoyuhong guoyuhong merged commit b9ea821 into ray-project:master Mar 7, 2019
@guoyuhong guoyuhong deleted the strongTypeID branch March 7, 2019 13:43
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

Successfully merging this pull request may close these issues.

5 participants