Skip to content

Conversation

aebrahim
Copy link
Contributor

@aebrahim aebrahim commented Apr 4, 2015

The source files were changed in #176.

These have been statically linked to libzmq 4.0.5, so libzmq does not
actually need to be installed at the system level.

@blink1073
Copy link
Collaborator

@aebrahim, your PRs are bleeding together because they're on the same branch. I'm going to close #176 in favor of this one.

@arokem
Copy link
Owner

arokem commented Apr 6, 2015

Hey @aebrahim - Overall, this seems OK to me. Do you mind if we start by merging #173? You are both working on some similar things in these two PRs, but #173 proposes some more dramatic structural changes. Then, I would ask you to rebase this one, and you can focus this PR on the messenger.c code.

@aebrahim
Copy link
Contributor Author

aebrahim commented Apr 6, 2015

Was this new build system tested on Windows? It looks like it undoes some
of the changes I remember adding in order to get this working on Windows.

On Mon, Apr 6, 2015 at 1:47 PM, Ariel Rokem notifications@github.com
wrote:

Hey @aebrahim https://github.com/aebrahim - Overall, this seems OK to
me. Do you mind if we start by merging #173
#173? You are both
working on some similar things in these two PRs, but #173
#173 proposes some
more dramatic structural changes. Then, I would ask you to rebase this one,
and you can focus this PR on the messenger.c code.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 6, 2015

I don't think it was. I see that you've already started making comments on
the PR - would be good to get your input there!

On Mon, Apr 6, 2015 at 2:02 PM, Ali Ebrahim notifications@github.com
wrote:

Was this new build system tested on Windows? It looks like it undoes some
of the changes I remember adding in order to get this working on Windows.

On Mon, Apr 6, 2015 at 1:47 PM, Ariel Rokem notifications@github.com
wrote:

Hey @aebrahim https://github.com/aebrahim - Overall, this seems OK to
me. Do you mind if we start by merging #173
#173? You are both
working on some similar things in these two PRs, but #173
#173 proposes some
more dramatic structural changes. Then, I would ask you to rebase this
one,
and you can focus this PR on the messenger.c code.


Reply to this email directly or view it on GitHub
<
#178 (comment)

.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@aebrahim aebrahim mentioned this pull request Apr 6, 2015
@aebrahim
Copy link
Contributor Author

aebrahim commented Apr 6, 2015

It actually looks like #173 has quite a few issues with it, and I can't get it to run on Windows or Linux.

I recommend re-implementing new desired features on top of this pull request instead of vice-versa - it's really hard to rebase on top of #173 when I can't get it to run at all.

@arokem
Copy link
Owner

arokem commented Apr 6, 2015

Gotcha. @jjangsangy: what do you think?

@jjangsangy
Copy link

Sure let me take a closer look. Sorry for the late response, I just got back from a hackathon, so I've been a little preoccupied.

@aebrahim would love to coordinate with you about those changes so I can implement the code to get running.

@aebrahim
Copy link
Contributor Author

OK, I have a new proposed solution.

I've made a few more changes, and my testing indicates that everything in this PR now works on Windows, Mac, and Linux.

Can I suggest that this be merged now, and then the code be re-factored to the new structure while leaving the logic here relatively intact?

Also, the updated make script has a which_matlab function to detect where matlab is when it's not in the system path. Could this function potentially be moved to pymatbridge itself as part of your refactor to autodetect the executable when it can't be found?

The script fixes bugs so that the script will run on Windows, Linux, and
Mac OS X. It can also now automatically detects MATLAB on these
platforms if it is not specified.

The mexw32 folder was removed as it was unused (contained paramters from
Mac)
By using the asynchronous API while listening constantly, excessive CPU
usage occurs.

Instead, this commit uses the synchronous version of zmq_recv, and uses
zmq_poll with a timeout of 20ms to ensure the graphics are updated.

This fixes #175.
These have been statically linked to libzmq 4.0.5, so libzmq does not
actually need to be installed at the system level.

They incorporate the changes made to messenger.c to reduce CPU load.
@blink1073
Copy link
Collaborator

Just chiming in real quick, the which problem has be solved elegantly by pexpect, and we should probably use that function for make and the main library:
https://github.com/pexpect/pexpect/blob/master/pexpect/utils.py#L34

