-
Notifications
You must be signed in to change notification settings - Fork 46
Feature: support multi-dimensional batch calculation[experimental] #1186
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
base: main
Are you sure you want to change the base?
Changes from all commits
8085e5b
73d85c5
234f38d
be44d80
1fd7ed3
45f4d72
06cb330
a4fc01e
118655f
3b41f28
d88db97
1b1190d
21c31c5
6e8c081
0b989b4
14b4039
3338881
01c86a9
7786b0c
5a3f394
2650968
9aaa6bd
e4aa439
237681f
b602f2e
3e79237
8d8d80c
61cfd57
a1331ba
36707d9
9c27e6e
bce908e
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 |
|---|---|---|
|
|
@@ -309,6 +309,36 @@ PGM_API void PGM_dataset_mutable_add_attribute_buffer(PGM_Handle* handle, PGM_Mu | |
| */ | ||
| PGM_API PGM_DatasetInfo const* PGM_dataset_mutable_get_info(PGM_Handle* handle, PGM_MutableDataset const* dataset); | ||
|
|
||
| /** | ||
| * @brief Create a PGM_MultiDimensionalDataset from multiple PGM_ConstDataset instances | ||
| * | ||
| * @param handle | ||
| * @param const_datasets | ||
| * @param n_datasets | ||
| * @return | ||
| */ | ||
| PGM_API PGM_MultiDimensionalDataset* | ||
| PGM_dataset_create_multidimensional_from_const(PGM_Handle* handle, PGM_ConstDataset const** const_datasets, | ||
| PGM_Idx n_datasets); | ||
|
|
||
| /** | ||
| * @brief Get the array pointer from a PGM_MultiDimensionalDataset | ||
| * | ||
| * @param handle | ||
| * @param multidimensional_dataset | ||
| * @return | ||
| */ | ||
| PGM_API PGM_ConstDataset const* | ||
| PGM_get_array_pointer_from_multidimensional(PGM_Handle* handle, | ||
| PGM_MultiDimensionalDataset const* multidimensional_dataset); | ||
TonyXiang8787 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @brief destroy the multidimensional dataset object | ||
| * | ||
| * @param multidimensional_dataset | ||
| */ | ||
| PGM_API void PGM_destroy_multidimensional_dataset(PGM_MultiDimensionalDataset* multidimensional_dataset); | ||
|
Member
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. inconsistent |
||
|
|
||
|
Comment on lines
+312
to
+341
Member
Author
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. @mgovers This is one option to pass a MD datasets into the C-API. You need to have additional helper functions to create an array of datasets. We need a new opaque struct. Another interesting approach would be using chaining. So define a function called
Member
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. i prefer this separate ND approach, but how would we use ND-datasets, e.g. a 3-dimensional one instead of only 2-dimensional
Member
Author
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. It is not really a ND, but a list of datasets. The core will make a cross-join ND calculation of combinations in the list. The questions, do we create separate opaque struct to store an array of datasets? This requires a lot of new functions. Or do we do the chaining, this only needs one new function.
Member
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. i do believe under the current implementation, sure, but it also restricts us going forward. i feel like if we are going to support 1D and have a separate object for 2D, then we might as well go for ND. otherwise, we'll fall into the same rabbit hole that C++ has been in (watch any video on
Member
Author
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 current experiment is about ND, not just 2D. The ND calculation is created by a list of datasets. Each dataset in the list represents the mutation of that dimension. The core creates a cross-join on the mutations. |
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
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.
really useful 👍 If we add an additional
incrementhere, we can actually also use this in the dispatching of multithreaded batch calculationsThere 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.
What do you mean exactly?
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.
i mean that we can do something like
vector<thread> threads{ ranges::transform( IdxView{n_threads}, [](Idx thread_idx) { return dataset.get_slice_scenario(begin + thread_idx, end, n_threads); });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.
I don't think that will work. The multi-threading is not partitioning the output in the way you described. The output buffer is actually divided interwined: 0 for thread 0, 1 for thread 2, 2 for thread 2, N-1 for thread N-1. Then N for thread 0 again.
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.
that's exactly how slicing with a stride works, e.g. (in python):
stridein this case would ben_threads,startwould be0andendwould ben_scenarios