Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help for Example ; ThreadPool threads ready and waiting for new task

Help for Example ; ThreadPool threads ready and waiting for new task

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 184 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    Hi,

    I have a Eigen matrix around 10milliyon each 1024xfloat32. So I want to create threadPool and evenly distribute the matrix for threds and wait a new job for doing calculation and send back the result which is for a certain conditions complied.

    function is :

            auto id = ( feat.row(x)- b_cmp ).squaredNorm();
            if (id < 0.5) {
                std::cout << std::endl << "Buldummm : " << x <<  "    " << distance <<std::endl;
                mutex1.lock();
                found_number.push_back(x);
                mutex1.unlock();
    
            }
    

    So calculation heavy . feat and b_cmp is Eigen Vectors.

    I need to create threadpool for above function each of them has own a pieces of huge data and ready to receive calculation matrix.

    I didt find a proper good ThreadPool example.

    is there any which is sutable such work ?

    I want to

    jsulmJ 1 Reply Last reply
    0
    • R RahibeMeryem

      Hi,

      I have a Eigen matrix around 10milliyon each 1024xfloat32. So I want to create threadPool and evenly distribute the matrix for threds and wait a new job for doing calculation and send back the result which is for a certain conditions complied.

      function is :

              auto id = ( feat.row(x)- b_cmp ).squaredNorm();
              if (id < 0.5) {
                  std::cout << std::endl << "Buldummm : " << x <<  "    " << distance <<std::endl;
                  mutex1.lock();
                  found_number.push_back(x);
                  mutex1.unlock();
      
              }
      

      So calculation heavy . feat and b_cmp is Eigen Vectors.

      I need to create threadpool for above function each of them has own a pieces of huge data and ready to receive calculation matrix.

      I didt find a proper good ThreadPool example.

      is there any which is sutable such work ?

      I want to

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @RahibeMeryem Why do you want to create your own thread pool?
      Qt already does it for you: https://doc.qt.io/qt-5/qthreadpool.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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