- brainpy.running.process_pool_lock(func, all_net_params, nb_process)#
Run multiple models in multi-processes with lock.
Sometimes, you want to synchronize the processes. For example, if you want to write something in a document, you cannot let multi-process simultaneously open this same file. So, you need add a lock argument in your defined func:
def some_func(..., lock, ...): ... do something .. lock.acquire() ... something cannot simultaneously do by multi-process .. lock.release()
In such case, you can use process_pool_lock() to run your model.