Attempting multithreading in Windows under MingGW64

Sep 24, 2021 at 8:16am
Hi ya'll

I'm' attempting to run a multithreaded process by using

std::for_each(std::execution::par_unseq, ...

the program works correctly but when I look at my Task Manager I see only one logical processor running at 100%. The others are quite flat near 0. This leads me to conclude the work isn't being done in parallel like I hoped.

I recently installed MSYS2 and compiled the program under MinGW64 with the follow
g++ -std=cpp++17 main.cpp ../external/lodepng/lodepng.cpp

Looking online for problems with MinGW64 only brought me to people failing to compile or run their program.

Any help or new direction is greatly appreciated :).

Cheers,
Sep 24, 2021 at 10:31am

If the implementation cannot parallelize or vectorize (e.g. due to lack of resources), all standard execution policies can fall back to sequential execution.
https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t
Sep 24, 2021 at 11:02am
I agree something the execution policy is falling back to sequential.
I'm not sure why this might be though.

It certainly isn't a lack of resources as I have a 16 core machine with nothing else running.

I suspect I have to do something with MinGW64 to get threads working. Would you know what would need to be done?
Sep 24, 2021 at 11:57am
It could be just the implementation, and nothing to do with your environment.
Topic archived. No new replies allowed.