mtimesx crashes when used

2 views (last 30 days)
David H
David H on 8 Feb 2016
Edited: Walter Roberson on 2 Mar 2017
After compiling the user submitted function mtimesx http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support via mtimesx_build. I had to change a couple of lines in mtimesx_build to reflect the change to a .xml file instead of a .bat file and change lcc to "lcc" (this is how it is displayed in the .xml file) but otherwise just used it as it was designed.
It claimed to compile successfully but now crashes matlab when I try and do a matrix multiplication (but not a scalar multiplication). Can anyone assist me with this?
I am included the full error and trace in case this is helpful.
mtimesx_build
... Build routine for mtimesx
... Checking for PC
... Finding path of mtimesx C source code files
... Found file mtimesx.c in C:\Users\David Holdaway\Documents\MATLAB\personal_functions\mtimesx\mtimesx.c
... Found file mtimesx_RealTimesReal.c in C:\Users\David Holdaway\Documents\MATLAB\personal_functions\mtimesx\mtimesx_RealTimesReal.c
... Opened the mexopts.bat file in C:\Users\David Holdaway\AppData\Roaming\MathWorks\MATLAB\R2015b\mex_C_win32.xml
... Reading the mexopts.bat file to find the compiler and options used.
... LCC is the selected compiler
... OpenMP compiler not detected ... you may want to check this website:
http://openmp.org/wp/openmp-compilers/
... Using BLAS library lib_blas = 'C:\Program Files (x86)\MATLAB\R2015b\extern\lib\win32\lcc\libmwblas.lib'
... Now attempting to compile ...
mex('C:\Users\David Holdaway\Documents\MATLAB\personal_functions\mtimesx\mtimesx.c',lib_blas,'-DCOMPILER=LCC')
Building with 'lcc-win32'.
MEX completed successfully.
... mex mtimesx.c build completed ... you may now use mtimesx.
>> mtimesx(1,1)
ans =
1
>>
>> mtimesx(1,rand(3))
ans =
0.8147 0.9134 0.2785
0.9058 0.6324 0.5469
0.1270 0.0975 0.9575
>> mtimesx(rand(3),rand(3))
MATLAB crash file:C:\Users\DAVIDH~1\AppData\Local\Temp\matlab_crash_dump.9428-1:
------------------------------------------------------------------------
Access violation detected at Mon Feb 08 16:34:51 2016
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 4000 Version 10.18.10.4276
Host Name : David_Tosh
MATLAB Architecture : win32
MATLAB Root : C:\Program Files (x86)\MATLAB\R2015b
MATLAB Version : 8.6.0.267246 (R2015b)
OpenGL : hardware
Operating System : Microsoft Windows 10 Pro
Processor ID : x86 Family 6 Model 58 Stepping 9, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) Client VM mixed mode
Window System : Version 10.0 (Build 10586)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
EAX = 00000020 EBX = 3a481f4e
ECX = 00c2dda8 EDX = 2fc92b80
ESP = 00c2d918 EBP = 00c2dcec
ESI = 00000009 EDI = 00c2dc4b
EIP = f1030000 EFL = 00210202
CS = 00000023 DS = 0000002b SS = 0000002b
ES = 0000002b FS = 00000053 GS = 0000002b
Stack Trace (from fault):
[ 0] 0xf1030000 <unknown-module>+00000000
[ 1] 0x01043ccd C:\Users\David Holdaway\Documents\MATLAB\personal_functions\mtimesx.mexw32+00081101 mexFunction+00076119
[ 2] 0x01031fff C:\Users\David Holdaway\Documents\MATLAB\personal_functions\mtimesx.mexw32+00008191 mexFunction+00003209
[ 3] 0x7c7951ef C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmex.dll+00086511 mexRunMexFile+00000127
[ 4] 0x7c794594 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmex.dll+00083348 inSwapMexfileReader+00000580
[ 5] 0x7c793e78 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmex.dll+00081528 mexUnlock+00004840
[ 6] 0x072b9714 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_dispatcher.dll+00038676 Mfh_file::dispatch_fh_impl+00000644
[ 7] 0x072b948b C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_dispatcher.dll+00038027 Mfh_file::dispatch_fh+00000027
[ 8] 0x072b9ca5 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_dispatcher.dll+00040101 Mfunction_handle::dispatch+00000917
[ 9] 0x0817c4d1 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+06800593 boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree>::save_object_ptr+00417105
[ 10] 0x08187502 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+06845698 boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree>::save_object_ptr+00462210
[ 11] 0x082d16b8 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+08197816 boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree>::save_object_ptr+01814328
[ 12] 0x0827e8dc C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+07858396 boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree>::save_object_ptr+01474908
[ 13] 0x07ea619c C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+03826076
[ 14] 0x07e93bd6 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+03750870
[ 15] 0x07e9b025 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+03780645
[ 16] 0x0805b87a C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05617786
[ 17] 0x0801b696 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05355158
[ 18] 0x0801c2f5 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05358325
[ 19] 0x0801c228 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05358120
[ 20] 0x080a3c45 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05913669 MathWorks::lxe::registerMcrContexts+00183845
[ 21] 0x080a698e C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05925262 MathWorks::lxe::registerMcrContexts+00195438
[ 22] 0x080a602f C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05922863 MathWorks::lxe::registerMcrContexts+00193039
[ 23] 0x080a62ee C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_lxe.dll+05923566 MathWorks::lxe::registerMcrContexts+00193742
[ 24] 0x0752db4d C:\Program Files (x86)\MATLAB\R2015b\bin\win32\m_interpreter.dll+00580429 inEvalCmdWithLocalReturn+00000029
[ 25] 0x7ba91c23 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwbridge.dll+00072739 mnGetPrompt+00003651
[ 26] 0x7ba92712 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwbridge.dll+00075538 mnParser+00001042
[ 27] 0x06ea6373 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00353139 mcrInstance::mnParser_on_interpreter_thread+00000051
[ 28] 0x06e7b275 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00176757 mcr::runtime::setInterpreterThreadToCurrent+00017765
[ 29] 0x06e7b2e6 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00176870 mcr::runtime::setInterpreterThreadToCurrent+00017878
[ 30] 0x06e7cabf C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00182975 mcr::runtime::setInterpreterThreadToCurrent+00023983
[ 31] 0x06e7ca12 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00182802 mcr::runtime::setInterpreterThreadToCurrent+00023810
[ 32] 0x06e7ba66 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00178790 mcr::runtime::setInterpreterThreadToCurrent+00019798
[ 33] 0x7b72669b C:\Program Files (x86)\MATLAB\R2015b\bin\win32\uiw.dll+00485019 UIW_AttachThreadInput+00000843
[ 34] 0x7b7260d7 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\uiw.dll+00483543 wsd_to_MSW+00004023
[ 35] 0x7b72618b C:\Program Files (x86)\MATLAB\R2015b\bin\win32\uiw.dll+00483723 wsd_to_MSW+00004203
[ 36] 0x7609fed6 C:\WINDOWS\SYSTEM32\USER32.dll+00196310 LoadStringA+00000422
[ 37] 0x7608ddc6 C:\WINDOWS\SYSTEM32\USER32.dll+00122310 CopyRect+00000358
[ 38] 0x7608dd4b C:\WINDOWS\SYSTEM32\USER32.dll+00122187 CopyRect+00000235
[ 39] 0x775f8d86 C:\WINDOWS\SYSTEM32\ntdll.dll+00494982 KiUserCallbackDispatcher+00000054
[ 40] 0x7608cbc4 C:\WINDOWS\SYSTEM32\USER32.dll+00117700 PeekMessageA+00000372
[ 41] 0x7b6d918a C:\Program Files (x86)\MATLAB\R2015b\bin\win32\uiw.dll+00168330 UIW_ShowMenuItem+00004986
[ 42] 0x7b726ff4 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\uiw.dll+00487412 UIW_SuspendAttachThreadInput+00000708
[ 43] 0x027e2434 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01451060 services::system_events::PpeDispatchHook::dispatchOne+00029092
[ 44] 0x027eed56 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01502550 sysq::addProcessPendingEventsUnitTestHook+00007942
[ 45] 0x027e04be C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01443006 services::system_events::PpeDispatchHook::dispatchOne+00021038
[ 46] 0x027eee01 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01502721 sysq::addProcessPendingEventsUnitTestHook+00008113
[ 47] 0x027f07a9 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01509289 sysq::getCondition+00003833
[ 48] 0x027f1f2b C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01515307 svWS_ProcessPendingEvents+00000139
[ 49] 0x027f1e90 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\libmwservices.dll+01515152 svWS_ProcessPendingEvents+00000016
[ 50] 0x06e7c111 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00180497 mcr::runtime::setInterpreterThreadToCurrent+00021505
[ 51] 0x06e7cc8d C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00183437 mcr::runtime::setInterpreterThreadToCurrent+00024445
[ 52] 0x06e7516f C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00151919 mcr_process_events+00006879
[ 53] 0x06e76b93 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mcr.dll+00158611 mcr_process_events+00013571
[ 54] 0x06df2e3d C:\Program Files (x86)\MATLAB\R2015b\bin\win32\MVMLocal.dll+00208445 mvm_server::inproc::LocalFactory::terminate+00079565
[ 55] 0x7b421681 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mvm.dll+01054337 mvm::detail::initLocalMvmHack+00000433
[ 56] 0x7b42084b C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mvm.dll+01050699 mvm::detail::RequestMvmMessage::toString+00007787
[ 57] 0x7b421cad C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mvm.dll+01055917 mvm::detail::SessionImpl::privateSession+00000285
[ 58] 0x7b421e60 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\mvm.dll+01056352 mvm::detail::SessionImpl::privateSession+00000720
[ 59] 0x00405e2a C:\Program Files (x86)\MATLAB\R2015b\bin\win32\MATLAB.exe+00024106
[ 60] 0x00407747 C:\Program Files (x86)\MATLAB\R2015b\bin\win32\MATLAB.exe+00030535
[ 61] 0x74a638f4 C:\WINDOWS\SYSTEM32\KERNEL32.DLL+00080116 BaseThreadInitThunk+00000036
[ 62] 0x775e56c3 C:\WINDOWS\SYSTEM32\ntdll.dll+00415427 RtlUnicodeStringToInteger+00000595
[ 63] 0x775e568e C:\WINDOWS\SYSTEM32\ntdll.dll+00415374 RtlUnicodeStringToInteger+00000542
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.

Accepted Answer

James Tursa
James Tursa on 9 Feb 2016
It has been a long time since I have had access to MATLAB with a C compiler, so it is hard for me to debug this. However, try this to see if we can isolate the problem to BLAS calls:
mtimesx(rand(3),rand(3),'LOOPS') % Forces loops to be used instead of BLAS calls
mtimesx(rand(3),rand(3),'BLAS') % Forces BLAS calls
If the LOOPS works but BLAS crashes, then maybe we have to force -largeArrayDims on the compile. Try adding that option to the compile and then see what happens.
  2 Comments
David H
David H on 9 Feb 2016
Forcing it to compile with '-largeArrayDims' appears to have fixed the problem. Perhaps matlab has made this option compulsory. Thanks for the help.
mborkar
mborkar on 2 Mar 2017
How did you force this? I'm assuming you edited mtimesx_build.m but I can't figure out where to make the change. When I currently run mtimesx_build.m, it compiles following line 432.
Thanks in advance...

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!