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. --- configure.ac | 2 +- decoder/Makefile.am | 7 +++++-- training/Makefile.am | 6 ++++-- training/cluster-ptrain.pl | 21 ++++++++++++++------- vest/Makefile.am | 8 ++++++-- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 0fd43e08..efb32284 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,8 @@ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" AC_CHECK_HEADER(boost/math/special_functions/digamma.hpp, [AC_DEFINE([HAVE_BOOST_DIGAMMA], [], [flag for boost::math::digamma])]) -GTEST_LIB_CHECK AC_PROG_INSTALL +GTEST_LIB_CHECK AC_ARG_WITH(srilm, [AC_HELP_STRING([--with-srilm=PATH], [(optional) path to SRI's LM toolkit])], diff --git a/decoder/Makefile.am b/decoder/Makefile.am index 4c86ae6f..19c22bc5 100644 --- a/decoder/Makefile.am +++ b/decoder/Makefile.am @@ -1,4 +1,7 @@ -bin_PROGRAMS = \ +bin_PROGRAMS = cdec + +if HAVE_GTEST +noinst_PROGRAMS = \ dict_test \ weights_test \ trule_test \ @@ -6,8 +9,8 @@ bin_PROGRAMS = \ ff_test \ parser_test \ grammar_test \ - cdec \ small_vector_test +endif cdec_SOURCES = cdec.cc forest_writer.cc maxtrans_blunsom.cc cdec_ff.cc ff_factory.cc timing_stats.cc small_vector_test_SOURCES = small_vector_test.cc diff --git a/training/Makefile.am b/training/Makefile.am index 944c75f7..b44812e7 100644 --- a/training/Makefile.am +++ b/training/Makefile.am @@ -4,9 +4,11 @@ bin_PROGRAMS = \ grammar_convert \ atools \ plftools \ - lbfgs_test \ mr_em_train \ - collapse_weights \ + collapse_weights + +noinst_PROGRAMS = \ + lbfgs_test \ optimize_test atools_SOURCES = atools.cc 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 <