-
Notifications
You must be signed in to change notification settings - Fork 22
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
Added language standard parallelism to dot product #251
base: main
Are you sure you want to change the base?
Changes from 1 commit
d2ae43f
dfaf869
6574231
b6cb626
c3f4957
2b8f143
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -82,7 +82,7 @@ void add_rank_1( | |||||||||||||||||||||||||
|
||||||||||||||||||||||||||
using size_type = std::common_type_t<SizeType_x, SizeType_y, SizeType_z>; | ||||||||||||||||||||||||||
for (size_type i = 0; i < z.extent(0); ++i) { | ||||||||||||||||||||||||||
z(i) = x(i) + y(i); | ||||||||||||||||||||||||||
z[i] = x[i] + y[i]; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -132,7 +132,7 @@ void add_rank_2( | |||||||||||||||||||||||||
using size_type = std::common_type_t<SizeType_x, SizeType_y, SizeType_z>; | ||||||||||||||||||||||||||
for (size_type j = 0; j < x.extent(1); ++j) { | ||||||||||||||||||||||||||
for (size_type i = 0; i < x.extent(0); ++i) { | ||||||||||||||||||||||||||
z(i,j) = x(i,j) + y(i,j); | ||||||||||||||||||||||||||
z[i,j] = x[i,j] + y[i,j]; | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The actual implementation is a C++17 back-port, so we unfortunately have to roll with whatever operator (parentheses or brackets) the user has available. If you really do want to change the implementation, then we might have to go with something like the following.
Suggested change
or at least
Suggested change
It might be best just to leave the implementation alone; we might want to come up with a better way to do this. |
||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only compile if the C++23 feature "multidimensional subscript operator" (P2128R6) is available. As a result, would you consider one of the following changes?
__cpp_multidimensional_subscript
is defined, OR#define MDSPAN_USE_PAREN_OPERATOR 1
to the example before including anymdspan
headers (see top of https://godbolt.org/z/Yrr8oe9sE for an example of the relevant macros), and use parentheses instead of brackets (e.g.,A(i,j)
)