Skip to content

Conversation

eric-jj
Copy link
Contributor

@eric-jj eric-jj commented May 10, 2018

The PR will resolve two issues.

Use the make_shared to replace std::shared_ptr(new XXX), make_shared will combine the reference count and object create(new) to a memory allocation, but the std::shared_ptr(new XXX) will cause two allocations.
Pass the shared_ptr by reference in some cases instead of pass by value. Copy of a shared_ptr is not cheap, which will call the interlock increase and decrease during the function call. Interlock operation will lock the data bus which means all the cores will be paused to wait for it. In my previous project, when we disable the perf counters(which use the interlock operation internal), we almost get 40% latency improvement.

@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/5311/
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/5313/
Test PASSed.

@robertnishihara
Copy link
Collaborator

Thanks! Looks like there are still some linting errors https://travis-ci.org/ray-project/ray/jobs/377325584.

@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/5324/
Test FAILed.

@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/5331/
Test PASSed.

@eric-jj
Copy link
Contributor Author

eric-jj commented May 12, 2018

All lint errors are fixed.

@pcmoritz pcmoritz changed the title improve shared_ptr usage Improve shared_ptr usage May 12, 2018
@pcmoritz pcmoritz changed the title Improve shared_ptr usage [xray] Improve shared_ptr usage May 12, 2018
@pcmoritz pcmoritz merged commit 71997a4 into ray-project:master May 12, 2018
@eric-jj eric-jj deleted the make_shared branch May 12, 2018 03:21
@robertnishihara
Copy link
Collaborator

Thanks for the improvements!

alok added a commit to alok/ray that referenced this pull request May 14, 2018
* master:
  Create RemoteFunction class, remove FunctionProperties, simplify worker Python code. (ray-project#2052)
  Don't crash on duplicate actor notifications (ray-project#2043)
  Fixed attribute name in code example (ray-project#2054)
  [xray] Add Travis build for testing xray on Linux. (ray-project#2047)
  Added missing comma to code example (ray-project#2050)
  Use more CPUs for testMultipleWaitsAndGets. (ray-project#2051)
  use jobid_nil (ray-project#2044)
  Fix typo in tune. (ray-project#2046)
  Fix error in api.rst. (ray-project#2048)
  Improve shared_ptr usage (ray-project#2030)
alok added a commit to alok/ray that referenced this pull request May 15, 2018
* master:
  Create RemoteFunction class, remove FunctionProperties, simplify worker Python code. (ray-project#2052)
  Don't crash on duplicate actor notifications (ray-project#2043)
  Fixed attribute name in code example (ray-project#2054)
  [xray] Add Travis build for testing xray on Linux. (ray-project#2047)
  Added missing comma to code example (ray-project#2050)
  Use more CPUs for testMultipleWaitsAndGets. (ray-project#2051)
  use jobid_nil (ray-project#2044)
  Fix typo in tune. (ray-project#2046)
  Fix error in api.rst. (ray-project#2048)
  Improve shared_ptr usage (ray-project#2030)
alok added a commit to alok/ray that referenced this pull request May 15, 2018
* fix-a3c-torch:
  Fix shape error in conv nets
  Ensure that values are flat list
  rm all use of torch Variables
  Create RemoteFunction class, remove FunctionProperties, simplify worker Python code. (ray-project#2052)
  Don't crash on duplicate actor notifications (ray-project#2043)
  rm unnecessary Variable wrapper
  Fixed attribute name in code example (ray-project#2054)
  [xray] Add Travis build for testing xray on Linux. (ray-project#2047)
  Added missing comma to code example (ray-project#2050)
  Use more CPUs for testMultipleWaitsAndGets. (ray-project#2051)
  use jobid_nil (ray-project#2044)
  Fix typo in tune. (ray-project#2046)
  Fix error in api.rst. (ray-project#2048)
  Improve shared_ptr usage (ray-project#2030)
  replace deprecated function
  Fmt
  Fix shapes of tensors
  Rename argument name to out_size
  Use correct pytorch functions
  Use F.softmax instead of a pointless network layer
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.

4 participants