From b0c5f491707d5c9f1a192aa897bb3ab0a21e0d1b Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Tue, 13 Jan 2015 13:22:41 +0300 Subject: [PATCH] Build fixes for GPU samples. --- samples/gpu/driver_api_multi.cpp | 8 ++++---- samples/gpu/driver_api_stereo_multi.cpp | 3 +-- samples/gpu/multi.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) mode change 100755 => 100644 samples/gpu/driver_api_multi.cpp diff --git a/samples/gpu/driver_api_multi.cpp b/samples/gpu/driver_api_multi.cpp old mode 100755 new mode 100644 index 68a6395..4f5231c --- a/samples/gpu/driver_api_multi.cpp +++ b/samples/gpu/driver_api_multi.cpp @@ -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; } diff --git a/samples/gpu/driver_api_stereo_multi.cpp b/samples/gpu/driver_api_stereo_multi.cpp index c02348c..507203f 100644 --- a/samples/gpu/driver_api_stereo_multi.cpp +++ b/samples/gpu/driver_api_stereo_multi.cpp @@ -8,7 +8,6 @@ #endif #include -#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); diff --git a/samples/gpu/multi.cpp b/samples/gpu/multi.cpp index 96ad588..ddb512f 100644 --- a/samples/gpu/multi.cpp +++ b/samples/gpu/multi.cpp @@ -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; } -- 2.7.4