google-research / torchsde

Differentiable SDE solvers with GPU support and efficient sensitivity analysis.
Apache License 2.0
1.56k stars 195 forks source link

Performance Improvement Inquiry: Experiencing Slow Execution with TorchSDE #141

Closed wyl010607 closed 11 months ago

wyl010607 commented 11 months ago

Dear Developers,

I hope this message finds you well. I am reaching out to bring to your attention an issue I have been facing while working with TorchSDE, and to seek possible resolutions to optimize its performance.

I have been utilizing TorchSDE to build my NSDE in my project, and have noticed that the execution time is considerably slow. I am wondering if there are any recommended practices or optimizations that can be applied to improve the execution speed of TorchSDE. I am open to exploring different configurations or any other suggestions you might have to address this issue.

Here are some specifics regarding my setup:

Thank you for your time and consideration. I am looking forward to hearing from you at your earliest convenience.

Warm regards, yl wang

wyl010607 commented 11 months ago

Dear Developers,

I have identified the cause of the issue. In the sdeint function, I changed the ts parameter to range(1, 500) while retaining the default value for dt. When I set dt to 1, the execution time improved to an acceptable level. I would like to know if this adjustment is appropriate.

patrick-kidger commented 11 months ago

Yes, that's reasonable.

If performance is important to you then you might also like to try Diffrax, which is a spiritual successor to torchsde and should be even faster.