-
Notifications
You must be signed in to change notification settings - Fork 8
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
Theano compilelock issues with MultiPool #105
Comments
Perhaps you already know this, but I normally use a hack to set the |
Oh right (and for context, this was an email I got from a user). Do you have an example you could share? |
Something like the following can work: import os
from multiprocessing import Pool
os.environ["THEANO_FLAGS"] = f"compiledir={os.getpid()}"
import theano
import theano.tensor as tt
def func(x):
x_ = tt.dscalar()
return theano.function([x_], [x_ * x_])(x)
if __name__ == "__main__":
with Pool(4) as pool:
print(list(pool.map(func, range(10)))) |
Or... from multiprocessing import Pool
import theano
import theano.tensor as tt
if __name__ == "__main__":
x_ = tt.dscalar()
func = theano.function([x_], [x_ * x_])
with Pool(4) as pool:
print(list(pool.map(func, range(10)))) |
When I add this "os.environ" line to my script, the warning stops keep brushing the screen, and just appears for fixed times (equal to how many processes set in the Pool). However, the code appears to be at a standstill, although the CPU is running. I wait for more than 20 minutes, neither of the processes completes the rejection sampling part. It seems needs quite long time to move to the next step. Still not in parallel? Another strange case is when I set processes equal to 2, the code can run, but it skips the mcmc part. My computer has 10 cores, is it OK if I set processes equal to 4? I also try to open two or three terminals to run a single-process code. It works, but do not save too much time. It seems that the different terminals are not totally in parallel. |
@AstroSong Strange! Could you share a minimum working example script, and send the versions of schwimmbad & thejoker that you are using? What platform are you on? Thanks! python -c "import schwimmbad; print(schwimmbad.__version__)"
python -c "import thejoker; print(thejoker.__version__)" |
@adrn If I use the above second code from @dfm, it works without any warning. But if I use the first code, the warning is still there like follows,
python -c "import schwimmbad; print(schwimmbad.version)" => 0.3.1 In addition, I updated joker before by using the
My numpy version is 1.19.0. |
See email by Song Wang:
throw a warning:
The text was updated successfully, but these errors were encountered: