Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ippiFilterColumn and Matlab

kavermeer
Beginner
302 Views
Hi,

I'm using IPP 5.1.1 (for Linux) from within Matlab through mex-files, which is just wrapper code written in C (or Fortran). I've succesfully used this approach for various IPP functions, but I have problems with ippiFilterColumn:

If I start matlab and run my test program (see below), then either Matlab crashes, or it gives a segmentation error after exiting the program. Note that if I do 'ippilibraryversion' (which is a wrapper for ippiGetLibVersion), I get 'libippit7.so.5.1 5.1.1 5.1.133.272', and Matlab can exit gracefully.

The test code is as follows:

#include "mex.h"
#include "/opt/intel/ipp/5.1/ia32/include/ipp.h"

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
IppiSize roiSize = {1,1};
IppStatus st;
Ipp32f kernel=2;
Ipp32f srcData=3;
Ipp32f res;
st = ippiFilterColumn_32f_C1R(&srcData, 4, &res, 4, roiSize, &kernel, 1, 0);
if ( st ) mexPrintf("%d:%s ",st,ippGetStatusString(st));
}

Some comments:
- The arguments are not used; that is all Matlab interfacing stuff that I've removed for the test routine. mexPrintf is just a wrapper of the printf function that creates output in the Matlab window.
- I tried to create the simplest case, so I think there are no boundary issues.
- The result is correct ('res' contains 6; st is 0).
- If I remove the 'st = ippiFilterColumn...' line, Matlab does not crash.
- I compile this by running 'mex ippifiltercolumntest.cpp -L/opt/intel/ipp/5.1/ia32/lib/ -L/opt/intel/ipp/5.1/ia32/sharedlib/ -lippi'

Is there something obviously wrong with my use of ippiFilterColumn? Let me know if you need more details. Unfortunately, I don't know enough about debugging C code to find the source of the error...


Thanks!

Koen

(I might not be able to respond to inquiries very soon, as I'm off for some time, but I'll be sure to check back to the forum!)

0 Kudos
2 Replies
Vladimir_Dudnik
Employee
302 Views

Hello Koen

we were not able to reproduce any issues with this function (in version of IPP 5.1.1). Please see additional comment from our expert:

As concerning debugging the simplest way to find the place code that leads to issue is:
gdb
set args
run
Then after a crash:
Copy the gdb output screen and send to us. Also then print disassemble in gdb window and send the output screen to us too.

Regards,
Vladimir

0 Kudos
kavermeer
Beginner
302 Views
Hi Vladimir,

Before the screen dumps: It seems that if I run the same code without the Matlab desktop ('matlab -nodesktop'), the problem disappears. This is not really a nice solution, of course, if I want to use the desktop and my code. But it gives me a way to run it without crashing spuriously. In addition, it suggests that the problem is due to Matlab's desktop code, and not the IPP library.

Just doing 'gdm matlab' doesn't work:
koen@koen:~/mfiles/linint$ gdb matlab
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"..."/usr/local/bin/matlab": not in executable format: File format not recognized


However, Matlab provides a way to start the debugger, by running 'matlab -Dgdb':
koen@koen:~/mfiles/linint$ matlab -Dgdb
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

(gdb) set args -r "ippifiltercolumntest;exit"
(gdb) run
Starting program: /usr/local/matlab7p1/bin/glnx86/MATLAB -r "ippifiltercolumntest;exit"
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1241491776 (LWP 28116)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread -1262838864 (LWP 28119)]
[New Thread -1271444560 (LWP 28120)]
[Thread -1271444560 (LWP 28120) exited]
[New Thread -1531647056 (LWP 28121)]
[New Thread -1532175440 (LWP 28122)]
[New Thread -1532703824 (LWP 28123)]
[New Thread -1533232208 (LWP 28126)]
[New Thread -1533760592 (LWP 28127)]
[New Thread -1534288976 (LWP 28128)]
[New Thread -1534817360 (LWP 28129)]
[New Thread -1546425424 (LWP 28130)]
[New Thread -1573409872 (LWP 28131)]
[New Thread -1573938256 (LWP 28132)]
[New Thread -1574466640 (LWP 28133)]
[New Thread -1574995024 (LWP 28134)]
[New Thread -1575523408 (LWP 28135)]
[New Thread -1576051792 (LWP 28136)]
[New Thread -1576580176 (LWP 28137)]
[New Thread -1577108560 (LWP 28138)]
[New Thread -1577636944 (LWP 28139)]
[New Thread -1578251344 (LWP 28142)]
[New Thread -1578779728 (LWP 28143)]
[Thread -1578251344 (LWP 28142) exited]
[New Thread -1578251344 (LWP 28144)]
[Thread -1578251344 (LWP 28144) exited]

< M A T L A B >
Copyright 1984-2005 The MathWorks, Inc.
Version 7.1.0.183 (R14) Service Pack 3
August 02, 2005


To get started, select MATLAB Help or Demos from the Help menu.

[New Thread -1578251344 (LWP 28146)]
[New Thread -1583207504 (LWP 28147)]
[New Thread -1595325520 (LWP 28148)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1574995024 (LWP 28134)]
---Type to continue, or q to quit---
0xae9059b4 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.
[Thread -1575523408 (LWP 28135) exited]
[Thread -1576051792 (LWP 28136) exited]
[Thread -1576580176 (LWP 28137) exited]
[Thread -1577108560 (LWP 28138) exited]

