フィルターのクリア

Very slow code run on Linux

26 ビュー (過去 30 日間)
Mohamed AKI Ahmed
Mohamed AKI Ahmed 2023 年 11 月 3 日
回答済み: Udit06 2023 年 11 月 21 日
Hello. I have a large code that I compiled. The code takes around 2 seconds to run on Windows but when running on Linux, it takes over 500 seconds. The code is not too complex by itself, it basically takes some arguments and do some calculations for them (no plots or anything, just a numeric result). I compiled the code on Linux and tried both MCR and MATLAB on the machine but nothing seemed to have the process faster. I'm wondering what could be the solution to this problem as I need to be running the code on Linux for later production. I'm using MATLAB 2021b

回答 (1 件)

Udit06
Udit06 2023 年 11 月 21 日
I understand that your MATLAB program is taking a large amount of time to run in Linux as compared to Windows. As you mentioned that you code is large, to understand which part of the code is consuming the most time, I would recommend you to do code profiling. You can refer to the following MathWorks documentation to understand more about code profiling.
After doing the profiling, you can now pinpoint the bottlenecks that are causing the slowdown. If after profiling you find out that, the slowdown is related to reading a video, you can refer to the following MATLAB answer which deals with a similar issue. Please note this is just an example issue, your case could be different from the one described in the below MATLAB answer. Once you pinpoint which part of your code is creating the slowdown, you can then take action to resolve the same.
Apart from this, I would recommend you to update your MATLAB version since newer versions come with performance enhancements and bug fixes. You can refer to the following MathWorks documentation for any help required for updating the software.
I hope this helps.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by