From 11a43ba20296f7ab50f3d86987c00bbcba873c43 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 15 Jan 2010 23:27:01 +0100 Subject: [PATCH] UCT node_sizes -> nodes_size (correct spelling) --- uct/tree.c | 4 ++-- uct/tree.h | 2 +- uct/walk.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/uct/tree.c b/uct/tree.c index 8c52a9d..c22593b 100644 --- a/uct/tree.c +++ b/uct/tree.c @@ -27,7 +27,7 @@ tree_init_node(struct tree *t, coord_t coord, int depth) fprintf(stderr, "tree_init_node(): OUT OF MEMORY\n"); exit(1); } - __sync_fetch_and_add(&t->node_sizes, sizeof(*n)); + __sync_fetch_and_add(&t->nodes_size, sizeof(*n)); n->coord = coord; n->depth = depth; volatile static long c = 1000000; @@ -59,7 +59,7 @@ tree_done_node(struct tree *t, struct tree_node *n) tree_done_node(t, ni); ni = nj; } - t->node_sizes -= sizeof(*n); // atomic operation not needed here + t->nodes_size -= sizeof(*n); // atomic operation not needed here free(n); } diff --git a/uct/tree.h b/uct/tree.h index 97cb5f8..5402b87 100644 --- a/uct/tree.h +++ b/uct/tree.h @@ -69,7 +69,7 @@ struct tree { // Statistics int max_depth; - volatile long node_sizes; // byte size of all allocated nodes + volatile long nodes_size; // byte size of all allocated nodes }; struct tree *tree_init(struct board *board, enum stone color); diff --git a/uct/walk.c b/uct/walk.c index 4b3fa55..2352886 100644 --- a/uct/walk.c +++ b/uct/walk.c @@ -20,7 +20,7 @@ #include "uct/walk.h" // This should become a dynamic parameter. 7G is suitable for 20k*23 threads. -#define MAX_NODE_SIZES (7L*1024*1024*1024) +#define MAX_NODES_SIZE (7L*1024*1024*1024) float uct_get_extra_komi(struct uct *u, struct board *b) @@ -97,11 +97,11 @@ uct_leaf_node(struct uct *u, struct board *b, enum stone player_color, /* We need to make sure only one thread expands the node. If * we are unlucky enough for two threads to meet in the same * node, the latter one will simply do another simulation from - * the node itself, no big deal. t->node_sizes may exceed - * MAX_NODE_SIZES in multi-threaded case but not by much so it's ok. + * the node itself, no big deal. t->nodes_size may exceed + * MAX_NODES_SIZE in multi-threaded case but not by much so it's ok. * The size test must be before the test&set not after, to allow * expansion of the node later if enough nodes have been freed. */ - if (n->u.playouts >= u->expand_p && t->node_sizes < MAX_NODE_SIZES + if (n->u.playouts >= u->expand_p && t->nodes_size < MAX_NODES_SIZE && !__sync_lock_test_and_set(&n->is_expanded, 1)) { tree_expand_node(t, n, b, next_color, u, parity); } -- 2.11.4.GIT