Skip to content

Commit 06cc599

Browse files
authored
Merge pull request #77 from sorenhein/master
Cumulative master update for v2.9.0 beta
2 parents cad2410 + 2b45088 commit 06cc599

File tree

130 files changed

+14722
-14050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+14722
-14050
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
!.gitignore
22
*.o
33
*.a
4+
*.so
45
*.dll
56
*.obj
67
*.def
@@ -13,3 +14,7 @@ test/itest
1314
*.exe
1415
*.swp
1516
*.bak
17+
18+
*.exp
19+
*.lib
20+
*.res

ChangeLog

+45
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
Release Notes DDS 2.9.0 beta
2+
----------------------------
3+
Included code for a number of multi-threading systems:
4+
- Windows API (was already there)
5+
- OpenMP (was already there)
6+
- GCD (new, intended for Mac, not really tested)
7+
- Boost (new, works on many systems, but you may have to install it)
8+
- STL (new, should work on most systems with a modern compiler)
9+
- TBB (new, not so broadly available, but portable in principle)
10+
- STLIMPL (new, experimental)
11+
- PPLIMPL (new, experimental)
12+
13+
Tested combinations include:
14+
- Visual C++ with Windows API, OpenMP, Boost, STL
15+
- Cygwin g++ with Windows API, OpenMP, Boost, STL
16+
- mingw g++ with OpenMP, Boost, STL
17+
- Linux g++ with OpenMP, Boost, STL
18+
- MacOS clang with GCD, Boost, STL (static and shared library)
19+
- MacOS GNU g++ with OpenMP, Boost, STL
20+
21+
The number of threads is now unlimited in principle, although the
22+
DLL will not let you go beyond the number of processor cores.
23+
24+
Enabled the transposition-table code for both the large and the small
25+
versions in the same DLL. Therefore there is only a single DLL
26+
distributed now for both. The SMALL_MEMORY compile switch is gone.
27+
28+
Enabled the DLL to pick the best combination of large and small
29+
transposition tables for a given resource set-up consisting of
30+
available memory and number of threads. Yes, the DLL can choose to
31+
run 4 large and 2 small threads, for example.
32+
33+
Expanded the DDSInfo systemString (which now needs 1024 chars as
34+
stated in the new dll.h).
35+
36+
MAXNOOFTABLES was increased from 32 to 40.
37+
38+
Fixed a reliance that char == signed char (not the case on Android,
39+
which caused a bug).
40+
41+
Dealt with the reported issues on the GitHub issues list.
42+
43+
Lots of clean-up of internal code. The code also looks more like C++.
44+
45+
146
Release Notes DDS 2.8.4
247
-----------------------
348
Added a lower-memory DLL version with a compile flag. This is about

INSTALL

+102-53
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ know what you're doing and you'll figure it out :-).
77

88
The first step is to compile the library.
99

10-
If you have trouble, read the Makefile. They all have the compiler
10+
If you have trouble, read the Makefiles. They all have the compiler
1111
warning levels set rather high, and they are set to fail even on
1212
warnings. You can turn this off. The Visual C++ version also
1313
requires a couple of tools that you may not have, but this too is
@@ -24,14 +24,14 @@ Generally speaking:
2424
the Makefile, then modify the Makefile.
2525

2626
Once you've tested the source, you'll need the library file, the
27-
dll.h include from the include directory, and possibly other files
27+
dll.h include file from the include directory, and possibly other files
2828
such as dll.lib, depending on the exact system. You don't need
2929
include/portab.h, although you're welcome to use it. The library
3030
files needed are:
3131

3232
Microsoft Visual C++: dds.dll, dds.lib
3333
mingw and cygwin: dds.dll, dds.def
34-
Mac and linux: libdds.a
34+
Mac and linux: libdds.a or libdds.so depending on compilation
3535

3636

3737
General instructions
@@ -41,88 +41,139 @@ General instructions
4141

4242
2. Copy the right Makefile_... from the Makefiles sub-directory
4343
to the src directory and call it Makefile, see below. (Or use make -f)
44+
So for example "cp Makefiles/Makefile_Visual Makefile".
45+
See "System-specific data" below.
4446