@arokem
Copy link
Owner

arokem commented Apr 10, 2015

@aebrahim - that sounds like a good way forward. Let me take a look at everything first.

First - @blink1073's proposal about detecting the matlab path: are you proposing to grab that module (actually just the top two functions, I think) and put it somewhere in our code (together with the pexpect license)? Surely you're not proposing to make pexpect a dependency?

@blink1073
Copy link
Collaborator

Yes, I'd say grab the two functions and the license.

@jjangsangy
Copy link

+1 for reimplementing which.

Nice bit of trivia. which is a BSD tool and was originally written in PERL.
https://github.com/plicease/File-Which/blob/master/script/pwhich

@@ -67,9 +76,55 @@ def build_octave():
do_build(make_cmd, 'messenger.mex')


def which_matlab():
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will all be replaced by the pexpect stuff that @blink1073 pointed out. Does that work well on Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pexpext work if it's not in the path?

In my which function I look in the default installation location for MATLAB
even if it's not in the path. Annoying because MATLAB uses a different
structure on every platform. It would be great if pexpect could replace
this.
On Apr 10, 2015 4:09 PM, "Ariel Rokem" notifications@github.com wrote:

In messenger/make.py
#178 (comment)
:

@@ -67,9 +76,55 @@ def build_octave():
do_build(make_cmd, 'messenger.mex')

+def which_matlab():

This will all be replaced by the pexpect stuff that @blink1073
https://github.com/blink1073. Does that work well on Windows?


Reply to this email directly or view it on GitHub
https://github.com/arokem/python-matlab-bridge/pull/178/files#r28187251.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pexpext work if it's not in the path?

pexept assumes the binaries are in the $PATH since it replicates BSD utils which.

However, get_matlab_bin() should return absolute path of the matlab binary regardless of if it is in the path or not.

Then running get_matlab_env(matlab='matlab') with the path to the binary will also return a dictionary containing that particular configuration environment variables.

The only known instance of where this breaks is if a user has two different installations of matlab installed. If that is the cas, you can override the discovery machinery by specifying the MATLAB_BIN variable in the config.ini file in the root directory to specify the copy of matlab you'd like to target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.. the function which_matlab which I wrote doesn't reimplement which
at all. It calls "which matlab." However it usually isn't in the path, so
when that fails it looks in the default location on all 3 platforms.

I was actually inspired by your function to make it work on all 3
platforms. However, your code assumes the same structure of MATLAB on all 3
platforms, which for some reason isn't the case (why MATHWORKS?), which is
why I had to use if statements and handle each OS separately.

On Fri, Apr 10, 2015 at 4:41 PM, Sang Han notifications@github.com wrote:

In messenger/make.py
#178 (comment)
:

@@ -67,9 +76,55 @@ def build_octave():
do_build(make_cmd, 'messenger.mex')

+def which_matlab():

pexept assumes the binaries are in the path since it replicates BSD utils
which.

However, get_matlab_bin should return absolute path of the matlab binary
regardless of if it is in the path or not.

https://github.com/jjangsangy/python-matlab-bridge/blob/master/messenger/make.py#L206

Then running get_matlab_env with the path to the binary will also return
a dictionary containing that particular configuration environment variables.

https://github.com/jjangsangy/python-matlab-bridge/blob/master/messenger/settings.py#L15


Reply to this email directly or view it on GitHub
https://github.com/arokem/python-matlab-bridge/pull/178/files#r28188377.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the structure can be different.

I know that sometimes there is a R2014_* directory that is present in windows but not on OSX or Linux. I took care of that in this section.

        for p in os.listdir(os.path.join(programs[host], *matlab)):
            # Checks for this folder in the matlab directory
            if p.startswith('R20'):
                matlab.append(p)

        matlab.append('bin')

Sorry, maybe I should have written more comments. Honestly didn't even think anyone would even read this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, it was easier for me to rewrite this than try to debug it when it
didn't work on Windows when I tried to merge your PR.

Is it possible to just apply the simplifications you need (like 1 config
file, integration with setup.py) using the functions in my PR?

On Fri, Apr 10, 2015 at 5:00 PM, Sang Han notifications@github.com wrote:

In messenger/make.py
#178 (comment)
:

@@ -67,9 +76,55 @@ def build_octave():
do_build(make_cmd, 'messenger.mex')

+def which_matlab():

So the structure can be different.

I know that sometimes there is a R2014_* directory that is present in
windows but not on OSX or Linux. I took care of that with this code.

Sorry, maybe I should have written more comments. Honestly didn't even
think anyone would even read this :)

    for p in os.listdir(os.path.join(programs[host], *matlab)):
        if p.startswith('R20'):
            matlab.append(p)

    matlab.append('bin')


Reply to this email directly or view it on GitHub
https://github.com/arokem/python-matlab-bridge/pull/178/files#r28189008.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also dude, it wasn't bad to read; it's just a bit different than my coding
style so.

On Fri, Apr 10, 2015 at 5:05 PM, Ali Ebrahim aebrahim@ucsd.edu wrote:

Honestly, it was easier for me to rewrite this than try to debug it when
it didn't work on Windows when I tried to merge your PR.

Is it possible to just apply the simplifications you need (like 1 config
file, integration with setup.py) using the functions in my PR?

On Fri, Apr 10, 2015 at 5:00 PM, Sang Han notifications@github.com
wrote:

In messenger/make.py
#178 (comment)
:

@@ -67,9 +76,55 @@ def build_octave():
do_build(make_cmd, 'messenger.mex')

+def which_matlab():

So the structure can be different.

I know that sometimes there is a R2014_* directory that is present in
windows but not on OSX or Linux. I took care of that with this code.

Sorry, maybe I should have written more comments. Honestly didn't even
think anyone would even read this :)

    for p in os.listdir(os.path.join(programs[host], *matlab)):
        if p.startswith('R20'):
            matlab.append(p)

    matlab.append('bin')


Reply to this email directly or view it on GitHub
https://github.com/arokem/python-matlab-bridge/pull/178/files#r28189008
.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that we finish this PR, and then refine the config system on
another PR.

On Fri, Apr 10, 2015 at 5:06 PM, Ali Ebrahim notifications@github.com
wrote:

In messenger/make.py
#178 (comment)
:

@@ -67,9 +76,55 @@ def build_octave():
do_build(make_cmd, 'messenger.mex')

+def which_matlab():

Honestly, it was easier for me to rewrite this than try to debug it when
it didn't work on Windows when I tried to merge your PR. Is it possible to
just apply the simplifications you need (like 1 config file, integration
with setup.py) using the functions in my PR?
… <#14ca5cc41acde2db_>
On Fri, Apr 10, 2015 at 5:00 PM, Sang Han notifications@github.com
wrote: In messenger/make.py <
https://github.com/arokem/python-matlab-bridge/pull/178#discussion_r28189008>
: > @@ -67,9 +76,55 @@ def build_octave(): > do_build(make_cmd,
'messenger.mex') > > > +def which_matlab(): So the structure can be
different. I know that sometimes there is a R2014_* directory that is
present in windows but not on OSX or Linux. I took care of that with this
code. Sorry, maybe I should have written more comments. Honestly didn't
even think anyone would even read this :) for p in
os.listdir(os.path.join(programs[host], *matlab)): if p.startswith('R20'):
matlab.append(p) matlab.append('bin') — Reply to this email directly or
view it on GitHub <
https://github.com/arokem/python-matlab-bridge/pull/178/files#r28189008>.


Reply to this email directly or view it on GitHub
https://github.com/arokem/python-matlab-bridge/pull/178/files#r28189149.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you embed the call to the pexpect which in a function that will gracefully handle failure modes (e.g. matlab not on the path)?

@jjangsangy
Copy link

So I've gone ahead and applied the code from pexpect 👍 as well as using check_output from subprocess and everything clears on my end.

I think this should resolve the issues we were having with windows not building. If I have some time later today, I will try to install Windows and Matlab on a VM and run a sanity check.

#173

@aebrahim
Copy link
Contributor Author

Oops. Didn't test on py3. My bad. I will make the required changes.

It's also worth noting is that most users shouldn't need to compile MATLAB
mex anymore when installing. I have libzmq statically linked to the mex for
all 3 platforms.
On Apr 10, 2015 4:21 PM, "Sang Han" notifications@github.com wrote:

