Re: [cmake-developers] Is there an official FindMKL module?

2015-08-28 Thread Siebren Reker
Hi Tim,

On Thu, Aug 27, 2015 at 7:32 PM, Tim Gallagher tim.gallag...@gatech.edu
wrote:

 Hi Siebren,

 I tried to link statically and it did not work for me, similar errors as
 to what you are getting.


Ok, thank you for verifying


 The way the macro is supposed to work -- it checks for the MKL link tool
 and if it is available, it uses and provides the libraries needed. If it is
 unavailable (or throws errors or whatever else the case may be), then
 FindBLAS reverts back to the way it handles MKL currently.


Sound good to me.


 I have attached the module that provides the interface to the MKL command
 line tool as well as the changed FindBLAS module that uses it. Major caveat
 here -- I have not used these since 2012, with one of the Intel
 12.something compilers and CMake 2.8. I did a quick diff on the FindBLAS in
 the current version and the CMake 2.8 version and there's only very minor
 changes that shouldn't affect this working. If it turns out this is useful
 and close to functional, then we can work on getting it current.


What you have sent feels 80% complete. It doesn't work out of the box, but
I could hack some small changes in to get some things working. I won't have
more time for this today, so here is what I've spotted so far, in case you
want to continue on this now.
- The calls to the macro (in FindBLAS.cmake) don't match with the macro
input in GetIntelMKLInfo, maybe you were adding additional parameters for
the mkl version and things such as integer representation, but hadn't
gotten around to adding them in the macro? Removing them from
FindBLAS.cmake allowed me to test further, but I can see that some more
inputs to the MKL command line tool need to be supported.
- The static flag was giving errors on the command line, an easy fix was to
use the same syntax as for the other flags:
 list(APPEND mkl_tool_opts --linking=static)
- The stripping off of the additional libraries is very nice, but the regex
for the math library is overzealous: -lm matches all -lmkl_intel_thread
etc.
- The grouping of the static libraries results in them being parsed as
static_flags, which leaves the final mkl_libs empty. Even though all
information has correctly been extracted, the macro then reports failure.
- I was not sure about the tool1 vs tool2 differences, was this also
intermediate work on getting the mkl_version information in?

I'll have more time to look at this next week, thanks for sharing this.

best,
Siebren
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Is there an official FindMKL module?

2015-08-27 Thread Siebren Reker
Hi Tim,

On Thu, Aug 27, 2015 at 4:32 PM, Tim Gallagher tim.gallag...@gatech.edu
wrote:

 Siebren,

 We've never really used static linking so I am not sure if it ever really
 worked. I can try and let you know.


Could you please do so? Just to verify that I'm not doing something
obviously wrong


 However, I'm having flashbacks here to something I thought I had done
 before. I dug through my emails and back in 2012 I had signed up to
 maintain a new module that provided a macro to interface with the MKL tool
 and generated the proper linking based on what it reported. My colleague
 and I had written it because we were tired of the difficulties in the
 current modules. This new module provided a macro and the FindBLAS and
 FindLAPACK modules would call the macro to get the link information.


Sounds clean, but are you sure the tool is always available?


 I got push access to create the topic branch but then I don't know what
 happened. I don't know if I never pushed it, or it never got
 tested/approved/checked, no clue. I actually still have all of the modules
 and changes I had made, but it was in version 2.8. I wish I could remember
 if I had actually pushed it to CMake or not, but I really don't remember
 why it never happened.

 So anyway, now that we're discussing it again, if the CMake community
 wants the MKL support improved, I can dust off the modules and see what it
 would take to get it officially in the stream.


