Bases: pylada.process.jobfolder.JobFolderProcess
Executes folder in child processes.
Much as its base class, JobFolderProcess, this process specialization is intended to run jobs in a jobfolder in parallel [*]. However, it allows to customize the number of processors dedicated to each job, rather than use the same number of processors for each job.
The customization is done via the function processalloc. It takes one argument, the executable jobfolder, and returns an integer signifying the requested number of processors.
def processalloc(folder):
return (len(folder.structure) // 2) * 2
process = PoolProcess(jobfolder, outdir='here', processalloc=processalloc)
process.start(comm)
try: process.wait()
except Fail: pass
The interface is much the same as any other process. However, it takes as argument this processalloc function, on top of the jobfolder itself. In this case, each folder will be launched with approximately as many processors as there are atoms in the structure [†].
Once it is launched, the PoolProcess instance will attempt to run as many jobs as possible in parallel, until there it runs out of processors to allocate. Howe many processors, and which machines, is determined by the communicator passed to start(). Each time an executable folder is finished [‡], it tries again to pack jobs into the available processor pool.
Note
Upon failure, Fail is raised only once all the folders have been executed, not when the failure is detected.
[*] | Several job-folders are executed simultaneously, not withstanding the possibility that each of these is also executed in parallel via MPI. |
[†] | Apparently, this is a pretty good rule-of-thumb for VASP calculations. |
[‡] | More, specifically, each time poll() is called. |
Initializes a process.
Parameters: |
|
---|
Determines number of processors to allocate to each job.
This is a function which takes a JobFolder instance and returns an integer.
Updates list of jobs.
Adds jobfolders which are not in self.jobfolder but in the input. Deletes those which in self.jobfolder but not in the input. Does nothing if job is currently running. Finished jobs are not updated. If deleteold is True, then removed finished jobs from job-folder.
Processes jobfolder from root, even if passed a child folder.