ThorstenBux / artoolkitX_em_2d

2d tracking with emscripten
Other
0 stars 1 forks source link

Building OpenCV with OpenCL enabled #2

Open kalwalt opened 5 years ago

kalwalt commented 5 years ago

I will start to collect in this issue a series of resource that can help to build OpenCV with OpenCL and other useful informations that can help.

kalwalt commented 5 years ago

From the OpenCV doc page: https://docs.opencv.org/4.1.0/db/dfa/tutorial_transition_guide.html

kalwalt commented 5 years ago

I was able to build your https://github.com/ThorstenBux/opencv-em/ with OpenCL enabled I used these setting:

OPENCV_CONF="${OPENCV_MODULES_EXCLUDE} -DBUILD_PERF_TESTS:BOOL=0 -DBUILD_SHARED_LIBS:BOOL=0 -DBUILD_opencv_apps:BOOL=0 -DBUILD_TESTS:BOOL=0 -DBUILD_opencv_python_tests:BOOL=0 -DBUILD_opencv_apps:BOOL=0 -DWITH_PTHREADS_PF=0 -DWITH_OPENCL=ON -DWITH_OPENCL_SVM=ON -DCMAKE_BUILD_TYPE=Release"

i addded only -DWITH_OPENCL=ON -DWITH_OPENCL_SVM=ON SVM means Shared Virtual Memory though i'm not sure if we needs this.

article about SVM https://software.intel.com/en-us/articles/opencl-20-shared-virtual-memory-overview and opencv optimization: https://github.com/opencv/opencv/wiki/OpenCL-optimizations

There are other flags for OpenCL -DWITH_OPENCLAMDFFT -DWITH_OPENCLAMDBLAS but i don't think we need to add ( at least i suppose).

ThorstenBux commented 5 years ago

Can you build, bundle and push a release stating the OpenCV conf settings in the release message? That way we have them archived and reproduceable. From that we can pull them into artoolkitX.js and test.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Walter Perdan notifications@github.com Sent: Sunday, September 1, 2019 1:07:58 AM To: ThorstenBux/artoolkitX_em_2d artoolkitX_em_2d@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [ThorstenBux/artoolkitX_em_2d] Building OpenCV with OpenCL enabled (#2)

I build your https://github.com/ThorstenBux/opencv-em/https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FThorstenBux%2Fopencv-em%2F&data=02%7C01%7C%7C0e302190d7d948c199aa08d72e143f70%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637028536801693091&sdata=NzTcxCgnX4VNIwynt7XD3Sj%2Bk6NmdJGA4QQW0%2Fey7BU%3D&reserved=0 with OpenCL enabled I used these setting:

OPENCV_CONF="${OPENCV_MODULES_EXCLUDE} -DBUILD_PERF_TESTS:BOOL=0 -DBUILD_SHARED_LIBS:BOOL=0 -DBUILD_opencv_apps:BOOL=0 -DBUILD_TESTS:BOOL=0 -DBUILD_opencv_python_tests:BOOL=0 -DBUILD_opencv_apps:BOOL=0 -DWITH_PTHREADS_PF=0 -DWITH_OPENCL=ON -DWITH_OPENCL_SVM=ON -DCMAKE_BUILD_TYPE=Release"

i addded only -DWITH_OPENCL=ON -DWITH_OPENCL_SVM=ON SVM means Shared Virtual Memory though i'm not sure if we needs this.

article about SVM https://software.intel.com/en-us/articles/opencl-20-shared-virtual-memory-overviewhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsoftware.intel.com%2Fen-us%2Farticles%2Fopencl-20-shared-virtual-memory-overview&data=02%7C01%7C%7C0e302190d7d948c199aa08d72e143f70%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637028536801703096&sdata=849o869yoU6RgHvUVp%2BLE8fUfaaTRX5LGB43QmCmWaI%3D&reserved=0 and opencv optimization: https://github.com/opencv/opencv/wiki/OpenCL-optimizationshttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopencv%2Fopencv%2Fwiki%2FOpenCL-optimizations&data=02%7C01%7C%7C0e302190d7d948c199aa08d72e143f70%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637028536801713112&sdata=dDTSpYIpgZXFw2UqNbMlDRuzN7g7vOeXPYiaZSCqe3g%3D&reserved=0

There are other flags for OpenCL -DWITH_OPENCLAMDFFT -DWITH_OPENCLAMDBLAS but i don't think we need to add ( at least i suppose).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FThorstenBux%2FartoolkitX_em_2d%2Fissues%2F2%3Femail_source%3Dnotifications%26email_token%3DAD765PHVFAC7LNBBS3V2WILQHJUK5A5CNFSM4ISTMZNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TMOIY%23issuecomment-526829347&data=02%7C01%7C%7C0e302190d7d948c199aa08d72e143f70%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637028536801723117&sdata=7KV9AMFKMDF68MNJyTQn80zSA4BLizDNN7YSCr9jjjw%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD765PDEDTBQDT65MYUUFTLQHJUK5ANCNFSM4ISTMZNA&data=02%7C01%7C%7C0e302190d7d948c199aa08d72e143f70%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637028536801733128&sdata=waZm79jHHyRk6RRgT9tWUlmuMhilrB1Adzfz3LcWZq8%3D&reserved=0.

kalwalt commented 5 years ago

yes i can do, I'm also testing with Artoolkitx.js. I started also to change in PlanarTracker.cpp all the cv::Mat to cv::UMat i will make a PR when i have partially finished.

kalwalt commented 5 years ago

@ThorstenBux anyway do you mean a OpenCV release as you did here?

kalwalt commented 5 years ago

i have already a PR https://github.com/ThorstenBux/opencv-em/pull/2 we continue this discussion on this topic there.