Tensorflow and Multiprocessing: Passing Sessions
<p>I have recently been working on a project that uses a neural network for virtual robot control. I used tensorflow to code it up and it runs smoothly. So far, I used sequential simulations to evaluate how good the neural network is, however, I want to run several simulations <strong>in parallel</strong> to reduce the amount of time it takes to get data.</p>

<p>To do this I am importing python's <code>multiprocessing</code> package. Initially I was passing the sess variable (<code>sess=tf.Session()</code>) to a function that would run the simulation. However, once I get to any statement that uses this <code>sess</code> variable, the process quits without a warning. After searching around for a bit I found these two posts:
<a href="https://stackoverflow.com/questions/34900246/tensorflow-passing-a-session-to-a-python-multiprocess">Tensorflow: Passing a session to a python multiprocess</a>
and <a href="https://stackoverflow.com/questions/33758669/running-multiple-tensorflow-sessions-concurrently">Running multiple tensorflow sessions concurrently</a></p>

<p>While they are highly related I haven't been able to figure out how to make it work. I tried creating a session for each individual process and assigning the weights of the neural net to its trainable parameters without success. I've also tried saving the session into a file and then loading it within a process, but no luck there either.</p>

<p>Has someone been able to pass a session (or clones of sessions) to several processes?</p>

<p>Thanks.</p>