-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
restrict map_rect to legal data-only args #441
Comments
This is for MPI or any map_rect case? Also tagging @wds15 |
Only mpi needs these additional restrictions. |
I just want to point out that our user doc does correctly state the additional restrictions which we need for map_rect when used with MPI: https://mc-stan.org/docs/2_21/stan-users-guide/map-function.html The thing is that for MPI we call "data" something which never changes throughout program execution - that is different as compared to calling "data" something which we do not autodiff. The crux with the example above is that when MPI is not used (no threading on or we use threading), then The GPU caching facilities should be affected by these issues as well. FIY, we decided during the development of The hardest thing with this parser "bug" is to not restrict map_rect too much since the additional requirements are really only applicable to MPI which is probably anyway not getting used so much any longer given that the Intel TBB is far easier to deploy, run & there are no more speed penalties for using threading compared to MPI (these went away with the TLS refactor and the use of the TBB). So before putting additional constraints on the usability, we should consider to build into the |
Yes, the way the GPU caching was done initally was affected by the same issue. But we removed that after a month or so as Sean pointed out this problem. In order to leave data on the GPU and not copy it each iteration, we then modified stanc3. Stanc3 now copies all the We could add the MPI restrictions to the stanc3 compiler in a similar way as for OpenCL. When you call the compierl with --use-opencl those checks and moves are then. So we could also do --use-mpi here. The only problem would be if someone created the .hpp file without STAN_MPI and then compiled the model with the flag. That could be solved by adding make/local to the .hpp file dependency that would for a rerun of stanc3. So we could move the data to the MPI nodes in the same way (its much more clean that any sort of caching), as long as we have the restriction that it can only be used by |
Thanks @rok-cesnovar ...it does make sense from what you write. I would need to dig into the material you link...can do that later. ... but in all honesty... I am challenging a little bit if it is really worth all the effort for a feature like |
Yeah, it might not be biggest priority, but I think it should bit fixed. It would also simplify the map_rect MPI code in Math. I am going to have to get deeper in stanc3 stuff anyways for our OpenCL backend, so I can also tackle this one once I gather enough knowledge. |
The following program should not compile because
xi[i]
isn't an entirely data-only expression. The valuexi
is a data variable, but the indexi
is local. That allows illegal programs like this to get compiled:These will produce different results with MPI turned on and turned off, which we don't ever want to happen.
The text was updated successfully, but these errors were encountered: