def Interpol(self): APP.startWorkers() if "TEC" in self.DicoFile0["SmoothMode"]: TECArray = NpShared.ToShared("%sTECArray" % IdSharedMem, self.DicoFile0["SolsTEC"]) CPhaseArray = NpShared.ToShared("%sCPhaseArray" % IdSharedMem, self.DicoFile0["SolsCPhase"]) nt, nd, na = TECArray.shape iJob = 0 for it in range(nt): APP.runJob("InterpolTECTime_%d" % iJob, self.InterpolTECTime, args=(it, )) #,serial=True) iJob += 1 workers_res = APP.awaitJobResults("InterpolTECTime*", progress="Interpol TEC") iJob = 0 for it in range(nt): APP.runJob("InterpolAmpTime_%d" % iJob, self.InterpolAmpTime, args=(it, )) #,serial=True) iJob += 1 workers_res = APP.awaitJobResults("InterpolAmpTime*", progress="Interpol Amp") # APP.terminate() APP.shutdown() Multiprocessing.cleanupShm()
def killWorkers(self): print("Killing workers", file=log) APP.terminate() APP.shutdown() Multiprocessing.cleanupShm()
opt.add_option_group(group) options, arguments = opt.parse_args() return options if __name__ == "__main__": options = read_options() print >> log, "Clear shared memory" if options.ID is not None: NpShared.DelAll(options.ID) else: NpShared.DelAll() Multiprocessing.cleanupStaleShm() Multiprocessing.cleanupShm() ll = glob.glob("/dev/shm/sem.*") print >> log, "Clear Semaphores" # remove semaphores we don't have access to ll = filter(lambda x: os.access(x, os.W_OK), ll) ListSemaphores = [".".join(l.split(".")[1::]) for l in ll] _pyGridderSmear.pySetSemaphores(ListSemaphores) _pyGridderSmear.pyDeleteSemaphore(ListSemaphores) print >> log, "Clear shared dictionaries" ll = glob.glob("/dev/shm/shared_dict:*") ll = filter(lambda x: os.access(x, os.W_OK), ll) for f in ll:
def killWorkers(self): print >> log, "Killing workers" APP.terminate() APP.shutdown() Multiprocessing.cleanupShm()
def InterpolParallel(self): Sols0 = self.Sols nt, nch, na, nd, _, _ = Sols0.G.shape log.print(" #Times: %i" % nt) log.print(" #Channels: %i" % nch) log.print(" #Antennas: %i" % na) log.print(" #Directions: %i" % nd) # APP.terminate() # APP.shutdown() # Multiprocessing.cleanupShm() APP.startWorkers() iJob = 0 # for iAnt in [49]:#range(na): # for iDir in [0]:#range(nd): if "TEC" in self.InterpMode: #APP.runJob("FitThisTEC_%d"%iJob, self.FitThisTEC, args=(208,)); iJob+=1 self.TECArray = NpShared.ToShared( "%sTECArray" % IdSharedMem, np.zeros((nt, nd, na), np.float32)) self.CPhaseArray = NpShared.ToShared( "%sCPhaseArray" % IdSharedMem, np.zeros((nt, nd, na), np.float32)) for it in range(nt): # for iDir in range(nd): APP.runJob("FitThisTEC_%d" % iJob, self.FitThisTEC, args=(it, )) #,serial=True) iJob += 1 workers_res = APP.awaitJobResults("FitThisTEC*", progress="Fit TEC") if "Amp" in self.InterpMode: for iAnt in range(na): for iDir in range(nd): APP.runJob("FitThisAmp_%d" % iJob, self.FitThisAmp, args=(iAnt, iDir)) #,serial=True) iJob += 1 workers_res = APP.awaitJobResults("FitThisAmp*", progress="Smooth Amp") if "PolyAmp" in self.InterpMode: for iDir in range(nd): APP.runJob("FitThisPolyAmp_%d" % iJob, self.FitThisPolyAmp, args=(iDir, )) iJob += 1 workers_res = APP.awaitJobResults("FitThisPolyAmp*", progress="Smooth Amp") if "Clip" in self.InterpMode: for iDir in range(nd): APP.runJob("ClipThisDir_%d" % iJob, self.ClipThisDir, args=(iDir, ), serial=True) iJob += 1 workers_res = APP.awaitJobResults("ClipThisDir*", progress="Clip Amp") #APP.terminate() APP.shutdown() Multiprocessing.cleanupShm()