CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Tutorial for parallel_for_ and Universal Intrinsic (GSoC '21) #20361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...pp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_new.cpp
Outdated
Show resolved
Hide resolved
9ea74ea
to
715b9d6
Compare
* Added first half of universal intrinsic tutorial * Fixed warnings in documentation and sample code for parallel_for_new tutorial * Restored original parallel_for_ tutorial and table_of_content_core * Minor changes
* Minor changes in vectorized implementation of 1-D and 2-D convolution
Could you please add new tutorials to the table of content? I mean |
Do I remove the old parallel_for_ tutorial from the table of contents? Also, the new parallel_for_ tutorial has the 'new' suffix in the name. Do I need to change that? |
I think we should start with both tutorials. Old one could be removed later |
...utorials/core/how_to_use_OpenCV_parallel_for_new/how_to_use_OpenCV_parallel_for_new.markdown
Outdated
Show resolved
Hide resolved
...pp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_new.cpp
Outdated
Show resolved
Hide resolved
...utorials/core/how_to_use_OpenCV_parallel_for_new/how_to_use_OpenCV_parallel_for_new.markdown
Outdated
Show resolved
Hide resolved
I think tutorials are finished so turn the PR to "ready for review" |
@r0hit2005 Need to fix build errors:
"variable-sized arrays" is GNU extension and not a part of ISO C++11. |
Please use
|
In OpenCV 4.5, the following parallel frameworks are available in that order: | ||
|
||
* Intel Threading Building Blocks (3rdparty library, should be explicitly enabled) | ||
* C= Parallel C/C++ Programming Language Extension (3rdparty library, should be explicitly enabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C= Parallel C/C++ Programming Language Extension (3rdparty library, should be explicitly enabled)
It is deprecated and dropped.
 | ||
|
||
|
||
For more information about different kernels and what they do, look [here](https://docs.opencv.org/4.5.2/d7/da8/tutorial_table_of_content_imgproc.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't put direct links on docs site.
Use Doxygen references instead.
Based on that, we can broadly classify algorithms into two categories:- | ||
1. Algorithms in which only a single thread writes data to a particular memory location. | ||
* In *convolution*, for example, even though multiple threads may read from a pixel at a particular time, only a single thread *writes* to a particular pixel. | ||
<!-- <br> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<!-- <br> -->
needed?
|
||
In the tutorial, we used a horizontal gradient filter(as shown in the animation above), which produces an image highlighting the vertical edges. | ||
|
||
 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resimg.png
We don't need lossless format for documentation. Please use .jpg instead.
|
||
Sequential Implementation: 0.0953564s | ||
Parallel Implementation: 0.0246762s | ||
Parallel Implentatation(Row Split): 0.0248722s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implentatation
typo
|
||
The goal of this tutorial is to provide a guide to using the Universal Intrinsics feature to vectorize your C++ code for a faster runtime. | ||
We'll briefly look into _SIMD intrinsics_ and how to work with wide _registers_, followed by a tutorial on the basic operations using wide registers. | ||
The tutorial will only demonstrate basic operations. To know more about Universal Intrinsics, visit the [documentation](https://docs.opencv.org/4.5.3/df/d91/group__core__hal__intrin.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I refer to the documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use @ref <id>
, where <id>
:
- is a tutorial identifier (see the first line of tutorial page)
- or identifier of code group, for this case it is here
namespace | ||
{ | ||
//! [convolution-sequential] | ||
void conv_seq(Mat src, Mat &dst, Mat kernel) | ||
{ | ||
//![convolution-make-borders] | ||
int rows = src.rows, cols = src.cols; | ||
dst = Mat(rows, cols, src.type()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid indentation in namespaces
Should I change the previous tutorial(file_input_output_with_xml_yml) to point to the new parallel_for tutorial? |
Yes, please keep next/prev links up-to-date. |
As far as I could understand |
Tutorial for parallel_for_ and Universal Intrinsic (GSoC '21) * New parallel_for tutorial * Universal Intrinsics Draft Tutorial * Added draft of universal intrinsic tutorial * * Added final markdown for parallel_for_new * Added first half of universal intrinsic tutorial * Fixed warnings in documentation and sample code for parallel_for_new tutorial * Restored original parallel_for_ tutorial and table_of_content_core * Minor changes * Added demonstration of 1-D vectorized convolution * * Added 2-D convolution implementation and tutorial * Minor changes in vectorized implementation of 1-D and 2-D convolution * Minor changes to univ_intrin tutorial. Added new tutorials to the table of contents * Minor changes * Removed variable sized array initializations * Fixed conversion warnings * Added doxygen references, minor fixes * Added jpg image for parallel_for_ doc
This pull request is a part of the Google Summer of Code 2021 project. Here is an overview of the project:
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.