From 613ccc6ea2401e76099a97d3698f13b8ea283497 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 24 Jan 2010 08:36:21 +0000 Subject: Support building without gtest Now the only dependence is boost, which most modern linux distros have. --- training/cluster-ptrain.pl | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'training/cluster-ptrain.pl') diff --git a/training/cluster-ptrain.pl b/training/cluster-ptrain.pl index 8944ae34..7643d4e5 100755 --- a/training/cluster-ptrain.pl +++ b/training/cluster-ptrain.pl @@ -1,14 +1,13 @@ #!/usr/bin/perl -w use strict; -my $SCRIPT_DIR; BEGIN { use Cwd qw/ abs_path /; use File::Basename; $SCRIPT_DIR = dirname(abs_path($0)); push @INC, $SCRIPT_DIR; } +my $SCRIPT_DIR; BEGIN { use Cwd qw/ abs_path getcwd /; use File::Basename; $SCRIPT_DIR = dirname(abs_path($0)); push @INC, $SCRIPT_DIR; } use Getopt::Long; my $MAX_ITER_ATTEMPTS = 5; # number of times to retry a failed function evaluation -my $CWD=`pwd`; chomp $CWD; -my $BIN_DIR = $SCRIPT_DIR; -my $OPTIMIZER = "$BIN_DIR/mr_optimize_reduce"; -my $DECODER = "$BIN_DIR/../decoder/cdec"; +my $CWD=getcwd(); +my $OPTIMIZER = "$SCRIPT_DIR/mr_optimize_reduce"; +my $DECODER = "$SCRIPT_DIR/../decoder/cdec"; my $COMBINER_CACHE_SIZE = 150; # This is a hack to run this on a weird cluster, # eventually, I'll provide Hadoop scripts. @@ -30,13 +29,15 @@ my $PRIOR; my $OALG = "lbfgs"; my $sigsq = 1; my $means_file; +my $RESTART_IF_NECESSARY; GetOptions("cdec=s" => \$DECODER, - "run_locally" => \$LOCAL, "distributed" => \$DISTRIBUTED, "sigma_squared=f" => \$sigsq, + "max_iteration=i" => \$max_iteration, "means=s" => \$means_file, "optimizer=s" => \$OALG, "gaussian_prior" => \$PRIOR, + "restart_if_necessary" => \$RESTART_IF_NECESSARY, "jobs=i" => \$nodes, "pmem=s" => \$pmem ) or usage(); @@ -61,6 +62,11 @@ if ($parallel) { unless ($parallel) { $CFLAG = "-C 500"; } unless ($config_file =~ /^\//) { $config_file = $CWD . '/' . $config_file; } my $clines = num_lines($training_corpus); +my $dir = "$CWD/ptrain"; + +if ($RESTART_IF_NECESSARY && -d $dir) { + $restart = 1; +} print STDERR <