gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] Persistent cache strangeness.


From: Trevor Morris
Subject: Re: [gnugo-devel] Persistent cache strangeness.
Date: Wed, 17 Oct 2001 14:40:54 -0400

I followed the -t -t traces to find the first place the two
cases diverged, and it seemed to be in the persistent cache.
It could, of course, could just be a coincidence that this
solves the problem.

A very simple patch that I used to clear the persistent
cache in loadsgf follows.  You won't want to add this to
CVS, as I'd also turned on CHECK_HASHING, and am not at all
convinced this is the right approach.

-Trevor

>> The following GTP gives different answers:
>> 
>> loadsgf games/trevor/trevor_26.sgf 39
>> gg_genmove black
>> loadsgf games/trevor/trevor_26.sgf 39
>> gg_genmove black
>> 
>> The problem can be avoided by clearing the owl persistent cache when
>> calling loadsgf, though the -t -t traces are still different, even
>> after that.  This should not be the case, right?
>
>Why do you say the problem has to do with the persistent
>cache, and how did you check that clearing the cache fixes
>the problem?
>
>I think the main problem is not the persistent cache but
>the scheme in evaluate_position(). If the persistent
>cache is also a part of the problem then I really don't
>understand what is happening. But I'd like to hear why
>you think it is.
>
>If this is a persistent cache problem, there is a true
>bug lying around here.
>
>Perhaps the problem can be fixed by having genmove clear
>the parameters worms_examined and so forth. The caching
>scheme would still give a speedup in owl tests such as
>ld_owl but would hopefully fix this problem with 
>repeated calls to genmove.


http://www.public32.com/games/go/clear_persist_1_11.6
 - Not for CVS!
 - Shows how I cleared the persistent owl cache on loadsgf

Index: engine/hash.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/hash.h,v
retrieving revision 1.4
diff -u -r1.4 hash.h
--- engine/hash.h       2001/09/15 21:21:53     1.4
+++ engine/hash.h       2001/10/17 18:29:12
@@ -56,7 +56,7 @@
 typedef unsigned long Compacttype;
 
 /* for testing: Enables a lot of checks. */
-#define CHECK_HASHING 0
+#define CHECK_HASHING 1
 
 
 /*
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.36
diff -u -r1.36 liberty.h
--- engine/liberty.h    2001/10/16 19:53:01     1.36
+++ engine/liberty.h    2001/10/17 18:29:17
@@ -180,7 +180,7 @@
 
 /* Coordinates for the eight directions, ordered
  * south, west, north, east, southwest, northwest, northeast, southeast.
- * Defined in utils.c.
+ * Defined in board.c.
  */
 extern int deltai[8]; /* = { 1,  0, -1,  0,  1, -1, -1, 1}; */
 extern int deltaj[8]; /* = { 0, -1,  0,  1, -1, -1,  1, 1}; */
@@ -320,6 +320,8 @@
 
 void find_stones_saved_by_move(int pos, int color,
                               char saved_stones[BOARDMAX]);
+
+void owl_clear_cache();
 
 int owl_lively(int pos);
 int owl_escape_value(int pos);
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.22
diff -u -r1.22 owl.c
--- engine/owl.c        2001/10/16 19:53:01     1.22
+++ engine/owl.c        2001/10/17 18:29:38
@@ -121,6 +121,13 @@
 #define MAX_OWL_CACHE_SIZE 80
 static struct owl_cache persistent_owl_cache[MAX_OWL_CACHE_SIZE];
 static int persistent_owl_cache_size = 0;
+
+
+void
+owl_clear_cache() {
+  persistent_owl_cache_size = 0;
+}
+
 
 #define OWL_THREATEN_ATTACK    0
 #define OWL_THREATEN_DEFENSE   1
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.35
diff -u -r1.35 play_gtp.c
--- interface/play_gtp.c        2001/10/17 00:07:11     1.35
+++ interface/play_gtp.c        2001/10/17 18:30:02
@@ -509,6 +509,8 @@
   return gtp_finish_response();
 }
 
+
+
 
 /* Function:  Load an sgf file, possibly up to a move number or the first
  *            occurence of a move.           
@@ -532,8 +534,9 @@
   
   if ((sgf = readsgffile(filename)) == NULL)
     return gtp_failure(id, "cannot open or parse '%s'", filename);
-
-  gameinfo_clear(&gameinfo, 19, 5.5); /* Probably unnecessary. */
+
+  owl_clear_cache();
+  gameinfo_clear(&gameinfo, 19, 5.5); /* Probably unnecessary. */
   gameinfo_load_sgfheader(&gameinfo, sgf);
 
   if (nread == 1)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]