2025-07-21 21:11 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003902Spring engineBuildbotpublic2013-08-02 05:07
Reportercleanrock 
Assigned Toabma 
PrioritynormalSeverityminorReproducibilityN/A
StatusresolvedResolutionno change required 
Product Version94.1.1+git 
Target VersionFixed in Version 
Summary0003902: threadpool with mingw-w64
DescriptionThis report is for us to get threadpool running on windows.

engine-legacy in threadpool now builds for me on arch with the following mingw-w64 packages installed:
https://aur.archlinux.org/packages/mingw-w64-binutils/
https://aur.archlinux.org/packages/mingw-w64-crt-svn/
https://aur.archlinux.org/packages/mingw-w64-gcc/ (with --enable-threads=posix)
https://aur.archlinux.org/packages/mingw-w64-headers-svn/
https://aur.archlinux.org/packages/mingw-w64-winpthreads/

I am not sure the -svn packages are needed, perhaps the vanilla packages are fine.
To get std::thread working use --enable-threads=posix instead of win32 when building gcc.

I needed some spring source changes, see attached patch_cr1.

I had to place the following dlls next to spring.exe to have spring.exe not complain about missing DLLs in my win7 qemu vm:
libgcc_s_sjlj-1.dll
libwinpthread-1.dll
libstdc++-6.dll

Spring didn't start fully, my win7 was missing proper opengl driver so extensions were missing.
I built a small test app which used std::thread that at least worked when running on win7.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • ? file icon patch_cr1 (1,361 bytes) 2013-07-28 14:54 -
    diff --git a/cont/CMakeLists.txt b/cont/CMakeLists.txt
    index e6c9e8b..a151a45 100644
    --- a/cont/CMakeLists.txt
    +++ b/cont/CMakeLists.txt
    @@ -62,7 +62,7 @@ if    (MINGW)
     		#install(FILES ${STDCXX_LIBRARY} DESTINATION ${BINDIR})
     
     		# pthreadGC2 is a dependency of gomp
    -		find_library(PTHREADGC2_LIBRARY NAMES pthreadGC2)
    +		find_library(PTHREADGC2_LIBRARY NAMES winpthread)
     		if(NOT EXISTS ${PTHREADGC2_LIBRARY})
     			message(SEND_ERROR "pthreadGC2 not found!")
     		endif()
    diff --git a/rts/System/Platform/Win/CrashHandler.cpp b/rts/System/Platform/Win/CrashHandler.cpp
    index a0b6e02..2c888fb 100644
    --- a/rts/System/Platform/Win/CrashHandler.cpp
    +++ b/rts/System/Platform/Win/CrashHandler.cpp
    @@ -305,7 +305,7 @@ void PrepareStacktrace(const int logLevel) {
     
     	// Record list of loaded DLLs.
     	LOG_I(logLevel, "DLL information:");
    -	SymEnumerateModules(GetCurrentProcess(), EnumModules, NULL);
    +	// SymEnumerateModules(GetCurrentProcess(), EnumModules, NULL);
     }
     
     void CleanupStacktrace(const int logLevel) {
    diff --git a/rts/System/ThreadPool.h b/rts/System/ThreadPool.h
    index 242b569..bc811c4 100644
    --- a/rts/System/ThreadPool.h
    +++ b/rts/System/ThreadPool.h
    @@ -16,6 +16,7 @@
     #include <numeric>
     #include <chrono>
     
    +/*
     #ifdef __MINGW32__
     namespace std {
     	template<>
    @@ -25,7 +26,7 @@ namespace std {
     	};
     };
     #endif
    -
    +*/
     
     class ITaskGroup
     {
    
    ? file icon patch_cr1 (1,361 bytes) 2013-07-28 14:54 +

-Relationships
duplicate of 0003907resolvedabma desync since threadpool merge in validation test 
related to 0003840resolvedabma Old instance of Spring remains after a Spring.Restart (windows only) 
+Relationships

-Notes

~0011101

abma (administrator)

from the mingw64 homepage:

"winpthreads, a implementation of POSIX threads for win32 is also available under the experimental directory. Its main goal is to support C++11 standard threading, which supports only using POSIX threads at the moment. "

http://mingw-w64.sourceforge.net/

~0011102

abma (administrator)

Last edited: 2013-07-28 16:50

View 3 revisions

USE="openmp cxx -fortran" EXTRA_ECONF="--enable-threads=posix" emerge -va =cross-i686-w64-mingw32/gcc-4.7.3

doesn't compile: http://paste.springfiles.com/view/09da085e

~0011103

abma (administrator)

i'll try to setup mxe: http://mxe.cc/

~0011104

abma (administrator)

FYI: jk tried with boosts threadpool implementation which seems to work. spring.restart worked as well!

can't say anything about drawbacks, etc...

~0011109

cleanrock (reporter)

jk seem to have solved the last problems.
windows users can test now:
http://springrts.com/dl/buildbot/default/threadpool/

~0011110

The_Yak (reporter)

Last edited: 2013-07-31 10:32

View 3 revisions

Ok did some playing around with it. The good news is that it makes use of all 6 cores on my AMD FX-6100 (hooray!). Most usage appears to be occurring in cores 5 and 6, occasional bursts in core 2, minimal usage of all other cores. Loading times are MUCH faster. No gains in performance though, in fact average framerate is lower then 94.1.1-730-g1852c22 with identical settings. Still, all 94.1+ git builds run much jerkier and slower then 91.0 even with near same framerates, threadpool doesn't improve this.

Some /give all tests on Folsom Dam Deluxe and BA 7.78:

-Threadpool, with /luaui enabled, after /give all ~25fps
-with /luaui disable increases to ~38fps

-94.1.1-730, /luaui enabled, ~30fps
-/luaui disable ~45fps

EDIT: I swapped around the first numbers, sorry!

~0011139

abma (administrator)

compiles/runs (with bugs)
+Notes

-Issue History
Date Modified Username Field Change
2013-07-28 14:48 cleanrock New Issue
2013-07-28 14:54 cleanrock File Added: patch_cr1
2013-07-28 15:28 abma Relationship added related to 0003840
2013-07-28 15:59 abma Note Added: 0011101
2013-07-28 16:49 abma Note Added: 0011102
2013-07-28 16:50 abma Note Edited: 0011102 View Revisions
2013-07-28 16:50 abma Note Edited: 0011102 View Revisions
2013-07-29 01:14 abma Note Added: 0011103
2013-07-29 03:59 abma Note Added: 0011104
2013-07-30 11:09 cleanrock Note Added: 0011109
2013-07-30 17:57 The_Yak Note Added: 0011110
2013-07-30 17:58 The_Yak Note Edited: 0011110 View Revisions
2013-07-31 10:32 The_Yak Note Edited: 0011110 View Revisions
2013-08-02 05:07 abma Note Added: 0011139
2013-08-02 05:07 abma Relationship added duplicate of 0003907
2013-08-02 05:07 abma Status new => resolved
2013-08-02 05:07 abma Resolution open => no change required
2013-08-02 05:07 abma Assigned To => abma
+Issue History