So I've gone ahead and applied the code from pexpect as well as using
check_output from subprocess and everything clears on my end.

I think this should resolve the issues we were having with windows not
building. If I have some time later today, I will try to install Windows
and Matlab on a VM and run a sanity check.

#173 #173


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 10, 2015

That's good,

I'm getting some rather scary-looking matlab crash with this new mex file:

locusta:~  $nosetests pymatbridge
..OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

------------------------------------------------------------------------
              abort() detected at Fri Apr 10 16:29:55 2015
------------------------------------------------------------------------

Configuration:
  Crash Decoding     : Disabled
  Current Visual     : Quartz
  Default Encoding   : ISO-8859-1
  MATLAB Architecture: maci64
  MATLAB Root        : /Applications/MATLAB_R2014b.app
  MATLAB Version     : 8.4.0.150421 (R2014b)
  Operating System   : Darwin 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
  Processor ID       : x86 Family 6 Model 58 Stepping 9, GenuineIntel
  Software OpenGL    : 0
  Virtual Machine    : Java 1.7.0_55-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  Window System      : Quartz

Fault Count: 1


Abnormal termination:
abort()

Register State (from fault):
  RAX = 0000000113167c00  RBX = 0000000000000000
  RCX = 0000000000000003  RDX = 0000000116eba70c
  RSP = 0000000000000016  RBP = 00007fff8a2219a7
  RSI = 0000000116eba6f0  RDI = 0000000116ec6000

   R8 = 0000000000000006   R9 = 0000000113233c90
  R10 = 0000000000000000  R11 = 0000000116ec6000
  R12 = 0000000000000002  R13 = 0000000116eba720
  R14 = 00007fff8a22242f  R15 = 0000000000000000

  RIP = 0000510316eba740  RFL = 0000000116eba740

   CS = 0000000000000000   FS = 0000000116eba750   GS = 00007fff89589b53

Stack Trace (from fault):
[  0] 0x000000010b27be64 /Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00028260 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+00000052
[  1] 0x000000010b27fa2a /Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00043562 _ZN2fl4test17terminate_handledEv+00000906
[  2] 0x000000010b27f477 /Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00042103 _ZN2fl4diag13terminate_logEPKcPK17__darwin_ucontext+00000119
[  3] 0x000000010acdfb7a /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00387962 _Z32mnRunPathDependentInitializationv+00003146
[  4] 0x000000010acdfe58 /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00388696 _Z32mnRunPathDependentInitializationv+00003880
[  5] 0x000000010acdf3a0 /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00385952 _Z32mnRunPathDependentInitializationv+00001136
[  6] 0x000000010acded9c /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00384412 _Z22mnInstallCrashHandlersv+00000236
[  7] 0x00007fff91ef6f1a           /usr/lib/system/libsystem_platform.dylib+00020250 _sigtramp+00000026
[  8] 0x6320656c7069746c                                   <unknown-module>+00000000
[  9] 0x00007fff89589b53                  /usr/lib/system/libsystem_c.dylib+00383827 abort+00000129
[ 10] 0x0000000127f81b06 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00543494 __kmp_abort_process+00000038
[ 11] 0x0000000127f639a7 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00420263 __kmp_msg+00000519
[ 12] 0x0000000127f813e8 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00541672 _Z26__kmp_do_serial_initializev+00000744
[ 13] 0x0000000127f6e9ef /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00465391 __kmp_get_global_thread_id_reg+00000479
[ 14] 0x0000000127f5fef9 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00405241 omp_in_parallel+00000009
[ 15] 0x000000012898ddd0 /Applications/MATLAB_R2014b.app/bin/maci64/mkl.dylib+00933328 mkl_serv_get_max_threads+00000656
[ 16] 0x0000000000000002                                   <unknown-module>+00000000


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.** This crash report has been saved to disk as /Users/arokem/matlab_crash_dump.48710-1 **



MATLAB is exiting because of fatal error

@aebrahim
Copy link
Contributor Author

Yikes. Ok maybe I shouldn't compile on mac then. Do my Windows and Linux
mex's work for people?
On Apr 10, 2015 4:31 PM, "Ariel Rokem" notifications@github.com wrote:

That's good,

