-
Notifications
You must be signed in to change notification settings - Fork 2
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
created and tested bindings for hyperreduction #7
Conversation
…ments from input argument list.
Based on the pybind11 documentation, copy is the default action for STL-type arguments. This means that input/output variables of type @chldkdtn , do you have an idea about the typical size of |
This is for a future reference. If we do not want to have the 'out-of-box' copy action for |
Ideally, we do not want it to be big because the whole purpose of the hyper-reduction is to be able to represent a big size of nonlinear vector function with a small number of samples, say 50 or 100 (or perhaps in worst case 1000 at maximum). By the way, this deep copy is only for the output index only, right? which will be part of offline training cost. This should be okay for now, but let's keep it in mind so that in the future, in the context of "on-the-fly," we might need to avoid deep copy to make the efficiency optimized. |
Created bindings for the following classes in hyper reduction module:
In these classes a key modification has been made to the init_samples parameter. The input argument std::vector *init_samples cannot have a default value nullptr, so, we switched it into std::vector &, and set the default value to be std::vector(0) (Note: These changes doesn't impact the internal execution). Further more another key modification is made to the parameters f_sampled_row, f_sampled_rows_per_proc, and t_samples which were originally passed as input arguments. As these arguments f_sampled_row, f_sampled_rows_per_proc, and t_samples are STL-type output variables, which cannot change its value if it is passed as an input argument. Therefore it is removed from the input argument list, and the python function returns these variables as tuple if necessary. |
S_OPT
The input argument
std::vector<int> *init_samples
cannot have a default valuenullptr
. See the pybind11 documentation.Although,
init_samples
needs not be a pointer inS_OPT
implementation. Therefore, we switched it intostd::vector<int> &
, and set the default value to bestd::vector<int>(0)
. This does not impact the internal execution.The arguments
f_sampled_row
andf_sampled_rows_per_proc
are STL-type output variables, which cannot change its value if it is passed as an input argument. Therefore it is removed from the input argument list, and the python function return these two variables as tuple:Note that
Matrix& f_basis_sampled_inv
is both input and output, and it is not a STL-type. This allows us passing it as an input argument which can modify its value within the function.