45-
3. If your compiler does not have the name assumed in the Makefile
46-
(see below), modify the Makefile.
47+
3. Check the configuration section and make any changes you need.
48+
- Section (1) has to do with paths for certain multi-threading systems
49+
which you may or may not want/have. If you set a certain compiler
50+
flag, it is your own responsibility that you have the corresponding
51+
threading system available -- otherwise the code will not compile.
52+
- Section (2) sets the threading systems with which you want to compile
53+
the DLL. Note that you can have as many as you like (see below).
54+
- Section (3) has to do with certain debugging flags etc. which you
55+
normally shouldn't set.
4756

48-
4. If you don't have the "windres" and "cvtres" programs,
49-
then you can also manage without. These are just used for
50-
getting version information into the DLL. Delete the corresponding
51-
lines.
57+
3. Check the "Often OK" section, in particular the name of the
58+
compiler you want to use.
5259

53-
5. If you want OpenMP rather than Windows multi-threading for
54-
some reason, find the right place in the Makefile and uncomment
55-
one line and comment the other.
60+
4. If you're on Windows and you don't have the "windres" and
61+
"cvtres" programs, then you can also manage without. These are
62+
just used for getting version information into the DLL. Delete
63+
the corresponding lines.
5664

57-
6. make clean (not necessary if you're starting clean).
65+
6. "make clean" (not necessary if you're starting clean).
5866

59-
7. make depend (ditto).
67+
7. There is a "make depend" target, but DO NOT USE IT. The Makefile
68+
is set up to read the dependencies from Makefiles/depends_*.txt.
6069

61-
8. make (produces dds.dll on Windows, libdds.a on Linux and Mac).
70+
8. "make" (produces dds.dll on Windows, libdds.a or libdds.so on
71+
Linux and Mac).
6272

63-
9. make install (if you want to run tests; this is only a
64-
local install to ../lib, not a system-wide one).
73+
9. "make install" (if you want to run tests; this is only a
74+
local install to ../test and ../examples, not a system-wide one).
6575

6676

6777
System-specific data
6878
====================
6979

70-
Microsoft Visual C++ (Unix-like, so Cygwin and mingw)
80+
Microsoft Visual C++
7181
--------------------
7282
Makefile: Makefile_Visual
7383
Compiler: cl
7484

85+
If you don't have a Cygwin-like set-up with access to commands
86+
such as "cp", see the last lines of that Makefile.
7587

76-
Microsoft Visual C++ (Windows-like, so no "mV", different "make")
77-
--------------------
78-
Makefile: Makefile_Visual_Windows
79-
Compiler: cl
8088

81-
82-
Mingw
83-
-----
89+
Windows Mingw
90+
-------------
8491
Makefile: Makefile_mingw
85-
Compiler: i686-w64-mingw32-g++
86-
87-
32-bit and 64-bit variants for the tdc compiler are available.
92+
Compiler: g++
8893

8994

90-
Cygwin
91-
------
95+
Windows Cygwin
96+
--------------
9297
Makefile: Makefile_cygwin
9398
Compiler: g++
9499

95100

96101
Linux (static library .a)
97-
=====
98-
Makefile: Makefile_linux
102+
-----
103+
Makefile: Makefile_linux_static
99104
Compiler: g++
100105

101106

102-
Linux (dynamic library .ld)
103-
=====
107+
Linux (dynamic library .so)
108+
-----
104109
Makefile: Makefile_linux_shared
105110
Compiler: g++
106111

107112

108-
Apple
109-
=====
110-
Makefile: Makefile_Mac_clang (for clang compiler, single-threaded)
113+
MacOS clang (static library .a)
114+
-----
115+
Makefile: Makefile_Mac_clang_static
111116
Compiler: g++
112-
Supports both OpenMP and GDD multi-threading.
113117

114-
Makefile: Makefile_Mac_gcc (for GNU g++ compiler, multi-threaded)
115-
Makefile: Makefile_Mac_shared (for GNU g++ compiler, multi-threaded)
118+
119+
MacOS clang (shared library .a)
120+
-----
121+
Makefile: Makefile_Mac_clang_static
122+
Compiler: g++
123+
124+
125+
MacOS GNU g++ (static library .a)
126+
-----
127+
Makefile: Makefile_Mac_clang_static
128+
Compiler: gcc-4.9
129+
130+
131+
MacOS GNU g++ (shared library .a)
132+
-----
133+
Makefile: Makefile_Mac_clang_static
134+
Compiler: gcc-4.9
135+
136+
137+
Multi-threading
138+
===============
139+
140+
As of v2.9.0 this works differently. It is possible to have
141+
multiple threading systems in the same library. There is a new
142+
DLL function called SetThreading() to select the one you want,
143+
in case there is more than one. If the DLL is compiled only
144+
single-threaded, that is what you'll get. If there are multiple
145+
options, the DLL will default to the multi-threaded one with the
146+
lowest number (among those compiled in, of course). The numbers
147+
can be found in ../include/dll.h.
148+
149+
It is NOT recommended to use STLIMPL and PPLIMPL as they are today.
150+
You cannot control the number of threads that they will want, nor
151+
the memory that they will consume. But maybe some day...
152+
153+
The others are very equivalent in terms of speed, but you might as
154+
well use STL if you have it, as this is probably the most portable.
155+
156+
If you don't have a C++17 compiler, you will not get STLIMPL or
157+
PPLIMPL.
158+
159+
The *IMPL versions let the system handle threads autonomously
160+
(up to the number of threads set by the user), whereas the others
161+
are handled by DDS internally. The *IMPL version are similar in
162+
speed, except if there is some near-duplication in the input hands
163+
(say, instances of the same distribution played in the same
164+
denomination from different side). The non-IMPL version handle
165+
this more efficiently.
116166

117167

118168
Testing
119169
=======
120170

121171
The step "make install" above should have put the library file
122-
in ../lib.
172+
in ../test.
123173

124174
test
125175
----
176+
In the test directory you can compile the dtest program.
126177
This program tests five main modes of DDS:
127178

128179
* solve, the solution of a hand for a given declarer and strain.
@@ -135,9 +186,11 @@ The program can use a number of pre-defined input files in the
135186
../hands directory.
136187

137188
To compile the program, you follow the same steps as for the library,
138-
except that you don't do a "make install".
189+
except that you don't do a "make install". So you copy the right
190+
Makefile from Makefiles (e.g. "cp Makefiles/Makefile_Visual Makefile"),
191+
then type "make".
139192

140-
You now have a program called "dtest" or "dtest.exe". Let us
193+
You should now have a program called "dtest" or "dtest.exe". Let us
141194
assume dtest.exe. Let us also assume that your system is set up
142195
in such a way that your path does not include the current working
143196
directory.
@@ -147,19 +200,15 @@ You can invoke the program as
147200
./dtest.exe
148201

149202
which should just give a brief usage message. If that works, then
150-
you can invoke the program like this:
151-
152-
./dtest.exe file.txt mode [number of threads]
153-
154-
file.txt has to be the name of a file EITHER in the current
155-
directory OR in ../hands. The program checks first in the current
156-
directory. A good starting example is list100.txt.
203+
you can invoke the program like this, for example:
157204

158-
mode has to be one of solve, calc, play, parand dealerpar.
205+
./dtest.exe -f ../hands/list100.txt -s solve -n 4 -m 1000
159206

160207
The number of threads is optional. If it is not supplied, DDS
161208
figures one out itself. If it is supplied, then it is passed to
162-
SetMaxThreads().
209+
SetMaxThreads(). You can also use SetResources() instead of
210+
SetMaxThreads() to set the memory consumption as well. If you use
211+
SetResources(), there is no need to use SetMaxThreads().
163212

164213
Generally speaking, the test program first shows some information
165214
about how it was compiled. Then it shows some ongoing timing
@@ -179,7 +228,7 @@ minimally to support a multi-threaded DLL. However, it doesn't
179228
use the full capabilities of DDS, as it was written at a time when
180229
functions such as CalcAllTables and SolveAllBoards were not yet
181230
available. Therefore it is rather slow, but it does have a nice
182-
hand generator built in.
231+
hand generator built in. It has not been updated since v2.8.4.
183232

184233

185234
examples

README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ DDS offers a wide range of functions, including par-score calculations.
66

77
Please refer to the [home page](http://privat.bahnhof.se/wb758135) for details.
88

9-
The current version is DDS 2.8.4 released in March 2016 and licensed under the Apache 2.0 license in the LICENSE FILE.
9+
The current version is DDS 2.9.0 beta, released in May 2018 and licensed under the Apache 2.0 license in the LICENSE FILE.
1010

1111
Release notes are in the ChangeLog file.
1212

13-
(c) Bo Haglund 2006-2014, (c) Bo Haglund / Soren Hein 2014-2016.
13+
(c) Bo Haglund 2006-2014, (c) Bo Haglund / Soren Hein 2014-2018.
1414

1515

1616
Credits
@@ -27,7 +27,7 @@ Foppe Hemminga maintains DDS on ArchLinux. He also contributed a version of the
2727

2828
Pierre Cossard contributed the code for multi-threading on the Mac using GDS.
2929

30-
Soren Hein made a number of contributions before becoming a co-author starting in v2.8 in 2014.
30+
Soren Hein made a number of contributions before becoming a co-author starting with v2.8 in 2014.
3131

3232

3333
Overview
@@ -52,7 +52,7 @@ Supported systems
5252
=================
5353
The DLLs work out of the box on Windows systems. There is a single-threaded version for old Windows versions, and there is a multi-threaded version that works on all modern Windows systems. This is the one you should use if in doubt.
5454

55-
The Windows versions use the Windows multi-threading. The code compiles on windows (see INSTALL) with at least:
55+
The distributed Windows DLL uses Windows multi-threading. The code compiles on windows (see INSTALL) with at least:
5656

5757
* Visual C++ 2010 Express editions or later.
5858
* The TDM-GCC/Mingw port of g++.
@@ -73,20 +73,22 @@ The `without-multilib` is important because you won't get OpenMP otherwise, and
7373

7474
Thanks for Pierre Cossard's contribution, the Mac port now also supports GCD multi-threading with LLVM.
7575

76+
There's an example .Net wrapper on https://github.com/anorsich/dds.net (not supported by us).
77+
7678
Usage
7779
=====
7880

79-
DDS tries to figure out the available number of cores and the available memory. Based on this, DDS calculates a reasonable number of threads to use. The user can override this by calling the `SetMaxThreads()` function. In principle SetMaxThreads can be called multiple times, but there is overhead associated with this, so only call it at the beginning of your program unless you really want to change the number of threads dynamically.
81+
DDS tries to figure out the available number of cores and the available memory. Based on this, DDS calculates a reasonable number of threads to use. The user can override this by calling the `SetMaxThreads()` or the `SetResources()` function. In principle these functions can be called multiple times, but there is overhead associated with this, so only call it at the beginning of your program unless you really want to change the number of threads dynamically.
8082

8183
DDS on Windows calls SetMaxThreads itself when it is attached to a process, so you don't have to. On Unix-like systems we use an equivalent mechanism, but we have had a report that this does not always happen in the right order of things, so you may want to call SetMaxThreads explicitly.
8284

8385
Docs
8486
====
85-
The DDS library interface is very well documented. You find the docs, including a Markdown version which you can read online, in the /doc folder.
87+
The DDS library interface is documented. You find the docs, including a Markdown version which you can read online, in the /doc folder. The Markdown version has not been updated since v2.8.4.
8688

8789
Bugs
8890
====
89-
Version 2.8.4 has no known bugs.
91+
Version 2.9.0 beta has no known bugs.
9092

9193
Please report bugs to [email protected] and [email protected].
9294

doc/DLL-dds_x.htm

+2-2
Original file line numberDiff line numberDiff line change
@@ -7448,7 +7448,7 @@ <h3 style='page-break-after:avoid'><span lang=EN-US style='font-family:"Calibri"
74487448
color:black'><o:p>&nbsp;</o:p></span></p>
74497449

74507450
<p class=MsoNormal style='text-align:justify'><span lang=EN-US
7451-
style='font-family:"Calibri",sans-serif;color:black'>CallAllTables calculates the
7451+
style='font-family:"Calibri",sans-serif;color:black'>CalcAllTables calculates the
74527452
double dummy values of the denomination/declarer hand combinations in </span><b
74537453
style='mso-bidi-font-weight:normal'><span lang=EN-US style='font-size:11.0pt;
74547454
font-family:"Courier New";color:black'>�*dealsp�</span></b><span lang=EN-US
@@ -7516,7 +7516,7 @@ <h3 style='page-break-after:avoid'><span lang=EN-US style='font-family:"Calibri"
75167516

75177517
<p class=MsoNormal style='text-align:justify'><span lang=EN-US
75187518
style='font-family:"Calibri",sans-serif;color:black'>The maximum number of DD
7519-
tables in a CallAllTables call depends on the number of strains required, see
7519+
tables in a CalcAllTables call depends on the number of strains required, see
75207520
the following table:<o:p></o:p></span></p>
75217521

75227522
<p class=MsoNormal style='text-align:justify'><span lang=EN-US

0 commit comments

Comments
 (0)