Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved]add CUDA
Forum Updated to NodeBB v4.3 + New Features

[Solved]add CUDA

Scheduled Pinned Locked Moved Installation and Deployment
9 Posts 7 Posters 11.1k 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.
  • D Offline
    D Offline
    devroyc
    wrote on last edited by
    #1

    Hello,
    I want use CUDA in QT,
    but I don't know ,how to add CUDA lib in makefile。

    thank you

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Add to your .pro file:

      @
      INCLUDEPATH += /path/to/dir/with/cuda/includes
      LIBS += -L/path/to/dir/with/cuda/libs -lcudalib
      @

      qmake does all the other magic for you.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • D Offline
        D Offline
        devroyc
        wrote on last edited by
        #3

        thank you ,
        and
        what's the settings for compiler.cu like since it requires nvcc ?

        or how to combine other .o file in Qt?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Sorry, I have no clue how CUDA and the libs work. What's nvcc? Another tool that must be called on some file?

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dangelog
            wrote on last edited by
            #5

            [quote author="devroyc" date="1293824069"]thank you ,
            and
            what's the settings for compiler.cu like since it requires nvcc ?

            or how to combine other .o file in Qt?[/quote]

            With some clever QMAKE_EXTRA_COMPILERS black magic. See
            http://doc.qt.nokia.com/latest/qmake-environment-reference.html#customizing
            http://forums.nvidia.com/index.php?showtopic=29539

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            1 Reply Last reply
            0
            • G Offline
              G Offline
              GordonSchumacher
              wrote on last edited by
              #6

              There's also some additional information here: http://www.qtcentre.org/wiki/index.php?title=Undocumented_qmake#Custom_tools

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                Note that there is also a labs project on OpenCL. Perhaps you could leverage that instead? It seems to me that OpenCl has more future than Cuda, due to its more open nature and brand independency.

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xsacha
                  wrote on last edited by
                  #8

                  Psst. Don't tell that to Nvidia ;).

                  Some people may prefer coding in CUDA or may require something that (at this time) only CUDA provides. It has some nicer tools (for debugging and so on) and it also has more library support (plug-ins).

                  • Sacha
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    michaelw_newyork
                    wrote on last edited by
                    #9

                    Two comments:

                    1. Regarding using Cuda from Qt. That was a major concern of the project
                      I am consulting on, and it turns out to be straightforward. The Cuda code
                      that I have written is designed to be used from a Qt application. It (the Cuda
                      portion) is compiled in its own project directory using nvcc where appropriate
                      and .o files are created. These are packaged using ar into a lib<whatever>.a
                      archive. Then, in a different directory (for what that is worth) I have my Qt
                      application, which uses qmake and a <whatever>.pro file, and it adds the
                      location of the lib<whatever>.a, a -l<whatever> to the library switches, and a
                      reference to the location and name of the cuda run time libraries. It all seems
                      to compile and run just fine.

                    2. Regarding the comment on OpenCL vs Cuda. Although OpenCL may be the
                      future, it may not be as well. Cuda is far more mature and is used, my guess,
                      for 95% of all serious GPU development. There are good reasons why OpenCL
                      might actually be a little nicer for development, but at an inherently slower speed.
                      It all depends on how practical your needs are. If you need to write something
                      that works today, and is more mature, and dont mind using Nvidia (and I like Nvidia),
                      then Cuda is the way to go. Ultimately, in the long run, well we will have to see.
                      They are very similar, but not identical, but its not too bad. If you learn one, the
                      other will be straightforward.

                    MW

                    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