Skip to content
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

Improvement try to add feature threading #4

Merged
merged 10 commits into from
Oct 23, 2023
Merged

Improvement try to add feature threading #4

merged 10 commits into from
Oct 23, 2023

Conversation

kalwalt
Copy link
Member

@kalwalt kalwalt commented Oct 7, 2023

Enhance nft marker creation with pthreads

First step

I will test if we can improve the speed up creation of the markers, for this reason will try to distrubute the calculation in multiple threads.
This PR provide the first step: convert the existing code from C to C++, as we will try to use std::mutex and std::thread.
It also address issue #2 and #3.

@kalwalt kalwalt added the enhancement New feature or request label Oct 7, 2023
@kalwalt kalwalt self-assigned this Oct 7, 2023
@kalwalt
Copy link
Member Author

kalwalt commented Oct 22, 2023

For now i have only converted the code to C++, so we can use std::chrono features and modern threading. I have to fix also these warnings:

stderr: /src/emscripten/markerCreator.cpp:241:19: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            usage("Marker Generator");
                  ^
/src/emscripten/markerCreator.cpp:244:26: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        char *filename = "tempFilename";
                         ^
/src/emscripten/markerCreator.cpp:463:45: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            if (ar2SaveFeatureSet(filename, "fset", featureSet) < 0)
                                            ^
3 warnings generated.

- it seems now to be faster
@kalwalt
Copy link
Member Author

kalwalt commented Oct 22, 2023

Now i used strdup and it tooks 188.294593 seconds to create the nft markers instead without strdup it tooks 195.639931 seconds, (using the pinball.jpg image)

@kalwalt
Copy link
Member Author

kalwalt commented Oct 22, 2023

With the last commit i'm testing pthreads features but i donìt see any improvements in the execution time, why this?

@kalwalt
Copy link
Member Author

kalwalt commented Oct 23, 2023

I think that my implementation does simply run the computation in separate thread and do not distibute the computation in multiple threads. this should be done inside the ar2GenFeatureMap function. This involve to develop a separate function whit mutlithreading, I think i will do this in another PR.

@kalwalt kalwalt merged commit dfc84fa into dev Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant