Skip to content

Commit

Permalink
historical commit dds 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bohag authored and hostilefork committed Nov 25, 2014
1 parent 67d8eed commit 422593e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
13 changes: 8 additions & 5 deletions DLL-dds_220_l.rtf → DLL-dds_221_n.rtf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{\colortbl ;\red0\green0\blue255;\red0\green0\blue0;\red255\green0\blue0;}
{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}{\s3 heading 3;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\nowidctlpar\lang1053\f0\fs20 Bo Haglund, Bob Richardson\par
Rev M, 2012-07-06\par
Rev N, 2012-07-16\par
Latest DLL issue with this description is available at {\field{\*\fldinst{HYPERLINK "http://www.bahnhof.se/wb758135/"}}{\fldrslt{\ul\cf1 http://www.bahnhof.se/wb758135/}}}\f0\fs20\par
\par
\par
\pard\keepn\nowidctlpar\s2\cf2\ul\b Short description of the DLL functions supported in Double Dummy Problem Solver 2.2.0\par
\pard\keepn\nowidctlpar\s2\cf2\ul\b Short description of the DLL functions supported in Double Dummy Problem Solver 2.2.1\par
\pard\nowidctlpar\ulnone\b0\par
\pard\keepn\nowidctlpar\s3\b Callable functions\par
\pard\nowidctlpar\b0\par
Expand All @@ -26,7 +26,7 @@ extern "C" __declspec(dllimport) int __stdcall SolveAllBoards(struct boardsPBN *
\par
\pard\keepn\nowidctlpar\s3\b SolveBoard\par
\pard\nowidctlpar\b0\par
SolveBoard is thread-safe, so several threads (max 16) can call SolveBoard in parallel.\par
SolveBoard is thread-safe, so several threads (max 8) can call SolveBoard in parallel.\par
\par
Before SolveBoard can be called, a structure of type "futureTricks" must be declared. \par
\par
Expand All @@ -45,7 +45,7 @@ Before SolveBoard can be called, a structure of type "futureTricks" must be decl
-12=Suit or rank value out of range for deal.currentTrickSuit or deal.currentTrickRank.\par
-13=Card already played in the current trick is also defined as a remaining card to play.\par
-14=Wrong number of remaining cards for a hand.\par
-15=threadIndex < 0 or > 15.\line \line Structure \rdblquote\b deal\b0\rdblquote defines all data needed to describe the deal to be analyzed.\par
-15=threadIndex < 0 or > 7.\line \line Structure \rdblquote\b deal\b0\rdblquote defines all data needed to describe the deal to be analyzed.\par
struct deal \{\f1 \par
\f0 int trump; /* I.e. which suit that is trump or if contract is NT, Spades=0, Hearts=1, Diamonds=2, Clubs=3, NT=4 */\f1 \par
\f0 int first; /* 0-3, 0=North, 1=East, 2=South, 3=West , Leading hand for the trick.*/\f1 \par
Expand Down Expand Up @@ -77,7 +77,7 @@ struct \b futureTricks\b0 \{ /* The DLL provides the score (number of tricks) t
\f0\} ; \par
\par
Parameter \rdblquote\b threadIndex\b0\rdblquote defines the identity of the thread used when calling SolveBoard.\par
Maximum 16 threads can call SolveBoard in parallel, threadIndex must be an integer of the range 0..15.\par
Maximum 8 threads can call SolveBoard in parallel, threadIndex must be an integer of the range 0..7.\par
\cf0\lang1033\fs24\par
\pard\keepn\nowidctlpar\s3\cf2\lang1053\b\fs20\par
SolveBoardPBN\par
Expand Down Expand Up @@ -182,6 +182,9 @@ Rev K, 2010-10-27\tab Correction of fault in the description: 2nd index in resT
Rev L, 2011-10-14\tab Added SolveBoardPBN and CalcDDtablePBN.\par
\par
Rev M, 2012-07-06\tab Added SolveAllBoards. \par
\par
Rev N, 2012-07-16\tab Max number of threads is 8. \par
\par
\par
\par
}
Expand Down
37 changes: 18 additions & 19 deletions dds.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* DDS 2.2.0 A bridge double dummy solver. */
/* DDS 2.2.1 A bridge double dummy solver. */
/* Copyright (C) 2006-2011 by Bo Haglund */
/* Cleanups and porting to Linux and MacOSX (C) 2006 by Alex Martelli */
/* */
Expand All @@ -17,7 +17,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc, 51 Franklin Street, 5th Floor, Boston MA 02110-1301, USA. */

/*#include "stdafx.h"*/ /* Needed by Visual C++ */
#include "stdafx.h" /* Needed by Visual C++ */

#include "dll.h"

Expand Down Expand Up @@ -837,7 +837,7 @@ int _initialized=0;
void InitStart(int gb_ram, int ncores) {
int k, r, i, j, m;
unsigned short int res;
long double pcmem; /* kbytes */
unsigned __int64 pcmem; /* kbytes */

if (_initialized)
return;
Expand All @@ -854,19 +854,18 @@ void InitStart(int gb_ram, int ncores) {
SYSTEM_INFO temp;

MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);

GlobalMemoryStatusEx (&statex);

pcmem=(long double)statex.ullTotalPhys/1024;
pcmem=(unsigned __int64)statex.ullTotalPhys/1024;

if (pcmem < 1500000.0)
if (pcmem < 1500000)
noOfThreads=Min(MAXNOOFTHREADS, 2);
else if (pcmem < 2500000.0/*1500000.0*/)
else if (pcmem < 2500000)
noOfThreads=Min(MAXNOOFTHREADS, 4);
else if (pcmem < 4500000.0)
else
noOfThreads=Min(MAXNOOFTHREADS, 8);
else
noOfThreads=Min(MAXNOOFTHREADS, 16);

GetSystemInfo(&temp);
noOfCores=Min(noOfThreads, (int)temp.dwNumberOfProcessors);
Expand All @@ -875,16 +874,14 @@ void InitStart(int gb_ram, int ncores) {
else {
if (gb_ram < 2)
noOfThreads=Min(MAXNOOFTHREADS, 2);
else if (gb_ram < 3/*2*/)
else if (gb_ram < 3)
noOfThreads=Min(MAXNOOFTHREADS, 4);
else if (gb_ram < 5)
else
noOfThreads=Min(MAXNOOFTHREADS, 8);
else
noOfThreads=Min(MAXNOOFTHREADS, 16);

noOfCores=Min(noOfThreads, ncores);

pcmem=(long double)(1000000 * gb_ram);
pcmem=(unsigned __int64)(1000000 * gb_ram);
}

/*printf("noOfThreads: %d noOfCores: %d\n", noOfThreads, noOfCores);*/
Expand All @@ -910,7 +907,7 @@ void InitStart(int gb_ram, int ncores) {
25000001*sizeof(struct winCardType)+
400001*sizeof(struct posSearchType))/noOfThreads);
else {
localVar[k].maxmem = (__int64)(pcmem-32678) * (700/noOfThreads);
localVar[k].maxmem = (unsigned __int64)(pcmem-32678) * (700/noOfThreads);
/* Linear calculation of maximum memory, formula by Michiel de Bondt */

if (localVar[k].maxmem < 10485760) exit (1);
Expand Down Expand Up @@ -4621,7 +4618,9 @@ move 2 is the presently winning card of the trick */
return TRUE;
else
return FALSE;
}
}
else
return FALSE;
}


Expand Down Expand Up @@ -5573,7 +5572,7 @@ int SolveAllBoards4(struct boards *bop, struct solvedBoards *solvedp) {
if (param.error==0)
return 1;
else
return param.error;
return param.error;
}

DWORD CALLBACK SolveChunk (void *) {
Expand All @@ -5600,7 +5599,7 @@ DWORD CALLBACK SolveChunk (void *) {
param.bop->solutions[j], param.bop->mode[j], futp[j], thid);
if (res==1) {
param.solvedp->solvedBoard[j]=fut[j];
param.error=0;
param.error=0;
}
else {
param.error=res;
Expand Down Expand Up @@ -5671,7 +5670,7 @@ int SolveAllBoards1(struct boards *bop, struct solvedBoards *solvedp) {
if (param.error==0)
return 1;
else
return param.error;
return param.error;
}
#else
int SolveAllBoards4(struct boards *bop, struct solvedBoards *solvedp) {
Expand Down
10 changes: 5 additions & 5 deletions dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/* end of portability-macros section */

#define DDS_VERSION 20200 /* Version 2.2.0. Allowing for 2 digit
#define DDS_VERSION 20201 /* Version 2.2.1. Allowing for 2 digit
minor versions */

#define PBN
Expand Down Expand Up @@ -61,7 +61,7 @@
#endif
#define INFINITY 32000

#define MAXNOOFTHREADS 16
#define MAXNOOFTHREADS 8/*16*/

#define MAXNODE 1
#define MINNODE 0
Expand Down Expand Up @@ -330,9 +330,9 @@ struct localVarType {
int nodeSetSizeLimit;
int winSetSizeLimit;
int lenSetSizeLimit;
__int64 maxmem; /* bytes */
__int64 allocmem;
__int64 summem;
unsigned __int64 maxmem; /* bytes */
unsigned __int64 allocmem;
unsigned __int64 summem;
int wmem;
int nmem;
int lmem;
Expand Down
5 changes: 2 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DDS 2.2.0, Bo Haglund 2012-07-06
DDS 2.2.1, Bo Haglund 2012-07-16

For Win32, DDS compiles with Visual C++ 2010 Express edition
and the Mingw port of gcc.
Expand All @@ -25,7 +25,6 @@ The maximum number of simultaneous threads depends on the PC physical memory siz
1 GB or less, max 2 threads.
2 GB, max 4 threads.
3 or 4 GB, max 8 threads.
More than 4 GB, max 16 threads.

For Windows, allocating memory for the maximum number of simultaneous threads can
be done by reading out the physical memory size from Windows. This is done in the DDS.DLL.
Expand Down Expand Up @@ -55,7 +54,7 @@ The possible configurens thus are:
2) "PBN": Support for SolveBoardPBN and CalcDDtablePBN.
3) None of these definitions: No support for any of the above 3 functions.

Not including code might be necessary when 2.2.0 is to replace an older 2.x.y version,
Not including code might be necessary when 2.2.1 is to replace an older 2.x.y version,
and the application using DDS cannot handle a changed interface.


Expand Down
12 changes: 12 additions & 0 deletions release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,21 @@ function to detect the RAM size.
1.1.13 is 5-10% faster than 1.1.12.


Release Notes DDS 2.2.1
-----------------------
Problem fixed in 2.2.1:
Fault in using the Windows function to detect RAM memory size that could
cause DDS termination.

Clarifying that DDS 2.2.1 is a 32-bit DLL not capable of using more than 4 GB.
Max threads are 8.


Release Notes DDS 1.1.14
------------------------
Problem fixed in 1.1.14:
Fault in using the Windows function to detect RAM memory size that could
cause DDS termination.



Expand Down

0 comments on commit 422593e

Please sign in to comment.