Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. adding CUDA to Qt
Forum Update on Monday, May 27th 2025

adding CUDA to Qt

Scheduled Pinned Locked Moved Solved Brainstorm
4 Posts 3 Posters 7.3k Views
  • 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.
  • M Offline
    M Offline
    m00lecule
    wrote on 5 Aug 2018, 15:19 last edited by
    #1

    Hi, im developing a qt application which would benefit form GPU acceleration, therefore i picked CUDA. However im struggling with connecting Qt and CUDA. I get this error while i build my project: 0_1533481894888_wykop.png

    and due to the only one answer i have found it might be PATH variable issue: http://www.cs.virginia.edu/~mwb7w/cuda_support/libcudart.html , but i had already set them to proper paths 0_1533481994078_wykop1.png

    My laptop is running on Ubuntu 18.04 with NVDIA Drivier 396.45. Cuda toolkit-9.2 was installed from runfile downloaded direct from nvidia website.

    Part of .pro file:
    0_1533482083502_wykop2.png

    And ss of nvcc and gcc:
    0_1533482103774_wykop3.png

    If somebody has a clue how to solve it or how can i move on ( i even consider switching to other SDK ) please let me know.

    A 1 Reply Last reply 5 Aug 2018, 18:31
    0
    • M m00lecule
      5 Aug 2018, 15:19

      Hi, im developing a qt application which would benefit form GPU acceleration, therefore i picked CUDA. However im struggling with connecting Qt and CUDA. I get this error while i build my project: 0_1533481894888_wykop.png

      and due to the only one answer i have found it might be PATH variable issue: http://www.cs.virginia.edu/~mwb7w/cuda_support/libcudart.html , but i had already set them to proper paths 0_1533481994078_wykop1.png

      My laptop is running on Ubuntu 18.04 with NVDIA Drivier 396.45. Cuda toolkit-9.2 was installed from runfile downloaded direct from nvidia website.

      Part of .pro file:
      0_1533482083502_wykop2.png

      And ss of nvcc and gcc:
      0_1533482103774_wykop3.png

      If somebody has a clue how to solve it or how can i move on ( i even consider switching to other SDK ) please let me know.

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 5 Aug 2018, 18:31 last edited by aha_1980 8 May 2018, 18:32
      #2

      Hi @m00lecule,

      I have the following tip for you: remove the QMAKE_LIBDIR line in the project file and change the LIBS line to the following:

      LIBS += -L$$CUDA_DIR/lib64 -lcuda -lcudart
      

      That way QtCreator will adjust the LD_LIBRARY_PATH correctly.

      If that is not enough, go to a terminal, cd to $$CUDA_DIR/lib64 and post the output of ldd cuda.so and ldd cudart.so

      Regards

      PS: if possible, post text files as text here, that makes it way easier for me to copy and modify the values without introducing new errors. Thanks.

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 5 Aug 2018, 19:36 last edited by
        #3

        Hi,

        To add to @aha_1980 , did you check the Run part of the Project panel ? Just to see whether your LD_LIBRARY_PATH variable is set correctly.

        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
        • M Offline
          M Offline
          m00lecule
          wrote on 6 Aug 2018, 01:01 last edited by
          #4

          It turned out that making cuda.conf file in /etc/ld.so.conf.d containing path to cuda libs directory and running ldconfig solved my problem.

          1 Reply Last reply
          1

          1/4

          5 Aug 2018, 15:19

          • Login

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