# What are the negative side effects of releasing theano compiler lock by deleting the lock\_dir?

**URL:** <https://discourse.pymc.io/t/what-are-the-negative-side-effects-of-releasing-theano-compiler-lock-by-deleting-the-lock-dir/7875>\
**Category:** Questions\
**Tags:** theano\
**Created:** [August 11, 2021, 9:15am UTC](https://discourse.pymc.io/t/what-are-the-negative-side-effects-of-releasing-theano-compiler-lock-by-deleting-the-lock-dir/7875 "2021-08-11T09:15:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mar-ses](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mar-ses/32/4301_2.png) [@mar-ses](https://discourse.pymc.io/u/mar-ses)\
**Post date:** [August 11, 2021, 9:15am UTC](https://discourse.pymc.io/t/what-are-the-negative-side-effects-of-releasing-theano-compiler-lock-by-deleting-the-lock-dir/7875/1 "2021-08-11T09:15:16Z")

</div>

I’m trying to run pymc3 models in multiprocess, but I often lose time on the theano compiler waiting for another process’s lock. Here is an example of the logging message this causes:

`INFO (theano.gof.compilelock): Waiting for existing lock by process '21774' (I am process '29874')`  
`INFO (theano.gof.compilelock): To manually release the lock, delete /home/markosestovic/.theano/compiledir_Linux-4.14-el7.centos.x86_64-x86_64-with-centos-7.6.1810-Core-x86_64-3.6.5-64/lock_dir`

The second message suggests I can get around this by deleting the lock\_dir. But I wanted to check first what possible negative side effects I could cause by doing this.

My understanding is that this is related to theano caching the compiled C code for a model definition. I don’t think I need to reuse compiled code; every new process uses new data (of a different length) so I think in the end it needs to be recompiled (I’m not sure how much of it can be reused, even though the models are all of the same form).

What I dont’ want to happen is that if I do this too fast, the next process might delete the compiled code for the model in the previous process. Is this a possibility?

---

<div class="post-metadata">

**Author:** ![Mcb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcb/32/2274_2.png) [@Mcb](https://discourse.pymc.io/u/Mcb)\
**Post date:** [August 12, 2021, 12:08pm UTC](https://discourse.pymc.io/t/what-are-the-negative-side-effects-of-releasing-theano-compiler-lock-by-deleting-the-lock-dir/7875/2 "2021-08-12T12:08:09Z")

</div>

There’s none which is serious from my experience.  
At most, it might kill the execution of the model (assuming you do it while running).

---

<div class="post-metadata">

**Author:** ![mar-ses](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mar-ses/32/4301_2.png) [@mar-ses](https://discourse.pymc.io/u/mar-ses)\
**Post date:** [August 13, 2021, 1:36pm UTC](https://discourse.pymc.io/t/what-are-the-negative-side-effects-of-releasing-theano-compiler-lock-by-deleting-the-lock-dir/7875/3 "2021-08-13T13:36:15Z")

</div>

Any idea which cases it would kill the execution of the model? That would ruin the point a bit; the whole idea is that I would have several processes trying to run samplers/MAP at the same time, and I don’t want them waiting in a queue to compile their models.

Also, is there way to “catch” when this warning pops up? Or should I just check if the lock\_dir exists and delete it blindly?

It seems like a weird mechanic, why can’t theano compile multiple models at the same time?

---

<div class="post-metadata">

**Author:** ![josemrodriguezf](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/josemrodriguezf/32/4471_2.png) [@josemrodriguezf](https://discourse.pymc.io/u/josemrodriguezf)\
**Post date:** [March 2, 2022, 11:52pm UTC](https://discourse.pymc.io/t/what-are-the-negative-side-effects-of-releasing-theano-compiler-lock-by-deleting-the-lock-dir/7875/4 "2022-03-02T23:52:31Z")

</div>

Did you find a salution I want theano to compile multiple models at the same time
