Skip to content

[FIX] Initialize force_atlas2 old_forces device_uvector, use new rmm::exec_policy#1625

Merged
rapids-bot[bot] merged 6 commits intorapidsai:branch-21.06from
trxcllnt:fix/fa2-uvector
May 27, 2021
Merged

[FIX] Initialize force_atlas2 old_forces device_uvector, use new rmm::exec_policy#1625
rapids-bot[bot] merged 6 commits intorapidsai:branch-21.06from
trxcllnt:fix/fa2-uvector

Conversation

@trxcllnt
Copy link
Collaborator

Fixes an issue where the layout for all points converge to (0,0) when running multiple layout ticks after #1607.

  • Initializes the d_old_forces vector to fix layout issue.
  • Updates to barnes_hut.hpp to use non-deprecated rmm::exec_policy.

@trxcllnt trxcllnt requested a review from a team as a code owner May 25, 2021 23:13
// FA2 requires degree + 1
rmm::device_uvector<int> d_massl(nnodes + 1, stream);
thrust::fill(rmm::exec_policy(stream)->on(stream), d_massl.begin(), d_massl.end(), 1.f);
thrust::fill(rmm::exec_policy(stream), d_massl.begin(), d_massl.end(), 1.f);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Quick question. Never noticed this in earlier reviews of this code.

Is it intentional that we use float for these values when the graph might have float or double input types? Should we be templating these float instances to be weight_t do avoid the loss of value in conversions, or is it really the case that a graph with double weights should be using float for these values being computed?

I don't know enough about the context of this algorithm to know the answer, please enlighten.

Copy link
Collaborator Author

@trxcllnt trxcllnt May 26, 2021

Choose a reason for hiding this comment

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

Looks like edge weights are only used in apply_attraction() which discards the extra precision, so I don't think it matters.

We should be filling with 1 instead of 1.0f though, because d_massl is a device_uvector of integers.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK. We should probably have a bigger conversation about this, but I don't think it should hold up progress here.

Could you add the following circa line 94:

// FIXME: Review whether these should be "float" or "weight_t"

That way we can come back at some point (perhaps when we refactor with the new graph) and revisit this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Two main reasons why I'm against it:

  1. Double-precision arithmetic in the force integration kernels probably isn't worth the performance hit.
  2. A user could accidentally opt in to a much slower implementation by accidentally using FP64 weights.

@codecov-commenter
Copy link

codecov-commenter commented May 26, 2021

Codecov Report

❗ No coverage uploaded for pull request base (branch-21.06@0859228). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 3cff67b differs from pull request most recent head e267545. Consider uploading reports for the commit e267545 to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##             branch-21.06    #1625   +/-   ##
===============================================
  Coverage                ?   59.75%           
===============================================
  Files                   ?       79           
  Lines                   ?     3484           
  Branches                ?        0           
===============================================
  Hits                    ?     2082           
  Misses                  ?     1402           
  Partials                ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0859228...e267545. Read the comment docs.

@BradReesWork BradReesWork added 3 - Ready for Review improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 26, 2021
@BradReesWork BradReesWork added this to the 21.06 milestone May 26, 2021
@trxcllnt trxcllnt requested a review from hlinsen May 26, 2021 17:12
@trxcllnt
Copy link
Collaborator Author

rerun tests

@trxcllnt
Copy link
Collaborator Author

@gpucibot merge

cudaStream_t stream = handle.get_stream();
const edge_t e = graph.number_of_edges;
const vertex_t n = graph.number_of_vertices;
rmm::cuda_stream_view stream(handle.get_stream());
Copy link
Member

Choose a reason for hiding this comment

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

Seems like we should use get_stream_view() for this, no? https://github.com/rapidsai/raft/blob/d5763480b899aa572afa92432fdf5bd6626a98a0/cpp/include/raft/handle.hpp#L102
There are a couple of other occurrences in the PR

@trxcllnt
Copy link
Collaborator Author

@gpucibot merge

1 similar comment
@afender
Copy link
Member

afender commented May 27, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 595d5b2 into rapidsai:branch-21.06 May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants