Pregunta

I am using an example of Intel TBB code I found on SO:

#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
#include "tbb/task_scheduler_init.h"
#include <iostream>
#include <vector>

struct mytask {
  mytask(size_t n)
    :_n(n)
  {}
  void operator()() {
    for (int i=0;i<1000000;++i) {}  // Deliberately run slow
    std::cerr << "[" << _n << "]";
  }
  size_t _n;
};

struct executor
{
  executor(std::vector<mytask>& t) :_tasks(t)
  {}
  executor(executor& e,tbb::split) :_tasks(e._tasks)
  {}

  void operator()(const tbb::blocked_range<size_t>& r) const {
    for (size_t i=r.begin();i!=r.end();++i)
      _tasks[i]();
  }

  std::vector<mytask>& _tasks;
};

int main(int,char**) {

  tbb::task_scheduler_init init;  // Automatic number of threads
  // tbb::task_scheduler_init init(2);  // Explicit number of threads

  std::vector<mytask> tasks;
  for (int i=0;i<1000;++i){
        tasks.push_back(mytask(i));
  }
  executor exec(tasks);
  tbb::parallel_for(tbb::blocked_range<size_t>(0,tasks.size()),exec);
  std::cerr << std::endl;

  return 0;
}

The code builds fine, but when I go to run I get the error:

The program can't start because tbb_debug.dll is missing from your computer. Try reinstalling the program to fix this problem.

I think this is probably the path I need to set somewhere within VS2012:

C:\Program Files (x86)\Intel\Composer XE 2013 SP1\redist\ia32\tbb\vc11

because it contains tbb_debug.dll.

Where does this path need to be set?

EDIT: I tried setting in the "Executable directories" path section but that didnt work.

¿Fue útil?

Solución

  1. In solution explorer, right click the project and open "Properties"
  2. Open "Configuration Properties" -> "Debugging".
  3. In the "Environment" line, add "PATH=C:\Program Files (x86)\Intel\Composer XE 2013"
  4. Make sure "Merge Environment" is set to "Yes".
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top