Problem with parallel and processes
JhonAndersonVelasco opened this issue · 2 comments
Hi
When I try to activate parallel and set processes my terminal goes crazy, every print multiplies itself by number of processes I set.
My code is
ceemd = CEEMDAN()
ceemd.noise_seed(seed=7)
ceemd.parallel = True
ceemd.processes = 4
ceemd.extrema_detection = "parabol"
ceemd.ceemdan(data_np)
IMFs, residue = ceemd.get_imfs_and_residue()
And got in my windows prompt:
[INF] Procesando CEEMDAN [□□□□□□□□■□] [PRG] Desea continuar con esta configuración?:
(Use las teclas direccionales y enter)
[INF] Procesando CEEMDAN [□□□□□□□□□■] [PRG] Desea continuar con esta configuración?:
(Use las teclas direccionales y enter)
[INF] Procesando CEEMDAN [□□□□□□□□■□] [PRG] Desea continuar con esta configuración?:
(Use las teclas direccionales y enter)
[PRG] Desea continuar con esta configuración?:
(Use las teclas direccionales y enter)
[INF] Procesando CEEMDAN [■□□□□□□□□□]
4 times the "INF" print
And with:
ceemd = CEEMDAN()
ceemd.noise_seed(seed=7)
#ceemd.parallel = True
#ceemd.processes = 2
ceemd.extrema_detection = "parabol"
ceemd.ceemdan(data_np)
IMFs, residue = ceemd.get_imfs_and_residue()
I got the expected behavior:
[INF] Procesando CEEMDAN [□□□□■□□□□□]
So, as you can see I get just once "INF" print
Any suggestion?
Thank you
Hey, I'm sorry to say but that isn't enough information for me to check what's going on. By the looks, it seems that you're running some library on top of PyEMD which can parallelize executions. All these [INF] Procesando CEEMDAN
aren't coming from PyEMD so I can't help much.
It might be beneficial to report this issue to whatever you're using on top of python. When you report the issue please point them to these lines in CEEMDAN which show how pools are used here.
Thank you
Well, my complete code is:
hecho = False
def animate(self):
for c in cycle(['[■□□□□□□□□□]', '[□■□□□□□□□□]', '[□□■□□□□□□□]', '[□□□■□□□□□□]', '[□□□□■□□□□□]', '[□□□□□■□□□□]',
'[□□□□□□■□□□]', '[□□□□□□□■□□]', '[□□□□□□□□■□]', '[□□□□□□□□□■]', '[□□□□□□□□■□]', '[□□□□□□□■□□]',
'[□□□□□□■□□□]', '[□□□□□■□□□□]', '[□□□□■□□□□□]', '[□□□■□□□□□□]', '[□□■□□□□□□□]', '[□■□□□□□□□□]']):
if self.hecho:
break
stdout.write('\r [INF] Procesando CEEMDAN ' + c)
stdout.flush()
sleep(0.1)
def get_CEEMD_residue(self,data: pd.DataFrame):
data_np = data.to_numpy()
data_np = data_np.flatten()
IMFs = None
try:
t = Thread(target=self.animate)
t.start()
ceemd = CEEMDAN()
ceemd.noise_seed(seed=7)
#ceemd.parallel = True
#ceemd.processes = 2
ceemd.extrema_detection = "parabol"
ceemd.ceemdan(data_np)
IMFs = ceemd.get_imfs_and_residue()[0]
self.hecho = True
except KeyboardInterrupt:
print('\n\n [INF] Bot terminado!\n')
self.hecho = True
t.join()
print(' Presione una tecla para continuar...\n')
getch()
quit()
except:
self.hecho = True
return IMFs
It's with itertools for make a visual refferencethat CEEMDAN is working, and threading to run it
But if I disable thereading and enable parallel in CEEMDAN I have the same error