I have a piece of python code that runs on a single machine with multiprocessing.Pool
for lots of independent jobs. I wonder if it's possible to make it even more parallel on a SGE grid, e.g., each node of the grid runs multiple threads for these independent jobs.
Originally, I have:
# function def
# some_function(param1, param2, param3, process_index)
func = functools.partial(some_function, file_list, param1, param2, param3)
pool = multiprocessing.Pool(processes=some_integer)
ret_list = pool.map(func, range(processes))
pool.close()
It seems to be working fine on a local machine, but if submitted onto a SGE grid as is, it indeed quit abnormally without spitting an error message. The submission command may look like this:
qsub -V -b yes -cwd -l h_vmem=10G -N jobname -o grid_job.log -j yes "python worker.py"
Ideally, I'm looking for minimum changes to the local version of python code so that it can be run on SGE grid, because it's hard to install new tools on the grid or change any grid configurations without affecting other users.
On the minimum, I understand it's possible to just rewrite the code such that the processing of each of the jobs (a file in file_list
) is handled by one qsub command. But I wonder what the best practice is.