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

Replace internally developed CSR GEMM with a call to MKL #2959

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Vika-F
Copy link
Contributor

@Vika-F Vika-F commented Oct 28, 2024

  • internally developed GEMM was removed
  • call to MKL's sparse GEMM was added into clusters assignment step in sparse K-means (see assign_clusters kernel)
  • incorrect use of communicator was removed
  • sparse method was aligned with dense method by removing buggy version of handle_empty_clusters kernel from sparse implementation. Now both dense and sparse implementations use the same kernel for empty clusters handling and give the same results on the same input data passed in sparse and dense layout respectively.

PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have added a respective label(s) to PR if I have a permission for that.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
    All the failures in CI are not related to sparse K-means algorithm.
  • I have extended testing suite if new functionality was introduced in this PR.
    No new functionality was introduced.

Performance

  • I have measured performance for affected algorithms using scikit-learn_bench and provided at least summary table with measured data, if performance change is expected.
  • I have provided justification why performance has changed or why changes are not expected.
  • I have provided justification why quality metrics have changed or why changes are not expected.
  • I have extended benchmarking suite and provided corresponding scikit-learn_bench PR if new measurable functionality was introduced in this PR.

@Vika-F
Copy link
Contributor Author

Vika-F commented Oct 31, 2024

/intelci: run

@Vika-F
Copy link
Contributor Author

Vika-F commented Nov 4, 2024

/intelci: run

@Vika-F
Copy link
Contributor Author

Vika-F commented Nov 6, 2024

@Vika-F
Copy link
Contributor Author

Vika-F commented Nov 11, 2024

/intelci: run

@Vika-F Vika-F marked this pull request as ready for review November 12, 2024 08:51
@Vika-F Vika-F requested review from david-cortes-intel and ethanglaser and removed request for samir-nasibli and Alexsandruss November 12, 2024 08:52

const auto distances_ptr = distances.get_data();
// Workaround. Sparse gemm cannot accept transposed dense inputs in oneMKL 2025.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

How will we track this?


const auto finalize_range =
bk::make_multiple_nd_range_2d({ num_clusters, local_size }, { 1, local_size });

// Compute the array of centroids by dividing the respective sums of observations
// by the number of observations in each centroid
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// by the number of observations in each centroid
// by the number of observations in each centroid

Comment on lines 45 to 46
#define INSTANTIATE_SINGLE_NODE(F, M, T) \
template struct ONEDAL_EXPORT infer_ops_dispatcher<dal::detail::data_parallel_policy, F, M, T>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define INSTANTIATE_SINGLE_NODE(F, M, T) \
template struct ONEDAL_EXPORT infer_ops_dispatcher<dal::detail::data_parallel_policy, F, M, T>;
#define INSTANTIATE_NON_DISTRIBUTED(F, M, T) \
template struct ONEDAL_EXPORT infer_ops_dispatcher<dal::detail::data_parallel_policy, F, M, T>;

Maybe that's better? With multi-tile GPUs or single-node multi-GPU setups we would be using spdm on a single node?

@ahuber21
Copy link
Contributor

Thanks for adding extensive & helpful comments!

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

Successfully merging this pull request may close these issues.

3 participants