w2v-server: improve stability
diff --git a/w2v-server.pl b/w2v-server.pl
index 4aff19d..4276b60 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
use Inline C;
-use Inline C => Config => CLEAN_AFTER_BUILD => 0, ccflags => $Config{ccflags}." -O4";
+use Inline C => Config => CLEAN_AFTER_BUILD => 0, ccflags => $Config{ccflags}." -Wall -O4";
#use Inline C => Config => BUILD_NOISY => 1, CFLAGS => $Config{cflags}." -O4 -mtune k9";
#use Inline C => Config => CLEAN_AFTER_BUILD => 0, ccflags => $Config{ccflags}." -Ofast -march k8 -mtune k8 ";
use Mojolicious::Lite;
@@ -103,7 +103,7 @@
my $sort=$c->param('sort') || 0;
my $csv=$c->param('csv') || 0;
my $json=$c->param('json') || 0;
- my $cutoff=$c->param('cutoff') || 1000000;
+ my $cutoff=$c->param('cutoff') || 500000;
my $dedupe=$c->param('dedupe') || 0;
my $res;
my @lists;
@@ -656,6 +656,7 @@
collocator *best;
posix_memalign((void **) &best, 128, 10 * N * sizeof(collocator));
+ memset(best, 0, 10 * N * sizeof(collocator));
if(N>MAX_NEIGHBOURS) N=MAX_NEIGHBOURS;
@@ -794,7 +795,6 @@
best[b].conorm = 0.0;
best[b].probability = 0.0;
best[b].cprobability = syn_nbs[0]->best[b].cprobability;
- memset(best[b].heat, 0, sizeof(float) * 16);
}
float best_window_sum[MAX_NEIGHBOURS];
@@ -849,7 +849,7 @@
word_activation_sum += syn_nbs[a]->best[b].activation;
if(syn_nbs[a]->best[b].activation > best[i].max_activation)
best[i].max_activation = syn_nbs[a]->best[b].activation;
- if(best[i].heat[wpos] == 0 )
+ if(syn_nbs[a]->best[b].activation > best[i].heat[wpos] )
best[i].heat[wpos] = syn_nbs[a]->best[b].activation;
}
}
@@ -868,7 +868,7 @@
if(word_window_conorm > best[i].conorm) {
best[i].conorm = word_window_conorm;
- best[i].activation = word_activation_sum;
+// best[i].activation = word_activation_sum;
}
}
}