Program received signal SIGSEGV, Segmentation fault.
0xae9059b4 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0xae9059b4 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0xae9059b4 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1583207504 (LWP 28147)]
0xffffe410 in __kernel_vsyscall ()
(gdb) disassemble
Dump of assembler code for function __kernel_vsyscall:
0xffffe400 <__kernel_vsyscall+0>: push %ecx
0xffffe401 <__kernel_vsyscall+1>: push %edx
0xffffe402 <__kernel_vsyscall+2>: push %ebp
0xffffe403 <__kernel_vsyscall+3>: mov %esp,%ebp
0xffffe405 <__kernel_vsyscall+5>: sysenter
0xffffe407 <__kernel_vsyscall+7>: nop
0xffffe408 <__kernel_vsyscall+8>: nop
0xffffe409 <__kernel_vsyscall+9>: nop
0xffffe40a <__kernel_vsyscall+10>: nop
0xffffe40b <__kernel_vsyscall+11>: nop
0xffffe40c <__kernel_vsyscall+12>: nop
0xffffe40d <__kernel_vsyscall+13>:&n bsp; nop
0xffffe40e <__kernel_vsyscall+14>: jmp 0xffffe403 <__kernel_vsyscall+3>
0xffffe410 <__kernel_vsyscall+16>: pop %ebp
0xffffe411 <__kernel_vsyscall+17>: pop %edx
0xffffe412 <__kernel_vsyscall+18>: pop %ecx
0xffffe413 <__kernel_vsyscall+19>: ret
0xffffe414 <__kernel_vsyscall+20>: nop
0xffffe415 <__kernel_vsyscall+21>: nop
0xffffe416 <__kernel_vsyscall+22>: nop
0xffffe417 <__kernel_vsyscall+23>: nop
0xffffe418 <__kernel_vsyscall+24>: nop
0xffffe419 <__kernel_vsyscall+25>: nop
0xffffe41a <__kernel_vsyscall+26>: nop
0xffffe41b <__kernel_vsyscall+27>: nop
0xffffe41c <__kernel_vsyscall+28>: nop
---Type to continue, or q to quit---
0xffffe41d <__kernel_vsyscall+29>: nop
0xffffe41e <__kernel_vsyscall+30>: nop
0xffffe41f <__kernel_vsyscall+31>: nop
End of assembler dump.
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1574995024 (LWP 28134)]
0xae9059b4 in ?? ()
(gdb)disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1241491776 (LWP 28116)]
0xaac3fbf8 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

------------------------------------------------------------------------
Segmentation violation detected at Mon Sep 25 11:01:14 2006
------------------------------------------------------------------------

Program received signal SIGILL, Illegal instruction.
0xb7e1f174 in ?? () from /usr/local/matlab7p1/bin/glnx86/libmwservices.so
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

------------------------------------------------------------------------
Illegal instruction detected at Mon Sep 25 11:01:34 2006
------------------------------------------------------------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1574995024 (LWP 28134)]
0xae9059b4 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1583207504 (LWP 28147)]
0xb6386069 in _XtWaitForSomething () from /usr/lib/libXt.so.6
(gdb) disassemble
Dump of assembler code for function _XtWaitForSomething:
0xb6385970 <_XtWaitForSomething+0>: push %ebp
0xb6385971 <_XtWaitForSomething+1> : mov %esp,%ebp
0xb6385973 <_XtWaitForSomething+3>: push %edi
0xb6385974 <_XtWaitForSomething+4>: push %esi
0xb6385975 <_XtWaitForSomething+5>: push %ebx
0xb6385976 <_XtWaitForSomething+6>: sub $0x19c,%esp
0xb638597c <_XtWaitForSomething+12>: movzbl 0xc(%ebp),%eax
0xb6385980 <_XtWaitForSomething+16>: movzbl 0x10(%ebp),%edx
0xb6385984 <_XtWaitForSomething+20>: movzbl 0x14(%ebp),%ecx
0xb6385988 <_XtWaitForSomething+24>: movb $0x1,0xfffffff3(%ebp)
0xb638598c <_XtWaitForSomething+28>: mov %al,0xfffffe86(%ebp)
0xb6385992 <_XtWaitForSomething+34>: movzbl 0x18(%ebp),%eax
0xb6385996 <_XtWaitForSomething+38>: movb $0x0,0xfffffff2(%ebp)
0xb638599a <_XtWaitForSomething+42>: mov %dl,0xfffffe85(%ebp)
0xb63859a0 <_XtWaitForSomething+48>: movzbl 0x1c(%ebp),%edx
0xb63859a4 <_XtWaitForSomething+52>: mov %cl,0xfffffe84(%ebp)
0xb63859aa <_XtWaitForSomething+58>: movzbl 0x20(%ebp),%ecx
0xb63859ae <_XtWaitForSomething+62>: mov %al,0xfffffe83(%ebp)
0xb63859b4 <_XtWaitForSomething+68>: mov 0x8(%ebp),%eax
0xb63859b7 <_XtWaitForSomething+71>: call 0xb636bee5
0xb63859bc <_XtWaitForSomething+76>: add $0x25d98,%ebx
0xb63859c2 <_XtWaitForSomething+82>: mov %dl,0xfffffe82(%ebp)
0xb63859c8 <_XtWaitForSomething+88>: movl $0x0,0xffffffec(%ebp)
0xb63859cf <_XtWaitForSomething+95>: mov 0xa4(%eax),%eax
0xb63859d5 <_XtWaitForSomething+101>: mov %dl,0xfffffe87(%ebp)
0xb63859db <_XtWaitForSomething+107>: test %eax,%eax
This just continued for a very long time; I can get the output if you want it anyway.

Thanks for the support!

Koen

0 Kudos
Reply