Commits

Shlomi Fish  committed 43da379

Some improvements.

  • Participants
  • Parent commits 93ed558

Comments (0)

Files changed (4)

File black-hole-solitaire/all-in-a-row-c-solver/Tatzer

 (
     tt => [qw(-r --notest-suite --static)],
     bench => [qw(-l tt --omit-frame)],
-    fc_bench => [qw(-l bench --fc-only)],
-    p4b => [qw(-l fc_bench --arch=pentium4)],
-    x64b => [qw(-l fc_bench --arch=barcelona)],
-    p4bb => [qw(-l bench --arch=pentium4)],
-    x64bb => [qw(-l bench --arch=barcelona)],
+    fc_bench => [qw(-l bench)],
 );
 
+foreach my $rec (
+    {id => "p4", a => "pentium4"},
+    {id => "x64", a => "barcelona"},
+    {id => "c2", a => "core2",},
+    {id => "ci7", a => "corei7-avx",}
+)
+{
+    my $id = $rec->{id};
+    my $arch = $rec->{a};
+
+    $themes{$id} = ["--arch=$arch"];
+    # Benchmark for freecell only
+    $themes{$id.'b'} = [qw(-l fc_bench -l), $id];
+    # Generalised benchmark - not freecell-only - should pass the tests.
+    $themes{$id.'bb'} = [qw(-l bench -l), $id];
+    # Memory conserving theme - for freecell only
+    $themes{$id.'m'} = [qw(-l fc_reduce_mem -l), $id];
+    # Generalised Memory conserving theme - not only for freecell
+    $themes{$id.'mm'} = [qw(-l reduce_mem -l), $id];
+    # Testing theme - aims to run the tests quickly
+    $themes{$id.'t'} = ['-l', $id.'bb', '--rwd', '--dbm=kaztree', '--test-suite',];
+
+    # For use by PySolFC
+    $themes{$id . "_pysol"} = ['-l', $id.'bb', '--num-stacks=14', "--prefix=$ENV{HOME}/apps/fcs-for-pysol",];
+}
+
 my @new_argv = @ARGV;
 
 CALC_NEW_ARGV:
 my @cmd= ("cmake",
     "-DCMAKE_BUILD_TYPE=$build_type",
     "-DBHS_STATE_STORAGE=BHS_STATE_STORAGE_$state_storage",
-    "-DMAX_NUM_BENCHMARK_THREADS=$max_bench_threads_num",
     "-DCMAKE_INSTALL_PREFIX=$prefix",
     "-DDATADIR=$prefix/share",
     ((!$build_static_lib) ? ("-DBUILD_STATIC_LIBRARY=") : ()),
         ? ("-DLIBAVL2_SOURCE_DIR=$ENV{LIBAVL2_SOURCE_DIR}")
         : ()
     ),
-    ($with_context_var
-        ? "-DFCS_WITH_CONTEXT_VARIABLE=1"
-        : "-DFCS_WITH_CONTEXT_VARIABLE="
-    ),
-    ($link_to_static
-        ? ("-DFCS_LINK_TO_STATIC=1")
-        : ("-DFCS_LINK_TO_STATIC=")
-    ),
     $dir
 );
 

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/collect.pl

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use autodie;
+
+use IO::All;
+
+# Threshold in seconds.
+my $THRESHOLD = 5;
+my $SUMMARY_FN = "SUMMARY.txt";
+
+my $time = time() - $THRESHOLD;
+
+my $start_idx;
+
+if (my $last_line = io($SUMMARY_FN)->[-1])
+{
+    ($start_idx) = $last_line =~ m/\A(\d+)/;
+    $start_idx++;
+}
+else
+{
+    $start_idx = 1;
+}
+
+my $idx = $start_idx;
+
+sub fn
+{
+    return "summaries/$idx.summary";
+}
+
+sub fh
+{
+    return io->file(fn());
+}
+
+while ((-e fn()) && (fh()->mtime() <= $time))
+{
+    fh() >> io($SUMMARY_FN);
+    fh()->unlink();
+}
+continue
+{
+    $idx++;
+}

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/range-solving.bash

 end_idx="1,000,000"
 num_cpus="4"
 
+if test -f SUMMARY.txt ; then
+    start_idx="$(tail -1 SUMMARY.txt | perl -lpe 's/\D.*//')"
+    let start_idx++
+fi
+
 seq "${start_idx//,/}" "${end_idx//,/}" | parallel -j"$num_cpus" perl summarize.pl {}

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/summarize.pl

 
 my $board_idx = shift(@ARGV);
 
+my $basename = "$board_idx.summary";
+my $final_fn = "summaries/$basename";
+
+if (-e $final_fn)
+{
+    exit(0);
+}
+
 my $text= `make_pysol_freecell_board.py -F -t $board_idx all_in_a_row | all-in-a-row-solve`;
 
 my ($verdict, $checked, $gen) = ($text =~ m{(Solved|Unsolved).*?^Total number of states checked is (\d+)\..*?^This scan generated (\d+) states\.}ms);
 my $v = substr($verdict, 0, 1);
 
 # We are using a temporary place and moving so it will be atomic.
-my $basename = "$board_idx.summary";
 my $temp_fn = "temp-summaries/$basename";
 open my $out_fh, '>', $temp_fn;
 print {$out_fh} "$board_idx\t$v\t$checked\t$gen\n";
 close ($out_fh);
 
-rename ($temp_fn, "summaries/$basename");
+rename ($temp_fn, $final_fn);