I'm getting some rather scary-looking matlab crash with this new mex file:

locusta:~ $nosetests pymatbridge
..OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.


          abort() detected at Fri Apr 10 16:29:55 2015

Configuration:
Crash Decoding : Disabled
Current Visual : Quartz
Default Encoding : ISO-8859-1
MATLAB Architecture: maci64
MATLAB Root : /Applications/MATLAB_R2014b.app
MATLAB Version : 8.4.0.150421 (R2014b)
Operating System : Darwin 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Processor ID : x86 Family 6 Model 58 Stepping 9, GenuineIntel
Software OpenGL : 0
Virtual Machine : Java 1.7.0_55-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Quartz

Fault Count: 1

Abnormal termination:
abort()

Register State (from fault):
RAX = 0000000113167c00 RBX = 0000000000000000
RCX = 0000000000000003 RDX = 0000000116eba70c
RSP = 0000000000000016 RBP = 00007fff8a2219a7
RSI = 0000000116eba6f0 RDI = 0000000116ec6000

R8 = 0000000000000006 R9 = 0000000113233c90
R10 = 0000000000000000 R11 = 0000000116ec6000
R12 = 0000000000000002 R13 = 0000000116eba720
R14 = 00007fff8a22242f R15 = 0000000000000000

RIP = 0000510316eba740 RFL = 0000000116eba740

CS = 0000000000000000 FS = 0000000116eba750 GS = 00007fff89589b53

Stack Trace (from fault):
[ 0] 0x000000010b27be64 /Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00028260 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+00000052
[ 1] 0x000000010b27fa2a /Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00043562 _ZN2fl4test17terminate_handledEv+00000906
[ 2] 0x000000010b27f477 /Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00042103 _ZN2fl4diag13terminate_logEPKcPK17__darwin_ucontext+00000119
[ 3] 0x000000010acdfb7a /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00387962 _Z32mnRunPathDependentInitializationv+00003146
[ 4] 0x000000010acdfe58 /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00388696 _Z32mnRunPathDependentInitializationv+00003880
[ 5] 0x000000010acdf3a0 /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00385952 _Z32mnRunPathDependentInitializationv+00001136
[ 6] 0x000000010acded9c /Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00384412 _Z22mnInstallCrashHandlersv+00000236
[ 7] 0x00007fff91ef6f1a /usr/lib/system/libsystem_platform.dylib+00020250 _sigtramp+00000026
[ 8] 0x6320656c7069746c +00000000
[ 9] 0x00007fff89589b53 /usr/lib/system/libsystem_c.dylib+00383827 abort+00000129
[ 10] 0x0000000127f81b06 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00543494 __kmp_abort_process+00000038
[ 11] 0x0000000127f639a7 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00420263 __kmp_msg+00000519
[ 12] 0x0000000127f813e8 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00541672 _Z26__kmp_do_serial_initializev+00000744
[ 13] 0x0000000127f6e9ef /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00465391 __kmp_get_global_thread_id_reg+00000479
[ 14] 0x0000000127f5fef9 /Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00405241 omp_in_parallel+00000009
[ 15] 0x000000012898ddd0 /Applications/MATLAB_R2014b.app/bin/maci64/mkl.dylib+00933328 mkl_serv_get_max_threads+00000656
[ 16] 0x0000000000000002 +00000000

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.** This crash report has been saved to disk as /Users/arokem/matlab_crash_dump.48710-1 **

MATLAB is exiting because of fatal error


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 10, 2015

This was from a mex I compiled on my mac, but I get the same thing from
your compiled mex.

Maybe it has something to do with my environment OMP settings? I will try
to create a cleaner env and test that.

On Fri, Apr 10, 2015 at 4:33 PM, Ali Ebrahim notifications@github.com
wrote:

Yikes. Ok maybe I shouldn't compile on mac then. Do my Windows and Linux
mex's work for people?
On Apr 10, 2015 4:31 PM, "Ariel Rokem" notifications@github.com wrote:

That's good,

I'm getting some rather scary-looking matlab crash with this new mex
file:

locusta:~ $nosetests pymatbridge
..OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib
already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have
been linked into the program. That is dangerous, since it can degrade
performance or cause incorrect results. The best thing to do is to ensure
that only a single OpenMP runtime is linked into the process, e.g. by
avoiding static linking of the OpenMP runtime in any library. As an unsafe,
unsupported, undocumented workaround you can set the environment variable
KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but
that may cause crashes or silently produce incorrect results. For more
information, please see http://www.intel.com/software/products/support/.


abort() detected at Fri Apr 10 16:29:55 2015

Configuration:
Crash Decoding : Disabled
Current Visual : Quartz
Default Encoding : ISO-8859-1
MATLAB Architecture: maci64
MATLAB Root : /Applications/MATLAB_R2014b.app
MATLAB Version : 8.4.0.150421 (R2014b)
Operating System : Darwin 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec
22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Processor ID : x86 Family 6 Model 58 Stepping 9, GenuineIntel
Software OpenGL : 0
Virtual Machine : Java 1.7.0_55-b13 with Oracle Corporation Java
HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Quartz

Fault Count: 1

Abnormal termination:
abort()

Register State (from fault):
RAX = 0000000113167c00 RBX = 0000000000000000
RCX = 0000000000000003 RDX = 0000000116eba70c
RSP = 0000000000000016 RBP = 00007fff8a2219a7
RSI = 0000000116eba6f0 RDI = 0000000116ec6000

R8 = 0000000000000006 R9 = 0000000113233c90
R10 = 0000000000000000 R11 = 0000000116ec6000
R12 = 0000000000000002 R13 = 0000000116eba720
R14 = 00007fff8a22242f R15 = 0000000000000000

RIP = 0000510316eba740 RFL = 0000000116eba740

CS = 0000000000000000 FS = 0000000116eba750 GS = 00007fff89589b53

Stack Trace (from fault):
[ 0] 0x000000010b27be64
/Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00028260
_ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+00000052
[ 1] 0x000000010b27fa2a
/Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00043562
_ZN2fl4test17terminate_handledEv+00000906
[ 2] 0x000000010b27f477
/Applications/MATLAB_R2014b.app/bin/maci64/libmwfl.dylib+00042103
_ZN2fl4diag13terminate_logEPKcPK17__darwin_ucontext+00000119
[ 3] 0x000000010acdfb7a
/Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00387962
_Z32mnRunPathDependentInitializationv+00003146
[ 4] 0x000000010acdfe58
/Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00388696
_Z32mnRunPathDependentInitializationv+00003880
[ 5] 0x000000010acdf3a0
/Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00385952
_Z32mnRunPathDependentInitializationv+00001136
[ 6] 0x000000010acded9c
/Applications/MATLAB_R2014b.app/bin/maci64/libmwmcr.dylib+00384412
_Z22mnInstallCrashHandlersv+00000236
[ 7] 0x00007fff91ef6f1a
/usr/lib/system/libsystem_platform.dylib+00020250 _sigtramp+00000026
[ 8] 0x6320656c7069746c +00000000
[ 9] 0x00007fff89589b53 /usr/lib/system/libsystem_c.dylib+00383827
abort+00000129
[ 10] 0x0000000127f81b06
/Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00543494
__kmp_abort_process+00000038
[ 11] 0x0000000127f639a7
/Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00420263
__kmp_msg+00000519
[ 12] 0x0000000127f813e8
/Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00541672
_Z26__kmp_do_serial_initializev+00000744
[ 13] 0x0000000127f6e9ef
/Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00465391
__kmp_get_global_thread_id_reg+00000479
[ 14] 0x0000000127f5fef9
/Applications/MATLAB_R2014b.app/sys/os/maci64/libiomp5.dylib+00405241
omp_in_parallel+00000009
[ 15] 0x000000012898ddd0
/Applications/MATLAB_R2014b.app/bin/maci64/mkl.dylib+00933328
mkl_serv_get_max_threads+00000656
[ 16] 0x0000000000000002 +00000000

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.** This crash report has been saved to disk as
/Users/arokem/matlab_crash_dump.48710-1 **

MATLAB is exiting because of fatal error


Reply to this email directly or view it on GitHub
<
#178 (comment)

.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@blink1073
Copy link
Collaborator

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py

@aebrahim
Copy link
Contributor Author

I already handle the not in path failure mode. I'm not sure what exactly
you guys want to do with pexpect... can someone else replace the
check_output(["which", "matlab"]) function with the pexpect one?

On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester notifications@github.com
wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

That's fantastic! How do you 'forget' that? :-)

On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester notifications@github.com
wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
#178 (comment)
.

@blink1073
Copy link
Collaborator

Too many irons in the fire. :)


Sent from Mailbox

On Fri, Apr 10, 2015 at 7:22 PM, Ariel Rokem notifications@github.com
wrote:

That's fantastic! How do you 'forget' that? :-)
On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester notifications@github.com
wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
#178 (comment)
.


Reply to this email directly or view it on GitHub:
#178 (comment)

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

I can give it a try. Expect a PR against your branch.

On Fri, Apr 10, 2015 at 5:22 PM, Ali Ebrahim notifications@github.com
wrote:

I already handle the not in path failure mode. I'm not sure what exactly
you guys want to do with pexpect... can someone else replace the
check_output(["which", "matlab"]) function with the pexpect one?

On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester <
notifications@github.com>
wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
<
#178 (comment)

.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

With the caveat that I can't really test it, because I get that nasty crash
mentioned above.

On Fri, Apr 10, 2015 at 5:23 PM, Ariel Rokem arokem@gmail.com wrote:

I can give it a try. Expect a PR against your branch.

On Fri, Apr 10, 2015 at 5:22 PM, Ali Ebrahim notifications@github.com
wrote:

I already handle the not in path failure mode. I'm not sure what exactly
you guys want to do with pexpect... can someone else replace the
check_output(["which", "matlab"]) function with the pexpect one?

On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester <
notifications@github.com>
wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
<
#178 (comment)

.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@aebrahim
Copy link
Contributor Author

Also, thanks guys for all your work on this module. I really love it for
calling MATLAB functions from the IPython notebook and it's made my life so
much easier. You've also been great to work with too :)

On Fri, Apr 10, 2015 at 5:21 PM, Ali Ebrahim aebrahim@ucsd.edu wrote:

I already handle the not in path failure mode. I'm not sure what exactly
you guys want to do with pexpect... can someone else replace the
check_output(["which", "matlab"]) function with the pexpect one?

On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester <
notifications@github.com> wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
#178 (comment)
.

@aebrahim
Copy link
Contributor Author

I'm surprised you get that crash even when you compile yourself. Is it
because I changed the default matlab version? Otherwise I don't see how any
of my changes would affect this.
On Apr 10, 2015 5:25 PM, "Steven Silvester" notifications@github.com
wrote:

Too many irons in the fire. :)


Sent from Mailbox

On Fri, Apr 10, 2015 at 7:22 PM, Ariel Rokem notifications@github.com
wrote:

That's fantastic! How do you 'forget' that? :-)
On Fri, Apr 10, 2015 at 5:20 PM, Steven Silvester <
notifications@github.com>
wrote:

I forgot I had made a Windows compliant version of pexpect's which here:
https://github.com/Calysto/metakernel/blob/master/metakernel/pexpect.py


Reply to this email directly or view it on GitHub
<
#178 (comment)

.


Reply to this email directly or view it on GitHub:

#178 (comment)


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

OK - I think this is the pexpect 'which' implementation: https://github.com/aebrahim/python-matlab-bridge/pull/1. Is it overkill?

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

And I still get that nasty dump when compiling this. I'll keep trying a bit more on that.

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

Also: happy to hear that you are having a good time hacking on this, and that it's been useful for you. I am also enjoying this!

@jjangsangy
Copy link

@arokem @aebrahim are either of you running a scipy stack compiled using intel MKL, Anaconda MKL or Intel Parallel Studio C++ compositor?

The issue may be related to this problem with matlab compiling against wrong BLAS library at link time.

https://software.intel.com/en-us/forums/topic/486842
https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files

@aebrahim
Copy link
Contributor Author

No my mac install is super vanilla.
On Apr 10, 2015 8:06 PM, "Sang Han" notifications@github.com wrote:

@arokem https://github.com/arokem @aebrahim
https://github.com/aebrahim are either of you running a scipy stack
compiled using intel MKL or Intel Parallel Studio C++ compositor?

The issue may be related to this problem with matlab compiling against
wrong BLAS library at link time.

https://software.intel.com/en-us/forums/topic/486842

