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

Replace _build_* by _set_*! #19

Open
sshin23 opened this issue Jun 17, 2022 · 2 comments
Open

Replace _build_* by _set_*! #19

sshin23 opened this issue Jun 17, 2022 · 2 comments
Assignees

Comments

@sshin23
Copy link
Member

sshin23 commented Jun 17, 2022

Currently, we have many functions named _bulid_*. These functions create a block of matrix needed for formulating sparse/dense LQ dynamic problems. However, creating arrays in these functions can later cause issue when we want to extend these to GPU arrays. I suggest doing the following.

All the arrays are created in _build_sparse_lq_dynamic_model and _build_dense_lq_dynamic_model. For the rest of _build_* functions, we create the array in _build_*_lq_dynamic_model, and only update its entries in _set_*!. Ideally, each _set_*! functions should be non-allocating.

@dlcole3
Copy link
Collaborator

dlcole3 commented Jun 23, 2022

@sshin23 In the case of some functions (like _build_H_blocks), I initialize arrays for mul! and axpy!. Is there a way to avoid this memory allocation without defining the arrays outside of the function?

@sshin23
Copy link
Member Author

sshin23 commented Jun 23, 2022

you can create all of them outside of _build_H_blocks. But let's worry about this later

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

No branches or pull requests

2 participants