From: Riccardo M. <ric...@gm...> - 2011-06-23 15:38:59
|
Hello, I'm trying to run some MatLab compiled code in a x86_64 Debian squeeze UML; unfortunately, the code crashes and the backtrace indicates that the problem is due to a failing clone() call. Googling the issue, I found hints that this might be because UML does not support NPTL, which is the threading model used by Debian's glibc on x86_64. So, questions: 1) does UML support NPTL? if not, is this a coming feature? 2) is there any workaround to disable NPTL in glibc/x86_64? (e.g., by substituting it with Linuxthreads...) Thanks for any suggestion! Riccardo |
From: richard -r. w. <ric...@gm...> - 2011-06-23 16:11:02
|
On Thu, Jun 23, 2011 at 5:38 PM, Riccardo Murri <ric...@gm...> wrote: > Hello, > > I'm trying to run some MatLab compiled code in a x86_64 Debian squeeze UML; > unfortunately, the code crashes and the backtrace indicates that the problem is > due to a failing clone() call. > UML had some problems with threads, but now every should work fine. Even on x86_64. :-) Where exactly does the code fail? Please provide us a stand-alone test case. Does the program work in UML/i386? -- Thanks, //richard |
From: Riccardo M. <ric...@gm...> - 2011-06-23 21:16:55
|
Hi Richard, On Thu, Jun 23, 2011 at 6:10 PM, richard -rw- weinberger <ric...@gm...> wrote: > On Thu, Jun 23, 2011 at 5:38 PM, Riccardo Murri > <ric...@gm...> wrote: >> I'm trying to run some MatLab compiled code in a x86_64 Debian squeeze UML; >> unfortunately, the code crashes and the backtrace indicates that the problem is >> due to a failing clone() call. > > UML had some problems with threads, > but now every should work fine. > Even on x86_64. :-) > > Where exactly does the code fail? > Please provide us a stand-alone test case. > Being MatLab stuff, I'm afraid I cannot provide a full test case; this is the top of the stack as it gets dumped out after the crash: [...] [ 13] 0x00000000452951c3 /mnt/dev/uml/matlab/MATLAB/MATLAB_Compiler_Runtime/v713/bin/glnxa64/../../bin/glnxa64/libmwservices.so+00668099 services::threading::ComputationalThreadsInit::ComputationalThreadsInit(bool)+000051 [ 14] 0x0000000044fa38d3 /mnt/dev/uml/matlab/MATLAB/MATLAB_Compiler_Runtime/v713/bin/glnxa64/../../bin/glnxa64/libmwmcr.so+00129235 [ 15] 0x0000000044fa3afb /mnt/dev/uml/matlab/MATLAB/MATLAB_Compiler_Runtime/v713/bin/glnxa64/../../bin/glnxa64/libmwmcr.so+00129787 [ 16] 0x00000000406f88ba /lib/libpthread.so.0+00026810 [ 17] 0x00000000409dd02d /lib/libc.so.6+00847917 clone+000109 The code is running in the Debian 6 image from devloop.co.uk [1] (no modifications save for installing a few X libraries required by MatLab via apt-get) with the 2.6.39 kernel from the same site. [1]: http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-AMD64-root_fs.bz2 > Does the program work in UML/i386? > Unfortunately I don't know: I currently only have access to the x86_64 MatLab compiler and libraries. (For the record, the code runs fine on a physical machine and in KVM-based virtual hosts, so it's really a UML issue.) Thanks for your help! Riccardo |
From: richard -r. w. <ric...@gm...> - 2011-06-23 21:45:13
|
Riccardo, On Thu, Jun 23, 2011 at 11:16 PM, Riccardo Murri <ric...@gm...> wrote: > Being MatLab stuff, I'm afraid I cannot provide a full test case; this > is the top of the stack as it gets dumped out after the crash: > > [...] > [ 13] 0x00000000452951c3 > /mnt/dev/uml/matlab/MATLAB/MATLAB_Compiler_Runtime/v713/bin/glnxa64/../../bin/glnxa64/libmwservices.so+00668099 > services::threading::ComputationalThreadsInit::ComputationalThreadsInit(bool)+000051 > [ 14] 0x0000000044fa38d3 > /mnt/dev/uml/matlab/MATLAB/MATLAB_Compiler_Runtime/v713/bin/glnxa64/../../bin/glnxa64/libmwmcr.so+00129235 > [ 15] 0x0000000044fa3afb > /mnt/dev/uml/matlab/MATLAB/MATLAB_Compiler_Runtime/v713/bin/glnxa64/../../bin/glnxa64/libmwmcr.so+00129787 > [ 16] 0x00000000406f88ba > /lib/libpthread.so.0+00026810 > [ 17] 0x00000000409dd02d > /lib/libc.so.6+00847917 clone+000109 Can you run strace on your program? I'm wondering whether clone() fails or succeeds. Maybe you're simple running out of memory and clone() fails with ENOMEM... Does the program crash with SIGSEGV? > The code is running in the Debian 6 image from devloop.co.uk [1] > (no modifications save for installing a few X libraries required by > MatLab via apt-get) with the 2.6.39 kernel from the same site. > > [1]: http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-AMD64-root_fs.bz2 > > >> Does the program work in UML/i386? >> > > Unfortunately I don't know: I currently only have access to the x86_64 > MatLab compiler and libraries. > > (For the record, the code runs fine on a physical machine and in > KVM-based virtual hosts, so it's really a UML issue.) > Yeah, maybe. -- Thanks, //richard |
From: richard -r. w. <ric...@gm...> - 2011-06-24 07:07:48
|
On Thu, Jun 23, 2011 at 11:16 PM, Riccardo Murri <ric...@gm...> wrote: > Being MatLab stuff, I'm afraid I cannot provide a full test case; this > is the top of the stack as it gets dumped out after the crash: > BTW: What exactly are you doing with MatLab? I have access to various MatLab installations. With the correct command line and your sources I could test if for my own... -- Thanks, //richard |
From: Riccardo M. <ric...@gm...> - 2011-06-24 09:35:49
|
Hi Richard, On Fri, Jun 24, 2011 at 9:07 AM, richard -rw- weinberger <ric...@gm...> wrote: > On Thu, Jun 23, 2011 at 11:16 PM, Riccardo Murri > <ric...@gm...> wrote: >> Being MatLab stuff, I'm afraid I cannot provide a full test case; this >> is the top of the stack as it gets dumped out after the crash: > > BTW: What exactly are you doing with MatLab? > I have access to various MatLab installations. > > With the correct command line and your sources I could test if for my own... > I'm trying to run the `magicsquare.m` example from the MatLab website: http://www.mathworks.com/help/toolbox/compiler/bsl9c8_.html#bsl9d27 I compile the sources with: mcc -mv magicsquare.m The `mcc` compiler is from MatLab R2010a; the MatLab compiler runtime is v7.1.3. I compile on SLES 11 and try to run on the Debian UML: root@(none):~# uname -a Linux (none) 2.6.39.1 #2 Fri Jun 3 07:24:52 Local time zone must be set--see zic manua x86_64 GNU/Linux root@(none):~# cat /etc/debian_version 6.0.1 Both the filesystem and the kernel are the ones provided by devloop.co.uk: filesystem:http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-AMD64-root_fs.bz2 kernel: http://uml.devloop.org.uk/ Thank you very much for investingating! Riccardo |
From: Riccardo M. <ric...@gm...> - 2011-08-15 09:52:41
|
Hi, I'm resurrecting this old thread just to summarize the final outcome for people coming to it from archive searches. The "clone" stack trace has nothing to do with the real cause of the error: starting with version R2010b, the MatLab runtime fails instead with an "out of memory" error. Indeed, running "strace" on the compiled program shows that it is trying to allocate 128GiB of memory, although the UML has a few GB of total virtual memory, and of course fails: ... mmap(NULL, 137438953472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) brk(0x2000ac6000) = 0xaee000 mmap(NULL, 137439088640, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x4051c56000 munmap(0x4051c56000, 37396480) = 0 munmap(0x4058000000, 29712384) = 0 mprotect(0x4054000000, 135168, PROT_READ|PROT_WRITE) = 0 mmap(NULL, 137438953472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) ... A request to MatLab support was closed with the statement: I investigated further into this, but we could not get MATLAB to run on the virtualized kernel provided by UML. [...] MathWorks does not test or design the MATLAB products for use with virtual operating systems, thus virtual operating systems are not supported for use with the MATLAB products. However, while this is unsupported, there may be other virtual environments where MATLAB does work. The latest version of the MatLab Compiler runtime that I've tried is v715 (from MatLab R2011a); up to that version there is apparently no way of running compiled MatLab programs in a UML virtual machine. A big "thank you!" to Richard Weinberger for all his help in investigating this issue off-line. Best regards, Riccardo |
From: Riccardo M. <ric...@gm...> - 2011-08-31 13:46:07
|
Hello, A final update on this old thread. Good news: thanks to Rick Amos of MathWorks support, this problem has finally been solved. It seems that the issue really lies in the threading mechanism/library used by MatLab compiled code. So the fix is to compile your MatLab code with the "-singleCompThread" switch, e.g.: mcc -R '-nojvm,-nodisplay,-singleCompThread' magicsquare.m I tested the above with the MatLab compiler from R2011a and the compiled code correctly runs in a UML virtual machine running Debian 6. Regards, Riccardo -- Riccardo Murri Grid Computing Competence Centre, http://www.gc3.uzh.ch/ Organisch-Chemisches Institut, University of Zurich Winterthurerstrasse 190, CH-8057 Zürich (Switzerland) Tel: +41 44 635 4222 Fax: +41 44 635 6888 |