linking to MKL VML libraries with ILP64

92 views
Skip to first unread message

Sergei Morozov

unread,
Dec 27, 2013, 2:54:57 AM12/27/13
to num...@googlegroups.com
As I have been trying to build numexpr using MKL-linked numpy, I came across a post in this group which was apparently the source of site.cfg.example included in version 2.2.2. That example did not work for me, since my home-grown numpy was linked to ILP64 libraries from MKL, not LP64, although older examples in that file refering to ILP64 libraries seemed to indicate that doing so was possible.

Upon investigation, it appeared that interpreter.cpp has a bunch of typedefs like
typedef void (*FuncFFPtr_vml)(int, const float*, float*);

However, according to /opt/intel/mkl/include/mkl_vml_functions.h, MKL defines first input as MKL_INT which means (see mkl_types.h) long long for ILP64 and int for LP64. 
So I solved my problem by cloning typedefs with a bunch of #ifdef MKL_ILP64 (since the way to tell numpy to link to ILP64 MKL is via -DMKL_ILP64 compiler flag). So far seems to be working but I have not tested too extensively.

Not sure if that is the right way to handle a situation like this, but I think something needs to be done to allow either kind of MKL work with numexpr

Cheers,
   Sergei

Francesc Alted

unread,
Dec 27, 2013, 4:29:14 AM12/27/13
to num...@googlegroups.com
Hi Sergei,

Well, it seems to me that the problem is mostly with the VML functions
right? So why not simply replace the 'int' in these functions by
MKL_INT? That should work for all platforms I think. Can you check
this out and send a patch in case that works?

Francesc
> --
> You received this message because you are subscribed to the Google
> Groups "numexpr" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to numexpr+u...@googlegroups.com.
> To post to this group, send email to num...@googlegroups.com.
> Visit this group at http://groups.google.com/group/numexpr.
> For more options, visit https://groups.google.com/groups/opt_out.


--
Francesc Alted

Sergei Morozov

unread,
Dec 28, 2013, 1:52:48 AM12/28/13
to num...@googlegroups.com
Hi Francesc,

I checked your suggestion for ILP64 and it works. I have not yet tested if it works for LP64 also, since this would require rebuilding numpy/scipy with LP64. I'll see if I can do clean back and forth between the two.

Francesc Alted

unread,
Dec 28, 2013, 6:55:52 AM12/28/13
to num...@googlegroups.com
Great. If Intel properly implemented INT_MKL, I would not expect
problems in any platform, but an additional check would be nice.

Francesc
> > an email to numexpr+u...@googlegroups.com <javascript:>.
> > To post to this group, send email to num...@googlegroups.com
> <javascript:>.
> <http://groups.google.com/group/numexpr>.
> > For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
> --
> Francesc Alted

Sergei Morozov

unread,
Jan 3, 2014, 9:31:46 PM1/3/14
to num...@googlegroups.com
It worked for LP64 also, as expected. Attached is a patch.
interpreter.cpp.patch

Francesc Alted

unread,
Jan 4, 2014, 4:32:06 AM1/4/14
to num...@googlegroups.com
Excellent. Fixed in the 'default' branch. Thanks!

Francesc
Reply all
Reply to author
Forward
0 new messages