Having an inconsistent Performance of running a MATLAB/MEX file -
i have written mex
file. file compiles no problem. reasons, baffled, mex
file not work more. nothing has changed. using same mex
code , same arguments executing mex
file. fails. uninstalled , reinstalled matlab
did not help.
i tracked problem , seems when reaches mexcallmatlab
, causes crash.
mxarray *x_locations = ( cellcentered ) ? mxcreatedoublematrix( 1, nz-1, mxreal ) : mxcreatedoublematrix( 1, nz, mxreal ); mxarray *y_locations = ( cellcentered ) ? mxcreatedoublematrix( 1, ny-1, mxreal ) : mxcreatedoublematrix( 1, ny, mxreal ); mxarray *z_locations = ( cellcentered ) ? mxcreatedoublematrix( 1, nx-1, mxreal ) : mxcreatedoublematrix( 1, nx, mxreal ); // loop filling values x_locations, y_locations, z_locations // ... // end of loop // create meshgrid based on values stored in x_locations, y_locations, z_locations mxarray *in[3]; mxarray *out[3]; in[0] = x_locations; in[1] = y_locations; in[2] = z_locations; mexprintf("line before mexcallmatlab\n"); mexcallmatlab(3, out, 3, in, "meshgrid"); mexprintf("line after mexcallmatlab\n");
when run mex file, line before mexcallmatlab
printed , code not reach print line after mexcallmatlab
. here log.
matlab crash file:c:\users\a\appdata\local\temp\matlab_crash_dump.7712-1: ------------------------------------------------------------------------ segmentation violation detected @ wed jun 25 15:51:21 2014 ------------------------------------------------------------------------ configuration: crash decoding : disabled default encoding: windows-1252 matlab root : c:\program files\matlab\r2012b matlab version : 8.0.0.783 (r2012b) operating system: microsoft windows 7 processor id : x86 family 6 model 26 stepping 5, genuineintel virtual machine : java 1.6.0_17-b04 sun microsystems inc. java hotspot(tm) 64-bit server vm mixed mode window system : version 6.1 (build 7601: service pack 1) fault count: 1 abnormal termination: segmentation violation register state (from fault): rax = 0000000060de7cc0 rbx = 000009a28967bdb0 rcx = 000000ffffffffff rdx = 0000000060ea08e0 rsp = 0000000004106360 rbp = 0000000000000000 rsi = 0000000006fa0000 rdi = 0000000060ea08f0 r8 = 0000000060ea08f0 r9 = 32525c4501cd000a r10 = 00000000166f3660 r11 = 00000000740faf60 r12 = 0000000004106610 r13 = 00000000041064e0 r14 = 00000000002dc6c0 r15 = 0000000000000000 rip = 0000000076d33290 efl = 00010202 cs = 0033 fs = 0053 gs = 002b stack trace (from fault): [ 0] 0x0000000076d33290 c:\windows\system32\ntdll.dll+00340624 ( rtlfreeheap+000208 ) [ 1] 0x0000000076be1a4a c:\windows\system32\kernel32.dll+00137802 ( heapfree+000010 ) [ 2] 0x00000000725acabc c:\windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcr90.dll+00314044 ( free+000028 ) [ 3] 0x0000000075a23075 c:\program files\matlab\r2012b\bin\win64\libmx.dll+00012405 ( mxfree+000037 ) [ 4] 0x0000000075a84b9d c:\program files\matlab\r2012b\bin\win64\libmx.dll+00412573 ( mxsubscriptedreference+000621 ) [ 5] 0x000007fee4475709 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00087817 ( inis_ws_variable+000329 ) [ 6] 0x000007fee44c8cce c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00429262 ( infunctionhandleinterface::destroyworkspace+241806 ) [ 7] 0x000007fee44d2978 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00469368 ( infunctionhandleinterface::destroyworkspace+281912 ) [ 8] 0x000007fee44d5a8b c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00481931 ( infunctionhandleinterface::destroyworkspace+294475 ) [ 9] 0x000007fee44bde1f c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00384543 ( infunctionhandleinterface::destroyworkspace+197087 ) [ 10] 0x000007fee44bdd80 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00384384 ( infunctionhandleinterface::destroyworkspace+196928 ) [ 11] 0x000007fee44e197d c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00530813 ( infunctionhandleinterface::destroyworkspace+343357 ) [ 12] 0x000007fee44e0271 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00524913 ( infunctionhandleinterface::destroyworkspace+337457 ) [ 13] 0x000007fee44c20e9 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00401641 ( infunctionhandleinterface::destroyworkspace+214185 ) [ 14] 0x0000000074e8c80d c:\program files\matlab\r2012b\bin\win64\m_dispatcher.dll+00051213 ( mfh_file::dispatch_fh+000509 ) [ 15] 0x0000000074e8d0d6 c:\program files\matlab\r2012b\bin\win64\m_dispatcher.dll+00053462 ( mfunction_handle::dispatch+000854 ) [ 16] 0x000007fee4482cd8 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00142552 ( mathworks::mexception::mexceptionenvelope::mexceptionenvelope+003336 ) [ 17] 0x000007fee453beb2 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00900786 ( inmexcallmatlab+000738 ) [ 18] 0x000007fee453bb9e c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00899998 ( iinterpreter::getinterpreterbridge+148286 ) [ 19] 0x000007fee453bcaf c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00900271 ( inmexcallmatlab+000223 ) [ 20] 0x0000000061ce6989 c:\program files\matlab\r2012b\bin\win64\libmex.dll+00027017 ( mexcallmatlab+000073 ) [ 21] 0x0000000009b02272 d:\files\mymexfile.mexw64+00008818 ( mexfunction+004722 ) [ 22] 0x0000000061cf0f83 c:\program files\matlab\r2012b\bin\win64\libmex.dll+00069507 ( mexrunmexfile+000131 ) [ 23] 0x0000000061cefce2 c:\program files\matlab\r2012b\bin\win64\libmex.dll+00064738 ( inswapmexfilereader+000226 ) [ 24] 0x0000000061cefe64 c:\program files\matlab\r2012b\bin\win64\libmex.dll+00065124 ( inswapmexfilereader+000612 ) [ 25] 0x0000000074e8c80d c:\program files\matlab\r2012b\bin\win64\m_dispatcher.dll+00051213 ( mfh_file::dispatch_fh+000509 ) [ 26] 0x0000000074e8d0d6 c:\program files\matlab\r2012b\bin\win64\m_dispatcher.dll+00053462 ( mfunction_handle::dispatch+000854 ) [ 27] 0x000007fee44b210b c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00336139 ( infunctionhandleinterface::destroyworkspace+148683 ) [ 28] 0x000007fee44c3edf c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00409311 ( infunctionhandleinterface::destroyworkspace+221855 ) [ 29] 0x000007fee44e0ae8 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00527080 ( infunctionhandleinterface::destroyworkspace+339624 ) [ 30] 0x000007fee44c8d94 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00429460 ( infunctionhandleinterface::destroyworkspace+242004 ) [ 31] 0x000007fee44d2978 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00469368 ( infunctionhandleinterface::destroyworkspace+281912 ) [ 32] 0x000007fee44e18c1 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00530625 ( infunctionhandleinterface::destroyworkspace+343169 ) [ 33] 0x000007fee44e0271 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00524913 ( infunctionhandleinterface::destroyworkspace+337457 ) [ 34] 0x000007fee44c20e9 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00401641 ( infunctionhandleinterface::destroyworkspace+214185 ) [ 35] 0x0000000074e8c80d c:\program files\matlab\r2012b\bin\win64\m_dispatcher.dll+00051213 ( mfh_file::dispatch_fh+000509 ) [ 36] 0x0000000074e8d0d6 c:\program files\matlab\r2012b\bin\win64\m_dispatcher.dll+00053462 ( mfunction_handle::dispatch+000854 ) [ 37] 0x000007fee45751e5 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01135077 ( invalidateloadedobject+001893 ) [ 38] 0x000007fee4584595 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01197461 ( init_cleaner+015541 ) [ 39] 0x000007fee4587b75 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01211253 ( insetmaxframecount+002261 ) [ 40] 0x000007fee4587b48 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01211208 ( insetmaxframecount+002216 ) [ 41] 0x000007fee4587b07 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01211143 ( insetmaxframecount+002151 ) [ 42] 0x000007fee4470213 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+00066067 ( inpathnotification::function_clear_notification+004019 ) [ 43] 0x000007fee457aed0 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01158864 ( inevalcmdwithlocalreturn+000416 ) [ 44] 0x000007fee457ae2c c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01158700 ( inevalcmdwithlocalreturn+000252 ) [ 45] 0x000007fee457ad71 c:\program files\matlab\r2012b\bin\win64\m_interpreter.dll+01158513 ( inevalcmdwithlocalreturn+000065 ) [ 46] 0x0000000079fbf90d c:\program files\matlab\r2012b\bin\win64\libmwbridge.dll+00063757 ( mndebugprompt+000109 ) [ 47] 0x0000000079fc0471 c:\program files\matlab\r2012b\bin\win64\libmwbridge.dll+00066673 ( mnparser+000593 ) [ 48] 0x00000000749a64a4 c:\program files\matlab\r2012b\bin\win64\mcr.dll+00222372 ( mcrinstance::mnparser_on_interpreter_thread+000036 ) [ 49] 0x000000007498681f c:\program files\matlab\r2012b\bin\win64\mcr.dll+00092191 ( mcr::setinterpreterthreadtocurrent+029887 ) [ 50] 0x0000000074986881 c:\program files\matlab\r2012b\bin\win64\mcr.dll+00092289 ( mcr::setinterpreterthreadtocurrent+029985 ) [ 51] 0x00000000063fe0b6 c:\program files\matlab\r2012b\bin\win64\uiw.dll+00385206 ( uiw_isusermessage+000086 ) [ 52] 0x00000000063fe7b9 c:\program files\matlab\r2012b\bin\win64\uiw.dll+00387001 ( uiw_setglimusermsg+000153 ) [ 53] 0x0000000076ae87fe c:\windows\system32\user32.dll+00165886 ( getmenubarinfo+000638 ) [ 54] 0x0000000076acf5fb c:\windows\system32\user32.dll+00062971 ( systemparametersinfow+000235 ) [ 55] 0x0000000076ad4895 c:\windows\system32\user32.dll+00084117 ( isprocessdpiaware+000465 ) [ 56] 0x0000000076d311f5 c:\windows\system32\ntdll.dll+00332277 ( kiusercallbackdispatcher+000031 ) [ 57] 0x0000000076ad908a c:\windows\system32\user32.dll+00102538 ( peekmessagew+000186 ) [ 58] 0x0000000076ad50fe c:\windows\system32\user32.dll+00086270 ( getkeystate+000238 ) [ 59] 0x0000000076ad3a6f c:\windows\system32\user32.dll+00080495 ( peekmessagea+000087 ) [ 60] 0x00000000063d8f4b c:\program files\matlab\r2012b\bin\win64\uiw.dll+00233291 ( uiw_setcurrentdialog+000731 ) [ 61] 0x00000000063ffbe2 c:\program files\matlab\r2012b\bin\win64\uiw.dll+00392162 ( ws_freesystemfont+000546 ) [ 62] 0x000000000485e6a3 c:\program files\matlab\r2012b\bin\win64\libmwservices.dll+00779939 ( sysq::removecommitdatabaseupdateshook+002131 ) [ 63] 0x000000000485fe18 c:\program files\matlab\r2012b\bin\win64\libmwservices.dll+00785944 ( sysq::removecommitdatabaseupdateshook+008136 ) [ 64] 0x0000000004861a20 c:\program files\matlab\r2012b\bin\win64\libmwservices.dll+00793120 ( sysq::addprocesspendingeventsunittesthook+000240 ) [ 65] 0x0000000004861ae8 c:\program files\matlab\r2012b\bin\win64\libmwservices.dll+00793320 ( sysq::addprocesspendingeventsunittesthook+000440 ) [ 66] 0x0000000004861ca3 c:\program files\matlab\r2012b\bin\win64\libmwservices.dll+00793763 ( sysq::addprocesspendingeventsunittesthook+000883 ) [ 67] 0x0000000004861d76 c:\program files\matlab\r2012b\bin\win64\libmwservices.dll+00793974 ( sysq::addprocesspendingeventsunittesthook+001094 ) [ 68] 0x000000007498837e c:\program files\matlab\r2012b\bin\win64\mcr.dll+00099198 ( mcr::setinterpreterthreadtocurrent+036894 ) [ 69] 0x0000000074988665 c:\program files\matlab\r2012b\bin\win64\mcr.dll+00099941 ( mcr::setinterpreterthreadtocurrent+037637 ) [ 70] 0x000000007497b166 c:\program files\matlab\r2012b\bin\win64\mcr.dll+00045414 ( depfunrules::postwarning+003430 ) [ 71] 0x000000013fa48a33 c:\program files\matlab\r2012b\bin\win64\matlab.exe+00035379 ( ???+000000 ) [ 72] 0x000000013fa48c97 c:\program files\matlab\r2012b\bin\win64\matlab.exe+00035991 ( ???+000000 ) [ 73] 0x000000013fa49163 c:\program files\matlab\r2012b\bin\win64\matlab.exe+00037219 ( ???+000000 ) [ 74] 0x0000000076bd59ed c:\windows\system32\kernel32.dll+00088557 ( basethreadinitthunk+000013 ) [ 75] 0x0000000076d0c541 c:\windows\system32\ntdll.dll+00181569 ( rtluserthreadstart+000033 )
could on this?
Comments
Post a Comment