2015-03-08 12:20 GMT+01:00 Marco Costalba <[email protected]>:
> I am one of the developer of a chess engine called Stockfish:
>
> https://github.com/official-stockfish/Stockfish
>
> A chess engine is a high performance piece of multi-thread software, where
> even a small sub-optimal code path immediately translates in a sensible
> slow down.
>
> The master version is written in C++03 and uses some low level wrappers to
> get thread functionality on supported platforms:
>
> https://github.com/official-stockfish/Stockfish/blob/master/src/platform.h
>
> Recently we started to switch to C++11 for various reasons, but especially
> due to library support for std::thread and friends. This allows us to
> greatly simplify the code and getting rid of all the platform specific
> wrappers.
>
> While on Linux and on MSVC 2013 we have similar performance between C++11
> and C++03 versions, under Windows with mingw there is a huge performance
> gap when run in SMP mode (around 30% slower), when we run in single thread
> mode speed is similar. This is particularly unfortunate because our release
> version is compiled with gcc for all the platforms because currently gcc
> gives the best speed.
>
> After some analysis we realized the speed difference is all due to thread
> library implementation on mingw that is based on POSIX instead of native
> Win32 threads.
>
> We have goggled around for some specific version of mingw that used win32
> _and_ supports std::thread, but we have found nothing so far.
>
> So I would like to ask:
>
> 1. There exists somewhere a mingw-w64 build supporting native win32
> std::thread?
>
No, and the reason is that currently, GCC (and libstdc++) only has a fully
implemented internal threading library (inside libgcc) based on pthreads,
not win32 threads. The MinGW-w64 project provides the winpthreads library
which allows GCC to build its C++11 threading libraries.
> 2. There is some plan to develop it?
>
Yes, and no. So far, no one has submitted the patches that would make this
possible (i.e. extend the GCC win32 threading implemenation and lat
libstdc++ use that). An alternative path would be to create a separate
implementation of the relevant functionality in libstdc++, written directly
on top of the Win32 API.
Fortunately for you though, I recently (well, a couple months ago) learned
about an implementation of the second option available here:
https://github.com/meganz/mingw-std-threads
The author so kindly relicensed the files under the MinGW-w64 runtime
license, which is essentially public domain or Zlib license where public
domain doesn't exist.
I'm curious as to how good that implementation would perform for you!
Ruben
>
>
> Thanks for your help and support
>
> Marco
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public