-
Notifications
You must be signed in to change notification settings - Fork 22
MULTIPLY enable broadcasting #655
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6887fb3
MULTIPLY enable broadcasting
densmirn b66a4e8
Add gtests for broadcast iterator
densmirn 052a307
Expand memory free before broadcasting
densmirn 6f6f9ed
Disable broadcasting in element-wise operations
densmirn bc0c1f7
Change docs for 2 DPNPC_id methods
densmirn 257700d
Merge branch 'master' of https://github.com/IntelPython/dpnp into fea…
densmirn 7f2e8e2
Change memory free call before broadcasting
densmirn 0731675
Enable gtests on broadcasting on GPU
densmirn da181e2
Enable broadcasting in element-wise operations
densmirn 3b30fb6
Merge branch 'master' of https://github.com/IntelPython/dpnp into fea…
densmirn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <iostream> | ||
#include <vector> | ||
|
||
#include "dpnp_iterator.hpp" | ||
|
||
using namespace std; | ||
using dpnpc_it_t = DPNPC_id<size_t>::iterator; | ||
using dpnpc_value_t = dpnpc_it_t::value_type; | ||
using dpnpc_index_t = dpnpc_it_t::size_type; | ||
|
||
template <typename _DataType> | ||
vector<_DataType> get_input_data(const vector<dpnpc_index_t>& shape) | ||
{ | ||
const dpnpc_index_t size = accumulate(shape.begin(), shape.end(), dpnpc_index_t(1), multiplies<dpnpc_index_t>()); | ||
|
||
vector<_DataType> input_data(size); | ||
iota(input_data.begin(), input_data.end(), 1); // let's start from 1 to avoid cleaned memory comparison | ||
|
||
return input_data; | ||
} | ||
|
||
template <typename _DataType> | ||
_DataType* get_shared_data(const vector<_DataType>& input_data) | ||
{ | ||
const size_t data_size_in_bytes = input_data.size() * sizeof(_DataType); | ||
_DataType* shared_data = reinterpret_cast<_DataType*>(dpnp_memory_alloc_c(data_size_in_bytes)); | ||
copy(input_data.begin(), input_data.end(), shared_data); | ||
|
||
return shared_data; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
No needed here.
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.
Needed, we are responsible for destructing placed objects.
Uh oh!
There was an error while loading. Please reload this page.
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.
These are obvious things that you are saying, but a little bit not about that.
The comment was not about freeing resources in general, it is about that we should avoid such explicitly call the destructor.
I see that current iterator implementation has flaws, updates for to the iterator interface are required for this.
In anyway this is not the current PR problem.