How do I use multiple cpu when doing loop which I have shown in a script below. I am trying to use several cpus to get a faster build of a model.
Knut J
rom modeller import * from modeller.automodel import * from modeller.parallel import *
env = environ()
j= job() j.append(local_slave()) #cpu 1 j.append(local_slave()) #cpu 2 j.append(local_slave()) #cpu 3 j.append(local_slave()) #cpu 3
j.start()
class Model(automodel): def select_atoms(self): return selection(self.residue_range('1:','180:'))
a=Model(env,alnfile='hNaa10p.ali', knowns='2OB0', sequence='hnaa10', assess_methods=assess.DOPE)
a.starting_model=1 a.ending_model=200 a.use_parallel_job(j) a.make()
# Get a list of all successfully built models from a.outputs ok_models = filter(lambda x: x['failure'] is None, a.outputs)
# Rank the models by DOPE score key = 'DOPE score' ok_models.sort(lambda a,b: cmp(a[key], b[key]))
# Get top model m = ok_models[0] print "Top model: %s (DOPE score %.3f)" % (m['name'], m[key])