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

Add sparse matrix usage to example #13

Merged
merged 8 commits into from
Jan 20, 2025

Conversation

Xewar313
Copy link
Contributor

No description provided.

Copy link
Contributor

@lslusarczyk lslusarczyk left a comment

Choose a reason for hiding this comment

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

great, this is what we wanted

a few cosmetic comments below

b.push_back(i);
}

dr::mp::broadcasted_vector<double> broadcasted_b;
Copy link
Contributor

Choose a reason for hiding this comment

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

In lines 26-31 all ranks already computed their vector B

What is the step with "broadcasted_vector" for?

src/example7.cpp Outdated

std::vector<double> b;
b.reserve(matrix.shape().second);
std::vector<double> res(matrix.shape().first);
Copy link
Contributor

Choose a reason for hiding this comment

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

please move "res" declaration just before its first usage (calling gemv)

src/example7.cpp Outdated
std::vector<double> b;
b.reserve(matrix.shape().second);
std::vector<double> res(matrix.shape().first);
for (auto i = 0; i < matrix.shape().second; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use std::iota?

}
for (auto i = 0; i < nnz; i++) {
colInd[i] =
(i % 2) * (std::max(i / 2, 1)); // column on 0 and diagonal (with
Copy link
Contributor

Choose a reason for hiding this comment

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

can we draw that matrix in a comment?
something like this (not sure if this is your matrix shape, just an example)

// X X X ...     X
// 0 X 0 ...     0
// 0 0 X 0 ... 0
// 0 0 ...       X

dr::mp::csr_eq_distribution<V, I, dr::mp::MpiBackend>>
matrix(local_data, root);

std::vector<double> b;
Copy link
Contributor

Choose a reason for hiding this comment

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

same comments an in the first example in this code

@lslusarczyk lslusarczyk reopened this Jan 20, 2025
@Xewar313 Xewar313 merged commit 1cd12dc into oneapi-src:main Jan 20, 2025
2 checks passed
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.

2 participants