I'd be more than happy to test this. I've found a number of hits on Google
for FindMKL.cmake files. I certainly wasn't alone in having trouble to get
this to work (doesn't mean much of course).

best,
Siebren


 Tim

 --
 *From: *Siebren Reker siebren.re...@gmail.com
 *To: *tim gallagher tim.gallag...@gatech.edu
 *Cc: *cmake-developers@cmake.org
 *Sent: *Thursday, August 27, 2015 6:32:17 AM
 *Subject: *Re: [cmake-developers] Is there an official FindMKL module?


 Hi Tim,

 Quick add-on to my previous email. With BLA_STATIC ON, I see from the
 CMakeError.log that the static libraries ARE found (I was trusting the),
 but the linking of the test program goes wrong:
 undefined reference to `mkl_blas_sgemv`
 But that function IS implemented in one of the three libraries that is
 found, in my case in libmkl_sequential.a

 So this is probably a linking/ library ordering error.
 Indeed, Intel fora and the link advisor I mentioned earlier also report
 the need for grouping these as in
  -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a
 ${MKLROOT}/lib/intel64/libmkl_core.a
 ${MKLROOT}/lib/intel64/libmkl_sequential.a -Wl,--end-group

 Is my understanding correct, and can this be fixed?

 kind regards,
 Siebren


 On Thu, Aug 27, 2015 at 11:50 AM, Siebren Reker siebren.re...@gmail.com
 wrote:

 Hi Tim,

 That is encouraging, thanks. I went back and tried harder this time, when
 I specified BLA_VENDOR precisely and leave BLA_STATIC off, I am able to get
 to the correct versions.
 In the very same directory where the shared libraries are found, I have
 the static libraries as well, but BLA_STATIC on in that case does not find
 the libraries.

 I've read up a bit on this now, so maybe the following information is
 helpful:
 This is a CMake 3.3.0 installation
 My project has both C and Fortran enabled
 I call it as follows:

 set( BLA_STATIC ON)
 set( BLA_VENDOR Intel10_64lp_seq)
 find_package( BLAS )

 Is BLA_STATIC = ON working for you?

 A separate question I have is if the linker command that will be produced
 afterwards is of course different from the one supplied by Intel in their
 tool. Should that not concern me?

 kind regards,
 Siebren


 On Wed, Aug 26, 2015 at 4:59 PM, Tim Gallagher tim.gallag...@gatech.edu
 wrote:

 We sometime struggled to get it working, but we never had to resort to
 using a FindMKL -- FindBLAS and FindLAPACK work just fine for us, provided
 we do things correctly.

 So long as we have sourced the mklvars script that ships with Intel MKL
 and we put:

 BLA_VENDOR=Intel10_64lp_seq ccmake /path/to/source/dir


 Then everything works fine and we have no issues. So we have to give
 CMake a hint that we want to pick the Intel version rather than the generic
 one (and we're using the sequential, 64bit MKL -- if you look in FindBLAS
 you can see other vendor types).

 Have you had things fail when you setup your environment variables using
 the scripts Intel provides and when you set the BLA_VENDOR hint as an
 environment variable?

 Tim

 --
 *From: *Siebren Reker siebren.re...@gmail.com
 *To: *cmake-developers@cmake.org
 *Sent: *Wednesday, August 26, 2015 10:18:44 AM
 *Subject: *[cmake-developers] Is there an official FindMKL module?


 Hello,

 I am using the find_package() command to load settings for the Intel
 Math Kernel Library (MKL). This works through a custom FindMKL.cmake module
 that I've made for myself.

 However, when looking at:
 https://software.intel.com/en-us/articles/intel-mkl-link

Re: [cmake-developers] Is there an official FindMKL module?

2015-08-27 Thread Siebren Reker
Hi Tim,

That is encouraging, thanks. I went back and tried harder this time, when I
specified BLA_VENDOR precisely and leave BLA_STATIC off, I am able to get
to the correct versions.
In the very same directory where the shared libraries are found, I have the
static libraries as well, but BLA_STATIC on in that case does not find the
libraries.

I've read up a bit on this now, so maybe the following information is
helpful:
This is a CMake 3.3.0 installation
My project has both C and Fortran enabled
I call it as follows:

set( BLA_STATIC ON)
set( BLA_VENDOR Intel10_64lp_seq)
find_package( BLAS )

Is BLA_STATIC = ON working for you?

A separate question I have is if the linker command that will be produced
afterwards is of course different from the one supplied by Intel in their
tool. Should that not concern me?

kind regards,
Siebren


On Wed, Aug 26, 2015 at 4:59 PM, Tim Gallagher tim.gallag...@gatech.edu
wrote:

 We sometime struggled to get it working, but we never had to resort to
 using a FindMKL -- FindBLAS and FindLAPACK work just fine for us, provided
 we do things correctly.

 So long as we have sourced the mklvars script that ships with Intel MKL
 and we put:

 BLA_VENDOR=Intel10_64lp_seq ccmake /path/to/source/dir


 Then everything works fine and we have no issues. So we have to give CMake
 a hint that we want to pick the Intel version rather than the generic one
 (and we're using the sequential, 64bit MKL -- if you look in FindBLAS you
 can see other vendor types).

 Have you had things fail when you setup your environment variables using
 the scripts Intel provides and when you set the BLA_VENDOR hint as an
 environment variable?

 Tim

 --
 *From: *Siebren Reker siebren.re...@gmail.com
 *To: *cmake-developers@cmake.org
 *Sent: *Wednesday, August 26, 2015 10:18:44 AM
 *Subject: *[cmake-developers] Is there an official FindMKL module?


 Hello,

 I am using the find_package() command to load settings for the Intel Math
 Kernel Library (MKL). This works through a custom FindMKL.cmake module that
 I've made for myself.

 However, when looking at:
 https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
 I can tell that what I've done is likely only correct for my specific
 case, and certainly not robust against library version changes and various
 other changes (openmp, static vs dynamic linking etc.).

 Instead of a FindMKL.cmake module, an alternative is to have MKL be
 discovered in the FindBLAS or FindLAPACK modules, but according to what I
 can find on the bug tracker, that solution is also in a fairly broken state:
 Bug 14138: http://www.cmake.org/Bug/view.php?id=14138
 Bug 13543: http://www.cmake.org/Bug/view.php?id=13543
 Bug 13528: http://www.cmake.org/Bug/view.php?id=13528

 Google tells me that many people have (like me) created their own
 FindMKL.cmake module, which are equally specific and tailored.

 Is anyone aware of a more official FindMKL module available somewhere,
 or at least something that is being somewhat maintained, either by someone
 at Kitware or Intel? Or of a plan to develop something like that?

 kind regards,
 Siebren Reker

 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Is there an official FindMKL module?

2015-08-27 Thread Siebren Reker
Hi Tim,

Quick add-on to my previous email. With BLA_STATIC ON, I see from the
CMakeError.log that the static libraries ARE found (I was trusting the),
but the linking of the test program goes wrong:
undefined reference to `mkl_blas_sgemv`
But that function IS implemented in one of the three libraries that is
found, in my case in libmkl_sequential.a

So this is probably a linking/ library ordering error.
Indeed, Intel fora and the link advisor I mentioned earlier also report the
need for grouping these as in
 -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a
${MKLROOT}/lib/intel64/libmkl_core.a
${MKLROOT}/lib/intel64/libmkl_sequential.a -Wl,--end-group

Is my understanding correct, and can this be fixed?

kind regards,
Siebren


On Thu, Aug 27, 2015 at 11:50 AM, Siebren Reker siebren.re...@gmail.com
wrote:

 Hi Tim,

 That is encouraging, thanks. I went back and tried harder this time, when
 I specified BLA_VENDOR precisely and leave BLA_STATIC off, I am able to get
 to the correct versions.
 In the very same directory where the shared libraries are found, I have
 the static libraries as well, but BLA_STATIC on in that case does not find
 the libraries.

 I've read up a bit on this now, so maybe the following information is
 helpful:
 This is a CMake 3.3.0 installation
 My project has both C and Fortran enabled
 I call it as follows:

 set( BLA_STATIC ON)
 set( BLA_VENDOR Intel10_64lp_seq)
 find_package( BLAS )

 Is BLA_STATIC = ON working for you?

 A separate question I have is if the linker command that will be produced
 afterwards is of course different from the one supplied by Intel in their
 tool. Should that not concern me?

 kind regards,
 Siebren


 On Wed, Aug 26, 2015 at 4:59 PM, Tim Gallagher tim.gallag...@gatech.edu
 wrote:

 We sometime struggled to get it working, but we never had to resort to
 using a FindMKL -- FindBLAS and FindLAPACK work just fine for us, provided
 we do things correctly.

 So long as we have sourced the mklvars script that ships with Intel MKL
 and we put:

 BLA_VENDOR=Intel10_64lp_seq ccmake /path/to/source/dir


 Then everything works fine and we have no issues. So we have to give
 CMake a hint that we want to pick the Intel version rather than the generic
 one (and we're using the sequential, 64bit MKL -- if you look in FindBLAS
 you can see other vendor types).

 Have you had things fail when you setup your environment variables using
 the scripts Intel provides and when you set the BLA_VENDOR hint as an
 environment variable?

 Tim

 --
 *From: *Siebren Reker siebren.re...@gmail.com
 *To: *cmake-developers@cmake.org
 *Sent: *Wednesday, August 26, 2015 10:18:44 AM
 *Subject: *[cmake-developers] Is there an official FindMKL module?


 Hello,

 I am using the find_package() command to load settings for the Intel Math
 Kernel Library (MKL). This works through a custom FindMKL.cmake module that
 I've made for myself.

 However, when looking at:
 https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
 I can tell that what I've done is likely only correct for my specific
 case, and certainly not robust against library version changes and various
 other changes (openmp, static vs dynamic linking etc.).

 Instead of a FindMKL.cmake module, an alternative is to have MKL be
 discovered in the FindBLAS or FindLAPACK modules, but according to what I
 can find on the bug tracker, that solution is also in a fairly broken state:
 Bug 14138: http://www.cmake.org/Bug/view.php?id=14138
 Bug 13543: http://www.cmake.org/Bug/view.php?id=13543
 Bug 13528: http://www.cmake.org/Bug/view.php?id=13528

 Google tells me that many people have (like me) created their own
 FindMKL.cmake module, which are equally specific and tailored.

 Is anyone aware of a more official FindMKL module available somewhere,
 or at least something that is being somewhat maintained, either by someone
 at Kitware or Intel? Or of a plan to develop something like that?

 kind regards,
 Siebren Reker

 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http

[cmake-developers] Is there an official FindMKL module?

2015-08-26 Thread Siebren Reker
Hello,

I am using the find_package() command to load settings for the Intel Math
Kernel Library (MKL). This works through a custom FindMKL.cmake module that
I've made for myself.

However, when looking at:
https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
I can tell that what I've done is likely only correct for my specific case,
and certainly not robust against library version changes and various other
changes (openmp, static vs dynamic linking etc.).

Instead of a FindMKL.cmake module, an alternative is to have MKL be
discovered in the FindBLAS or FindLAPACK modules, but according to what I
can find on the bug tracker, that solution is also in a fairly broken state:
Bug 14138: http://www.cmake.org/Bug/view.php?id=14138
Bug 13543: http://www.cmake.org/Bug/view.php?id=13543
Bug 13528: http://www.cmake.org/Bug/view.php?id=13528

Google tells me that many people have (like me) created their own
FindMKL.cmake module, which are equally specific and tailored.

Is anyone aware of a more official FindMKL module available somewhere, or
at least something that is being somewhat maintained, either by someone at
Kitware or Intel? Or of a plan to develop something like that?

kind regards,
Siebren Reker
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers