From 95869a6081ab403254355eed839b14dcb3d70b73 Mon Sep 17 00:00:00 2001 From: NikoKJ Date: Wed, 7 Nov 2012 13:49:09 +0800 Subject: [PATCH] fix the compilation bug of main.cpp in perf test and accuracy test on ocl module. It caused by the incompatibility of command line parser class in core.hpp between master branch and 2.4 branch. --- modules/ocl/perf/main.cpp | 54 +++++++++------------------------------ modules/ocl/test/main.cpp | 22 ++++++++-------- 2 files changed, 23 insertions(+), 53 deletions(-) diff --git a/modules/ocl/perf/main.cpp b/modules/ocl/perf/main.cpp index fb8013635a..663bc197aa 100644 --- a/modules/ocl/perf/main.cpp +++ b/modules/ocl/perf/main.cpp @@ -79,77 +79,47 @@ int main(int argc, char **argv) TS::ptr()->init("ocl"); InitGoogleTest(&argc, argv); const char *keys = - - "{ h | help | false | print help message }" - - "{ w | workdir | ../../../samples/c/| set working directory }" - - "{ t | type | gpu | set device type:cpu or gpu}" - - "{ p | platform | 0 | set platform id }" - - "{ d | device | 0 | set device id }"; - - + "{ h | false | print help message }" + "{ w | ../../../samples/c/| set working directory i.e. -w=C:\\}" + "{ t | gpu | set device type:i.e. -t=cpu or gpu}" + "{ p | 0 | set platform id i.e. -p=0}" + "{ d | 0 | set device id i.e. -d=0}"; CommandLineParser cmd(argc, argv, keys); - - if (cmd.get("help")) - + if (cmd.get("h")=="true") { - cout << "Avaible options besides goole test option:" << endl; - - cmd.printParams(); + cmd.printMessage(); + return 0; } - - workdir = cmd.get("workdir"); - - string type = cmd.get("type"); - - unsigned int pid = cmd.get("platform"); - - int device = cmd.get("device"); - - + workdir = cmd.get("w"); + string type = cmd.get("t"); + unsigned int pid = cmd.get("p"); + int device = cmd.get("d"); print_info(); int flag = CVCL_DEVICE_TYPE_GPU; if(type == "cpu") - { - flag = CVCL_DEVICE_TYPE_CPU; - } std::vector oclinfo; int devnums = getDevice(oclinfo); if(devnums <= device || device < 0) - { - std::cout << "device invalid\n"; - return -1; - } if(pid >= oclinfo.size()) - { - std::cout << "platform invalid\n"; - return -1; - } if(pid != 0 || device != 0) - { - setDevice(oclinfo[pid], device); - } cout << "Device type:" << type << endl << "Device name:" << oclinfo[pid].DeviceName[device] << endl; diff --git a/modules/ocl/test/main.cpp b/modules/ocl/test/main.cpp index 856828d6a5..d3273f7fe0 100644 --- a/modules/ocl/test/main.cpp +++ b/modules/ocl/test/main.cpp @@ -79,23 +79,23 @@ int main(int argc, char **argv) TS::ptr()->init("ocl"); InitGoogleTest(&argc, argv); const char *keys = - "{ h | help | false | print help message }" - "{ w | workdir | ../../../samples/c/| set working directory }" - "{ t | type | gpu | set device type:cpu or gpu}" - "{ p | platform | 0 | set platform id }" - "{ d | device | 0 | set device id }"; + "{ h | false | print help message }" + "{ w | ../../../samples/c/| set working directory i.e. -w=C:\\}" + "{ t | gpu | set device type:i.e. -t=cpu or gpu}" + "{ p | 0 | set platform id i.e. -p=0}" + "{ d | 0 | set device id i.e. -d=0}"; CommandLineParser cmd(argc, argv, keys); - if (cmd.get("help")) + if (cmd.get("h")=="true") { cout << "Avaible options besides goole test option:" << endl; - cmd.printParams(); + cmd.printMessage(); return 0; } - workdir = cmd.get("workdir"); - string type = cmd.get("type"); - unsigned int pid = cmd.get("platform"); - int device = cmd.get("device"); + workdir = cmd.get("w"); + string type = cmd.get("t"); + unsigned int pid = cmd.get("p"); + int device = cmd.get("d"); print_info(); int flag = CVCL_DEVICE_TYPE_GPU;