Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@humpty.(none)>2010-09-17 21:58:44 +0400
committerJohn Langford <jl@humpty.(none)>2010-09-17 21:58:44 +0400
commit49827316d3c13cacadf290bb50038b39f69bfe86 (patch)
treee015b12904bcf1094e3e6c972919806aefe17950 /parser.cc
parentf8f15007ef9363827c3399b044324530b6b77a01 (diff)
solved slow finishing bug
Diffstat (limited to 'parser.cc')
-rw-r--r--parser.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/parser.cc b/parser.cc
index 75a6849f..ae63b599 100644
--- a/parser.cc
+++ b/parser.cc
@@ -336,10 +336,22 @@ pthread_cond_t example_available = PTHREAD_COND_INITIALIZER;
pthread_cond_t example_unused = PTHREAD_COND_INITIALIZER;
size_t parsed_index; // The index of the parsed example.
size_t* used_index; // The index of the example currently used by thread i.
-bool done;
+bool done=false;
v_array<size_t> random_nos;
v_array<size_t> gram_mask;
+bool parser_done()
+{
+ if (done)
+ {
+ for (size_t i = 0; i < global.num_threads(); i++)
+ if (used_index[i] != parsed_index)
+ return false;
+ return true;
+ }
+ return false;
+}
+
void addgrams(size_t ngram, size_t skip_gram, v_array<feature>& atomics, v_array<audit_data>& audits,
size_t initial_length, v_array<size_t> &gram_mask, size_t skips)
{
@@ -581,21 +593,6 @@ void *main_parse_loop(void *in)
return NULL;
}
-bool examples_to_finish()
-{
- if (!done)
- return true;
- pthread_mutex_lock(&examples_lock);
- for(size_t i = 0; i < ring_size; i++)
- if (examples[i].in_use)
- {
- pthread_mutex_unlock(&examples_lock);
- return true;
- }
- pthread_mutex_unlock(&examples_lock);
- return false;
-}
-
void free_example(example* ec)
{
pthread_mutex_lock(&examples_lock);