-
Notifications
You must be signed in to change notification settings - Fork 109
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
mul!()
of LazyProduct
result in high alloc in integration
#333
Comments
Speculate that adding fields of |
mul!()
of LazyProduct result in high alloc in integration
mul!()
of LazyProduct result in high alloc in integrationmul!()
of LazyProduct
result in high alloc in integration
As a test add
Now the alloc is irrelevant with the integration time
|
Yes, that One issue here is that the data type of the This issue is actually a bit tricky as it means you need to take into account the type of That said, the current version of the code (on master) doesn't respect the data type either. So what you're doing is definitely an improvement, and we could leave the data type issue for another time. Would you like to open a PR with the changes you suggest above? |
OK, I’ll open a PR. But I’m new in programming, may take some time to know how to use GitHub PR. |
After setup for a whole night, I find out that I have no permission.😂😂 |
@Lightup1 that's not how you submit a PR... you need to fork the repository. See for example this guide: https://code.tutsplus.com/tutorials/how-to-collaborate-on-github--net-34267 |
Oh, thank you. Got it!😅 |
An alternative is to use caching to handle the tmp vectors, like in this PR. We could use the same cache in LazyProduct and LazyTensor (which is also a kind of lazy product operator). I thought about using the approach described here, but it does seem a bit much to put all possible intermediate types (those for kets, bras, and operators!) in the operator struct. A third way is to put a cache in the operator struct. That way only needed arrays get created and the memory is freed when the operator is garbage-collected. |
Thanks for your suggestions.
I wonder how we define the type of cache since it can be |
Yes, the typing issue is a little tricky, also because element types can vary, as @david-pl points out above. It may not be too terrible to use abstract types, such as an appropriate union, or even Any, as is used in the global cache of the PR I linked. There doesn't seem to be a significant performance hit in cases I have tested. |
tmp1
andtmp2
can cause high alloc when the integration tspan is large.The text was updated successfully, but these errors were encountered: