Commit b0c5f491 authored by Alexander Smorkalov's avatar Alexander Smorkalov

Build fixes for GPU samples.

parent c0d76ef9
......@@ -41,8 +41,8 @@ struct Worker: public ParallelLoopBody
Worker(int num_devices)
{
count = num_devices;
contexts = new contexts CUcontext[num_devices];
for (int device_id = 0; i < num_devices; device_id++)
contexts = new CUcontext[num_devices];
for (int device_id = 0; device_id < num_devices; device_id++)
{
CUdevice device;
safeCall(cuDeviceGet(&device, device_id));
......@@ -90,7 +90,7 @@ struct Worker: public ParallelLoopBody
{
if ((contexts != NULL) && count != 0)
{
for (int device_id = 0; i < num_devices; device_id++)
for (int device_id = 0; device_id < count; device_id++)
{
safeCall(cuCtxDestroy(contexts[device_id]));
}
......@@ -130,7 +130,7 @@ int main()
safeCall(cuInit(0));
// Execute calculation
parallel_for_(cv::Range(0, num_devices, Worker(num_devices));
parallel_for_(cv::Range(0, num_devices), Worker(num_devices));
return 0;
}
......
......@@ -8,7 +8,6 @@
#endif
#include <iostream>
#include "cvconfig.h"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/gpu/gpu.hpp"
......@@ -169,7 +168,7 @@ int main(int argc, char** argv)
contextOff();
// Execute calculation in two threads using two GPUs
parallel_for_(cv::Range(0, 2, Worker());
parallel_for_(cv::Range(0, 2), Worker());
// Release the first GPU resources
contextOn(0);
......
......@@ -72,7 +72,7 @@ int main()
}
// Execute calculation in several threads, 1 GPU per thread
parallel_for_(cv::Range(0, num_devices, Worker());
parallel_for_(cv::Range(0, num_devices), Worker());
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment