Why is the python matlab.engine 2-3 times slower when running on another equally powerful cpu?
I am using the matlab engine to convert stimulation patterns of cochlear implants into audio through a vocoder supplied by cochlear ltd from my python code.
My code is quite fast when I run it on my computer, the part that uses the matlab engine runs in about 2 seconds if I use 10 engines in parallel.
Now I tried to run my code in our cluster on a machine with epyc cpus, which are at least as fast as my own computer’s cpu. However, while the rest of my code runs on this cluster computer almost as fast as on my own machine – I see at most an increase by a factor of 1.2 – the matlab.engine part is slowed down by a factor of 2-3, i.e., the same code requires 8-9 seconds instead of 2-3 seconds, which is quite detrimental in a large scale experiment.
The slice of code that uses the matlab.engine, and which slows down on the other machine, is
for i, pred in enumerate(predictions):
original_length = dataset[i][‘length_EP’]
pred = ApplyPostProcessing(pred,original_length)
vocoded_futures[i] = eng_list[i%len(eng_list)].runVocoderPython(matlab.double(pred), nargout=2, background=True)
The "eng_list" variable is just a list of separate matlab engines I use to speed up the processing. "runVocoderPython" is just a wrapper for a matlab function that runs the vocoder.
Does anyone know what could cause this specific slowdown of the matlab.engine?
I use Python 3.8.19, Matlab 2022a and Linux as OS.I am using the matlab engine to convert stimulation patterns of cochlear implants into audio through a vocoder supplied by cochlear ltd from my python code.
My code is quite fast when I run it on my computer, the part that uses the matlab engine runs in about 2 seconds if I use 10 engines in parallel.
Now I tried to run my code in our cluster on a machine with epyc cpus, which are at least as fast as my own computer’s cpu. However, while the rest of my code runs on this cluster computer almost as fast as on my own machine – I see at most an increase by a factor of 1.2 – the matlab.engine part is slowed down by a factor of 2-3, i.e., the same code requires 8-9 seconds instead of 2-3 seconds, which is quite detrimental in a large scale experiment.
The slice of code that uses the matlab.engine, and which slows down on the other machine, is
for i, pred in enumerate(predictions):
original_length = dataset[i][‘length_EP’]
pred = ApplyPostProcessing(pred,original_length)
vocoded_futures[i] = eng_list[i%len(eng_list)].runVocoderPython(matlab.double(pred), nargout=2, background=True)
The "eng_list" variable is just a list of separate matlab engines I use to speed up the processing. "runVocoderPython" is just a wrapper for a matlab function that runs the vocoder.
Does anyone know what could cause this specific slowdown of the matlab.engine?
I use Python 3.8.19, Matlab 2022a and Linux as OS. I am using the matlab engine to convert stimulation patterns of cochlear implants into audio through a vocoder supplied by cochlear ltd from my python code.
My code is quite fast when I run it on my computer, the part that uses the matlab engine runs in about 2 seconds if I use 10 engines in parallel.
Now I tried to run my code in our cluster on a machine with epyc cpus, which are at least as fast as my own computer’s cpu. However, while the rest of my code runs on this cluster computer almost as fast as on my own machine – I see at most an increase by a factor of 1.2 – the matlab.engine part is slowed down by a factor of 2-3, i.e., the same code requires 8-9 seconds instead of 2-3 seconds, which is quite detrimental in a large scale experiment.
The slice of code that uses the matlab.engine, and which slows down on the other machine, is
for i, pred in enumerate(predictions):
original_length = dataset[i][‘length_EP’]
pred = ApplyPostProcessing(pred,original_length)
vocoded_futures[i] = eng_list[i%len(eng_list)].runVocoderPython(matlab.double(pred), nargout=2, background=True)
The "eng_list" variable is just a list of separate matlab engines I use to speed up the processing. "runVocoderPython" is just a wrapper for a matlab function that runs the vocoder.
Does anyone know what could cause this specific slowdown of the matlab.engine?
I use Python 3.8.19, Matlab 2022a and Linux as OS. matlab.engine, python2matlab, python MATLAB Answers — New Questions