Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. How to link Qt 2.4.1(32) with Intel MKL lib?
Forum Updated to NodeBB v4.3 + New Features

How to link Qt 2.4.1(32) with Intel MKL lib?

Scheduled Pinned Locked Moved 3rd Party Software
22 Posts 2 Posters 12.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    perry_coxer
    wrote on last edited by
    #1

    I use win8x64, Qt 2.4.1 (32 bit) and I can't use Intel MKL library. All .pro lines that i used did not work.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you sure your are using Qt 2 ?

      What error do you get ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        perry_coxer
        wrote on last edited by
        #3

        I'm sorry, that was Qt creator 2.4.1 I meant. I wanted to launch example with matrix multiplication it was ok with includes. But compiler said "no reference to mkl_alloc". I wrote LIBS+= full path to the first lib file and so on for all the lib files for 32. It was compiled ok, but if executed app failed "because there is no mkl_thread.dll". But I mentioned it in pro file

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You need to add the path to the folder where the dll resides in run environment PATH variable

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            perry_coxer
            wrote on last edited by
            #5

            I will post extra info later. Thanks)

            1 Reply Last reply
            0
            • P Offline
              P Offline
              perry_coxer
              wrote on last edited by
              #6

              Hi! I'm sorry, I've not stated the problem right. I have such a main.c file:
              @#define min(x,y) (((x) < (y)) ? (x) : (y))

              #include <stdio.h>
              #include <stdlib.h>
              #include "mkl.h"

              /* Consider adjusting LOOP_COUNT based on the performance of your computer /
              /
              to make sure that total run time is at least 1 second */
              #define LOOP_COUNT 10

              int main()
              {
              double *A, *B, *C;
              int m, n, p, i, j, k, r;
              double alpha, beta;
              double sum;
              double s_initial, s_elapsed;

              printf ("\n This example measures performance of rcomputing the real matrix product \n"
                      " C=alpha*A*B+beta*C using a triple nested loop, where A, B, and C are \n"
                      " matrices and alpha and beta are double precision scalars \n\n");
              
              m = 2000, p = 200, n = 1000;
              printf (" Initializing data for matrix multiplication C=A*B for matrix \n"
                      " A(%ix%i) and matrix B(%ix%i)\n\n", m, p, p, n);
              alpha = 1.0; beta = 0.0;
              
              printf (" Allocating memory for matrices aligned on 64-byte boundary for better \n"
                      " performance \n\n");
              A = (double *)mkl_malloc( m*p*sizeof( double ), 64 );
              
              return 0;
              

              }
              @
              It includes mkl.h file and uses only one mkl function: mkl_malloc().

              I used http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
              This utility helps to make a link line for different compilers. So I've chosen MSVC in Tools-Preferences Microsoft Visual C++ Compiler 12.0 (x64) and clicked Apply and OK. Then I used link advisor and wrote such a .pro file:
              @TEMPLATE = app
              CONFIG += console
              CONFIG -= qt

              SOURCES += main.c

              INCLUDEPATH += C:\mkl\include
              LIBS += "C:\mkl\lib\mic\libmkl_scalapack_ilp64.a"
              LIBS += "C:\mkl\lib\mic\libmkl_cdft_core.a"
              LIBS += "C:\mkl\lib\mic\libmkl_intel_ilp64.a"
              LIBS += "C:\mkl\lib\mic\libmkl_core.a"
              LIBS += "C:\mkl\lib\mic\libmkl_sequential.a"
              LIBS += "C:\mkl\lib\mic\libmkl_blacs_intelmpi_ilp64.a"
              @

              1 Reply Last reply
              0
              • P Offline
                P Offline
                perry_coxer
                wrote on last edited by
                #7

                And there were such errors:
                C:\Users\Daniel\cholesky\mkl\main.c:65: error: undefined reference to `MKL_malloc'
                :-1: error: collect2: ld returned 1 exit status

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Just to sum up, you did get it building and running in 32bit and now you've changed the architecture and it doesn't build ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    perry_coxer
                    wrote on last edited by
                    #9

                    Well, at first I just want to know what is the main approach to linking to libs. You see, I have three folders in lib-folder of MKL: "ia32", "intel64" and "mic". In "mic" I have .a files and .so files, mostly it's the same, but some of .so files don't have corresponding pair. Next, in ia32 there are only .lib files like mkl_core.lib, but strange thing, some of them have corresponfing file, it looks like this: mkl_core.lib and next to it mkl_core_dll.lib.
                    And at last, in intel64 I have the same thing, names are different from those in ia32 but some og intel64\ files also have a pair mkl_core.lib and mkl_core_dll.lib and so on. And some of files are called like this: mkl_lapack95_ilp64.lib and mkl_lapack95_lp64.lib and so on.
                    So, what files should I add to LIBS var and how.
                    Thank you for quick answers!!)

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Then you need to choose the libraries that matches both your architecture and compiler.

                      Since you already had the 32bit build working reuse the same files but from the intel64 folder.

                      Also ensure that the compiler used is also the 64bit

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        perry_coxer
                        wrote on last edited by
                        #11

                        As far as I can judge I use 32 bit compiler. And I use it in 64 bit Windows and that's the problem? I'll be grateful if you could tell me how to switch to appropriate compiler (considering I'm a newby)).

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          perry_coxer
                          wrote on last edited by
                          #12

                          Oh, and I've never got anything compiled with mkl. My first post was a little desperate and erroneous). One time it was built but did not ran because of mkl_thread.dll not being found on my computer. Programm emitted that error message, but the point is that there is no such dll. There is only mkl_thread_dll.lib and I was't sure I understood this error clearly. And anyway I don't remember what link lines I used that time so that's not what I really want to know. I just want to understand (if possible) what's the conventional and understandable way of arranging libraries and linking to them afterwards, and how to apply such a useful knowledge to this case.

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            perry_coxer
                            wrote on last edited by
                            #13

                            And referring to last but one post, I think I'll manage switching to msvc compiler 64 bit. And assuming I'll do it, what will be next?

                            1 Reply Last reply
                            0
                            • P Offline
                              P Offline
                              perry_coxer
                              wrote on last edited by
                              #14

                              And do I get it right that to switch to another compiler in Qt Creator I should have it all recompiled with this compiler?

                              1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                perry_coxer
                                wrote on last edited by
                                #15

                                OK, now I've downloaded Qt 5.1.1 msvc2012_64_opengl, and managed to accomplish configuring a kit with MSVC 2012 compiler and Qt 5.1.1 profile. But I have a problem with nmake. I've pointed it to Qt Creator when configuring compiler settings (because neither detected compiler nor detected kit didn't work). And every attempt ends up with make errors. It can't find iostream:
                                fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«о祭ЁҐ: iostream: No such file or directory
                                I don't know what to do with its encoding but that's not the main trouble

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  Are you sure you've got MSVC 2012 installed properly ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • P Offline
                                    P Offline
                                    perry_coxer
                                    wrote on last edited by
                                    #17

                                    Well, I've just downloaded VS express 2013 for Desktop. Of course I'm not sure, but today I downloaded jom and the same occured. I think problem is with cl.exe but I don't know how to configure it. And by the way, I'm not sure it's 64bit. My kit and compiler settings:
                                    !https://gpieeq.dm2302.livefilestore.com/y2paD5XV7xVmiuVcMqwrBjNSrycBgdsi4gaa9QNUxe9XlDQq4K6OJDu9jEcfGIXQ7c_IjEv_RwFLbtGYr78qFiFYypkxH7wmVvQofbi6_zdMGg/compiler_settings.png?psid=1()!
                                    https://gpieeq.dm1.livefilestore.com/y2p_pb35ffVEQLNjx2eNT7Ll7SL8mIJF1MNFKPj91U_i_DuvjdLG1usZDFGTv3EwSDcwXuEoanBh2wnV1o2SC_-NbHo0kHAbJNplY72Ql6VvmQ/kit_settings.png?psid=1

                                    1 Reply Last reply
                                    0
                                    • P Offline
                                      P Offline
                                      perry_coxer
                                      wrote on last edited by
                                      #18

                                      If russian interface confuses you please ask for translation

                                      1 Reply Last reply
                                      0
                                      • P Offline
                                        P Offline
                                        perry_coxer
                                        wrote on last edited by
                                        #19

                                        I've just tried to compile main.cpp with cl.exe with options that adds Qt Creator.

                                        1 Reply Last reply
                                        0
                                        • P Offline
                                          P Offline
                                          perry_coxer
                                          wrote on last edited by
                                          #20

                                          I've just tried to compile main.cpp with cl.exe with options that adds Qt Creator.
                                          main.cpp:
                                          @#include <iostream>
                                          using namespace std;

                                          int main()
                                          {
                                          int a;
                                          cout << "Hello wr!\n";
                                          return 0;
                                          }
                                          @

                                          options:
                                          cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -I"..........\Qt\Qt5.1.1\5.1.1\msvc2012_64_opengl\mkspecs\win32-msvc2012"
                                          And it works just fine and produces obj file, the problem is aparrently with LINK. Because if I erase -c option (to get cl invoke linker after compiling) LINK emits error message, he can't open msvcprtd.lib

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved