-
Notifications
You must be signed in to change notification settings - Fork 62
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
Hotfix for second order update in travel time #35
Hotfix for second order update in travel time #35
Conversation
Thanks for this, I will have a look as soon as I can. |
Thanks for this, I needed a reminder to get back to this, sorry for the dead air from me. I will find some time in this quarantine life to work on this pull request and get an update out. Can you explain the rationale of the GIL release? Within the FMM algorithm, I think the points need to be calculated in specific order to maintain causality. So multi-threading would not speed up this algorithm as far as I understand. Does you GIL modification here have another effect? Does it allow more than one simultaneous call to these functions? If so, did you test it and is it faster? |
Hi, it's completely unrelated to the previous fix, I pushed on the wrong branch which updated the pull request. Sorry about that. Anyway, the GIL release is not to parallelize a single call to the marcher, which is indeed not parallelizable, but is useful to allow n threads to call the library concurrently. Here a small example of what I mean, https://pastebin.com/ZG7Jybey. With this commit the threaded and the multiprocess versions take a similar amount of time (on my machine 10s v 30s for the serial calls), while your version should perform better only on multiprocess. (Can you please confirm this? I wrote this specific test after the commit and didn't test it on your version) The real issue with GIL release is that we should not touch the python resources afterwards, as it could cause race condition or similar problems. Though, from what I saw in the code, this should not happen (the python variables passed as args to the functions are used as read only, and I release the GIL after the result allocation), and the extremely limited testing I've done seems to work just fine. Again, I didn't intend to update the pull request, both because it is unreleated to the pull request itself, and because some more testing is probably necessary and I am not 100% sure of the inherent correctness of releasing the GIL. |
OK, what you say makes sense, thanks for the detailed reply. I agree that it should be OK to call from multiple threads simultaneously. I will look at the original changes now and I can get to checking the threading situation next. |
OK, thanks again for the time you put into fixing this and sorry that I sat on it for so long. I merged this into the branch then into master. I reverted the GIL stuff for now. It would be great if you could create another PR for that. I am glad to cross these issue of after many years. I will ask a few other people to test and I will get a new release out. |
I am still getting a negative discriminant error with the 'travel_time' function. Has there been any recent attempts to address this issue? |
|
Hi Alec, thanks for the message, what version are you using? Have you tried the most recent master from github? We just put out some changes that may affect this behavior. |
Hi Jason, I use conda and installed scikit fmm a while ago, version 2019.1.30. Sorry for the stupid question, but how would I implement the fix using anaconda?
Thanks,
Alec
…Sent from my iPhone
On Jun 4, 2020, at 5:42 AM, Jason Furtney ***@***.***> wrote:
Hi Alec, thanks for the message, what version are you using? Have you tried the most recent master from github? We just put out some changes that may affect this behavior.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
To test the latest you would need to build the module from source. I am planning to push a new release out soon and the anaconda packages should update automatically. In the example you posted I cannot run it to see what happens. Can you create a stand alone example with everything to reproduce the problem? I can test the latest version to see if it fixes the problem. |
I will try to put it all in a self contained example. The script calls upon a lot of functions before hand, so it may take a little bit of time. I will also try building from the source.
Thanks.
…Sent from my iPhone
On Jun 4, 2020, at 8:12 AM, Jason Furtney ***@***.***> wrote:
To test the latest you would need to build the module from source. I am planning to push a new release out soon and the anaconda packages should update automatically. In the example you posted I cannot run it to see what happens. Can you create a stand alone example with everything to reproduce the problem? I can test the latest version to see if it fixes the problem.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Also, is there documentation for building this from github? I looked at the docs, but didn’t see anything about it.
Thanks,
Alec
…Sent from my iPhone
On Jun 4, 2020, at 8:39 AM, Alec Carruthers ***@***.***> wrote:
I will try to put it all in a self contained example. The script calls upon a lot of functions before hand, so it may take a little bit of time. I will also try building from the source.
Thanks.
Sent from my iPhone
>> On Jun 4, 2020, at 8:12 AM, Jason Furtney ***@***.***> wrote:
>>
>
> To test the latest you would need to build the module from source. I am planning to push a new release out soon and the anaconda packages should update automatically. In the example you posted I cannot run it to see what happens. Can you create a stand alone example with everything to reproduce the problem? I can test the latest version to see if it fixes the problem.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hi, there are build instructions in the github readme. Good point that there is nothing in the docs about actually building the code. I will update that. |
Hi Jason,
That was a premature question as the build process was fairly easy.
- Git clone
- cd scikit-fmm
- python prepare.py ...
and then it was good to go. It seemed to resolve the issue of giving a
negative discriminant; however, I have received different results to what
was obtained on the same inputs using a MATLAB algorithm. I know you didn't
work on the MATLAB algorithm, but to the best of your knowledge, should
this be expected?
Thanks,
Alec
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Fri, Jun 5, 2020 at 7:59 AM Jason Furtney ***@***.***> wrote:
Hi, there are build instructions in the github readme. Good point that
there is nothing in the docs about actually building the code. I will
update that.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM6D33JXDIYZCG2NJIEYKFTRVEB53ANCNFSM4KPT5YKQ>
.
|
Hard to say without seeing any results. Can you post an example along with the MATLAB results? |
@aleccarruthers Might be able to help with the comparison to MATLAB. Found good agreement between scikit-fmm (this) and imsegfmm (MATLAB). |
According to many sources, starting from wikipedia Eikonal equation to some research papers and PhD thesis, in case the discriminant is less than 0 one should try the updates with one dimension less and select the minimum. This is not happening on master branch, and in travel-time-fix only the 1D dimension is used as fallback.
The code with this pull request does the dimensionality decrease in the generic n-D case, falling back to (n-1)-D, and so on.
This commit is only partial and has two main issues.
From my tests this fixes the issues #28 and #18 .