https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files


Reply to this email directly or view it on GitHub
#178 (comment)
.

@aebrahim
Copy link
Contributor Author

I used clang
On Apr 10, 2015 8:25 PM, aebrahim@ucsd.edu wrote:

No my mac install is super vanilla.
On Apr 10, 2015 8:06 PM, "Sang Han" notifications@github.com wrote:

@arokem https://github.com/arokem @aebrahim
https://github.com/aebrahim are either of you running a scipy stack
compiled using intel MKL or Intel Parallel Studio C++ compositor?

The issue may be related to this problem with matlab compiling against
wrong BLAS library at link time.

https://software.intel.com/en-us/forums/topic/486842

https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files


Reply to this email directly or view it on GitHub
#178 (comment)
.

@jjangsangy
Copy link

Interesting, that's similar to my configuration.

Actually went and cloned this fork, compiled messenger and installed a fresh copy and everything seems to be working fine.

I kind of cheated and just ran the mex build command manually on the terminal rather than doing it through make.py, but that shouldn't be an issue unless it's the Python code that is linking to the wrong libraries.

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

Bingo! That must be it. I switched to mkl last week

On Friday, April 10, 2015, Sang Han notifications@github.com wrote:

Interesting, that's similar to mine.

Actually pulled this fork, compiled messenger and installed a fresh copy
and everything seems to be working fine. I kind of cheated and just ran the
mex build command manually on the terminal rather than doing it through
make.py, but that shouldn't be an issue unless it's the Python code that
is linking to the wrong libraries.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@arokem
Copy link
Owner

arokem commented Apr 11, 2015

OK - the problem I've seen in the tests is also intermittent. That is, I
can get the example notebooks to run just fine with this compiled mex. I
propose we merge this PR, and keep an eye out on this thing. I will give it
another try, after creating an environment without MKL, possibly tomorrow.

Is this ready to be merged from your point of view @aebrahim?

On Fri, Apr 10, 2015 at 9:40 PM, Ariel Rokem arokem@gmail.com wrote:

Bingo! That must be it. I switched to mkl last week

On Friday, April 10, 2015, Sang Han notifications@github.com wrote:

Interesting, that's similar to mine.

Actually pulled this fork, compiled messenger and installed a fresh copy
and everything seems to be working fine. I kind of cheated and just ran the
mex build command manually on the terminal rather than doing it through
make.py, but that shouldn't be an issue unless it's the Python code that
is linking to the wrong libraries.


Reply to this email directly or view it on GitHub
#178 (comment)
.

@aebrahim
Copy link
Contributor Author

Yup compete on my end
On Apr 10, 2015 11:28 PM, "Ariel Rokem" notifications@github.com wrote:

OK - the problem I've seen in the tests is also intermittent. That is, I
can get the example notebooks to run just fine with this compiled mex. I
propose we merge this PR, and keep an eye out on this thing. I will give it
another try, after creating an environment without MKL, possibly tomorrow.

Is this ready to be merged from your point of view @aebrahim?

On Fri, Apr 10, 2015 at 9:40 PM, Ariel Rokem arokem@gmail.com wrote:

Bingo! That must be it. I switched to mkl last week

On Friday, April 10, 2015, Sang Han notifications@github.com wrote:

Interesting, that's similar to mine.

Actually pulled this fork, compiled messenger and installed a fresh copy
and everything seems to be working fine. I kind of cheated and just ran
the
mex build command manually on the terminal rather than doing it through
make.py, but that shouldn't be an issue unless it's the Python code that
is linking to the wrong libraries.


Reply to this email directly or view it on GitHub
<
#178 (comment)

.


Reply to this email directly or view it on GitHub
#178 (comment)
.

arokem added a commit that referenced this pull request Apr 11, 2015
Add updated compiled MATLAB messenger mex
@arokem arokem merged commit ab0cdb5 into arokem:master Apr 11, 2015
@arokem
Copy link
Owner

arokem commented Apr 24, 2015

For future reference, my MKL pains (see above) have been resolved following advice from here:

http://stackoverflow.com/questions/20554074/sklearn-omp-error-15-when-fitting-models

And setting:

export KMP_DUPLICATE_LIB_OK="TRUE"

In my bash configuration file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants