Linux x64 下 Matlab R2013a 300 kb 脚本文件调试的 CPU 占用过高问题的解决办法
(1) 系統(tǒng)+軟件版本
???? CentOS 6.5 (Final), 64 位,內(nèi)核initramfs-2.6.32-431.5.1.el6.x86_64,
???? MATLAB Version: 8.1.0.604 (R2013a)
???? Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
(2) 問題描述
???? 通常在這個環(huán)境下,小文件的代碼都可以調(diào)試通過.
???? 最近,把所有函數(shù)集合到一個M文件(332.4 kb),只是簡單地設(shè)置了幾個斷點, 運行到斷點位置再停止運行, cpu和內(nèi)存占用都還算正常.
???? 但接下來對m文件的編輯就開始變得非常慢, 甚至是只添加幾個單詞就會卡住, 一直沒有響應, 內(nèi)存占用不變, 而1/4核CPU的占用高達100%, 只能從系統(tǒng)監(jiān)視器里殺死進程.?
???? 我猜想, Matlab對M文件大小的支持,是不是非常有限? 子函數(shù)版本太多也是罪過,想著集成起來可以方便調(diào)用和標注,沒想到弄巧成拙了...
?
(3) 解決辦法
找到兩個解決辦法.
一是使用 '-singleCompThread' 參數(shù)啟動matlab. 親測可用. 調(diào)試編輯都和原來基本一樣, 不再卡頓了. 這要感謝水木網(wǎng)友 @RSVP 的耐心解答.
[usr@usr ~]$ matlab -helpUsage: matlab [-h|-help] | [-n | -e][-arch | v=variant | v=arch/variant][-c licensefile] [-display Xdisplay | -nodisplay][-nosplash] [-mwvisual visualid] [-debug] [-softwareopengl][-desktop | -nodesktop | -nojvm][-r MATLAB_command] [-logfile log][-Ddebugger [options]]-h|-help - Display arguments.-n - Display final environment variables,arguments, and other diagnosticinformation. MATLAB is not run.-e - Display ALL the environment variables andtheir values to standard output. MATLABis not run. If the exit status is not0 on return then the variables and valuesmay not be correct.-arch - Start MATLAB assuming architecture arch.v=variant - Start the version of MATLAB foundin bin/glnxa64/variant instead of bin/glnxa64.v=arch/variant - Start the version of MATLAB foundin bin/arch/variant instead of bin/glnxa64.-c licensefile - Set location of the license file that MATLABshould use. It can have the form port@host orbe a colon separated list of license files.The LM_LICENSE_FILE and MLM_LICENSE_FILEenvironment variables will be ignored.-display Xdisplay - Send X commands to X server display, Xdisplay.-nodisplay - Do not display any X commands. The MATLABdesktop will not be started. However, unless-nojvm is also provided the Java virtual machinewill be started.-nosplash - Do not display the splash screen during startup.-mwvisual visualid - The default X visual to use for figure windows.-debug - Provide debugging information especially for Xbased problems.-desktop - Allow the MATLAB desktop to be started by aprocess without a controlling terminal. This isusually a required command line argument whenattempting to start MATLAB from a window managermenu or desktop icon.-nodesktop - Do not start the MATLAB desktop. Use the currentterminal for commands. The Java virtual machinewill be started.-singleCompThread - Limit MATLAB to a single computational thread. By default, MATLAB makes use of the multithreading capabilities of the computer on which it is running.-nojvm - Shut off all Java support by not starting theJava virtual machine. In particular the MATLABdesktop will not be started.-jdb [port] - Enable remote Java debugging on port (default 4444)-r MATLAB_command - Start MATLAB and execute the MATLAB_command.-logfile log - Make a copy of any output to the command windowin file log. This includes all crash reports.-Ddebugger [options] - Start debugger to debug MATLAB.-nouserjavapath - Ignore custom javaclasspath.txt and javalibrarypath.txt files.?
二是使用外部編輯器 Emacs 來編輯和調(diào)試. 調(diào)試采用 matlab-shell mode, 稍微復雜一些, 傳統(tǒng)的快捷鍵都不怎么能用, 只能用命令設(shè)置斷點和運行, 涉及到的命令有: dbstop & dbstatus & dbcont & dbquit 等, 可參閱這篇博客<MATLAB的簡單debug功能>. 在調(diào)試過程中編輯腳本也沒問題, matlab 占用也小. 有關(guān) Emacs 多窗口之間切換的快捷鍵可以參考 學習Emacs系列教程(十):多窗口.
?
全文完.
?
轉(zhuǎn)載于:https://www.cnblogs.com/snake553/p/5357808.html
總結(jié)
以上是生活随笔為你收集整理的Linux x64 下 Matlab R2013a 300 kb 脚本文件调试的 CPU 占用过高问题的解决办法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: web.xml中相关标签的加载顺序
- 下一篇: linux中redis的主从