Skip to content

Commit

Permalink
Bo's new (old) TT code and general clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenhein committed Mar 20, 2016
1 parent f1ec60d commit c8503f1
Show file tree
Hide file tree
Showing 11 changed files with 1,303 additions and 53 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Release Notes DDS 2.8.4
-----------------------
Added a lower-memory DLL version with a compile flag.
Added a lower-memory DLL version with a compile flag. This is about
11-14% slower, but uses a lot less memory. For example, for a
single thread on one PC, the memory usage was 24 MB rather than 110 MB.
For 12 threads, the numbers were 89 MB rather than 1.1 GB.

Added TDC 32-bit and 64-bit Makefiles contributed by Sergio Polini.

Expand Down
2 changes: 1 addition & 1 deletion src/Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ void FreeThreadMem()
{
for (int k = 0; k < noOfThreads; k++)
{
localVar[k].transTable.ResetMemory();
localVar[k].transTable.ResetMemory(FREE_THREAD_MEM);
localVar[k].memUsed = localVar[k].transTable.MemoryInUse() +
ThreadMemoryUsed();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Makefiles/Makefile_Visual
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WARN_FLAGS = \
/wd4996 \
/WX

# Here you can turn on warnings.
# Here you can turn on warnings and add /DSMALL_MEMORY_OPTION.
# CC_FULL_FLAGS = $(CC_FLAGS)
CC_FULL_FLAGS = $(CC_FLAGS) $(WARN_FLAGS)

Expand Down
2 changes: 1 addition & 1 deletion src/Makefiles/Makefile_cygwin
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ WARN_FLAGS = \
-Wno-unknown-pragmas \
-Wno-long-long

# Here you can turn on warnings.
# Here you can turn on warnings and add -DSMALL_MEMORY_OPTION
# CC_FULL_FLAGS = $(CC_FLAGS)
CC_FULL_FLAGS = $(CC_FLAGS) $(WARN_FLAGS)

Expand Down
2 changes: 1 addition & 1 deletion src/Makefiles/Makefile_mingw
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ WARN_FLAGS = \
-Wno-long-long \
-Wno-format

# Here you can turn on warnings.
# Here you can turn on warnings and add -DSMALL_MEMORY_OPTION
# CC_FULL_FLAGS = $(CC_FLAGS)
CC_FULL_FLAGS = $(CC_FLAGS) $(WARN_FLAGS)

Expand Down
9 changes: 8 additions & 1 deletion src/SolverIF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,14 @@ int STDCALL SolveBoard(
newTrump ||
(thrp->nodes > SIMILARMAXWINNODES)))
{
thrp->transTable.ResetMemory();
int reason = UNKNOWN_REASON;
if (thrp->nodes > SIMILARMAXWINNODES)
reason = TOO_MANY_NODES;
else if (newDeal && ! similarDeal)
reason = NEW_DEAL;
else if (newTrump)
reason = NEW_TRUMP;
thrp->transTable.ResetMemory(reason);
}

if (newDeal)
Expand Down
26 changes: 13 additions & 13 deletions src/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void Timer::OutputDetails()
fprintf(fp, "%-14s %10d %10lld %10.2f %10.0f %10.2f\n",
name[no],
count[no],
userCum[no],
static_cast<long long>(userCum[no]),
static_cast<double>(userCum[no]) /
static_cast<double>(count[no]),
1000. * systCum[no],
Expand Down Expand Up @@ -251,8 +251,8 @@ void Timer::PrintStats()
{
fprintf(fp, "%-14s %8lld %10lld %6.2f %4.1f %10.0f %6.2f %4.1f\n",
TIMER_NAMES[0],
AB_ct,
AB_ucum,
static_cast<long long>(AB_ct),
static_cast<long long>(AB_ucum),
AB_ucum / static_cast<double>(AB_ct),
100. * AB_ucum / all_ucum,
1000. * AB_scum,
Expand All @@ -263,8 +263,8 @@ void Timer::PrintStats()
{
fprintf(fp, "%-14s %8lld %10lld %6s %4s %10.0f %6s %4s\n",
TIMER_NAMES[0],
AB_ct,
AB_ucum,
static_cast<long long>(AB_ct),
static_cast<long long>(AB_ucum),
"-",
"-",
1000. * AB_scum,
Expand Down Expand Up @@ -292,8 +292,8 @@ void Timer::PrintStats()
{
fprintf(fp, "%-14s %8lld %10lld %6.2f %4.1f %10.0f %6.2f %4.1f\n",
TIMER_NAMES[no],
ct[no],
ucum,
static_cast<long long>(ct[no]),
static_cast<long long>(ucum),
ucum / static_cast<double>(ct[no]),
100. * ucum / all_ucum,
1000. * scum,
Expand All @@ -304,8 +304,8 @@ void Timer::PrintStats()
{
fprintf(fp, "%-14s %8lld %10lld %6s %4s %10.0f %6s %4s\n",
TIMER_NAMES[no],
ct[no],
ucum,
static_cast<long long>(ct[no]),
static_cast<long long>(ucum),
"-",
"-",
1000. * scum,
Expand All @@ -318,7 +318,7 @@ void Timer::PrintStats()
fprintf(fp, "%-14s %8s %10lld %6s %4s %10.0f\n\n\n",
"Sum",
"",
all_ucum,
static_cast<long long>(all_ucum),
"",
"",
1000. * all_scum);
Expand Down Expand Up @@ -355,7 +355,7 @@ void Timer::PrintStats()
fprintf(fp, "%-14s %8d %10lld %6.2f %4.1f %10.0f %6.2f %4.1f\n",
name[TIMER_AB + no],
count[no],
AB_userCum[no],
static_cast<long long>(AB_userCum[no]),
AB_userCum[no] / static_cast<double>(count[no]),
100. * AB_userCum[no] / AB_ucum,
1000. * AB_systCum[no],
Expand All @@ -367,8 +367,8 @@ void Timer::PrintStats()
fprintf(fp, "-----------------------------------\n");
fprintf(fp, "%-14s %8lld %10lld %6s %4s %10.0f\n\n\n",
"Sum",
AB_ct,
AB_ucum,
static_cast<long long>(AB_ct),
static_cast<long long>(AB_ucum),
"",
"",
1000. * AB_scum);
Expand Down
Loading

0 comments on commit c8503f1

Please sign in to comment.