I have used joblib
module in python 3.6.0
to parallelize my code and ran it on my Linux machine. It has now started the process on 20 threads, as expected. But I am unable to kill all of them at once. For instance, if I kill any of the same 20 processes in matlab
, the whole thing gets killed. Is there any such way in python 3?
EDIT: My code looks something like this
import scipy, numpy # All the required libraries
from joblib import Parallel, delayed
# Required parameters
a=1
b=2 ...
if __name__ == '__main__':
Parallel(n_jobs=20)(delayed(<some_function>)((a,b,j)) for j in range(20))
The some_function
uses the parameters and saves using scipy.savetxt
command.