Same script, faster execution when running in a spawned instance ("!matlab ...")?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear Community,
I am running Matlab 2024b under Windows 10 / 32GB RAM on a 6-core laptop Intel CPU (hyperthreading deactivated). For the sake of runtime optimisation I have done the following comparison:
case #1: a script running within the current Matlab session (single instance) and
case #2: the same script running in a spawned session (instance), using "!matlab -nosplash -desktop -r "load ..." (etc.).
The runtime results are as follows:
script #1 finished in about an hour, total CPU load ~50% at boost clock (single Matlab instance)
script #2 finished in about HALF an hour (!), similar total CPU load ~50% at boost clock; main Matlab instance idle (~0%), spawned instance ~40%
I muss admit I do not understand the results: why does a spawned Matlab instance (i.e. two instances running in parallel: main/idle and active) complete the task in half of the time, compared to a single instance?
What might be the reason for this behavior?
Thanks a lot in advance!
Marek
5 comentarios
Sam Marshalik
el 5 de Mayo de 2025
It sounds like both instances of MATLAB are using similar hardware resources. I'd suggest to test the following:
- Run "!matlab -nosplash -desktop -r "load ..." (etc.)" outside of MATLAB and just via Command Prompt. I do not think running this in MATLAB should cause any difference vs. running this via command line. Is performance similar to that of kicking it out of MATLAB? You will want to use -nodesktop, though.
- Try profiling both the interactive and the command line running instances to see where the time is spent. Is some particular part of the code taking longer to run?
Respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!