diff options
author | joerg <joerg> | 2016-10-01 13:04:16 +0000 |
---|---|---|
committer | joerg <joerg> | 2016-10-01 13:04:16 +0000 |
commit | ad53e232df9bcb0e976be868f9438b532b05ca05 (patch) | |
tree | 8d24df3a1f5bfa0d76a4152671371036408ea796 /math | |
parent | fe740ff1aad44ac19ac7d53b37db3214e9f42734 (diff) | |
download | pkgsrc-ad53e232df9bcb0e976be868f9438b532b05ca05.tar.gz |
Don't depend on outdated ftime interface.
Diffstat (limited to 'math')
5 files changed, 157 insertions, 1 deletions
diff --git a/math/vowpal_wabbit/distinfo b/math/vowpal_wabbit/distinfo index 183513c1531..acdcfe89076 100644 --- a/math/vowpal_wabbit/distinfo +++ b/math/vowpal_wabbit/distinfo @@ -1,8 +1,12 @@ -$NetBSD: distinfo,v 1.2 2016/09/18 07:08:19 dholland Exp $ +$NetBSD: distinfo,v 1.3 2016/10/01 13:04:16 joerg Exp $ SHA1 (vowpal_wabbit-8.2.0.tar.gz) = 7fd516e1ff16ac03fd389b59abaf462f6fca61cb RMD160 (vowpal_wabbit-8.2.0.tar.gz) = a2e91b3f6d0f2b50f8cef382ce1995016ff074e0 SHA512 (vowpal_wabbit-8.2.0.tar.gz) = 7f352c7d899e1068969ecf10931ce59efaedb5ffb91277958e96b1c705cb9f9da7397dcded42e101ba98412124e2662ca5cf71b368ab7d80ce7afe650cdd59c6 Size (vowpal_wabbit-8.2.0.tar.gz) = 13391191 bytes +SHA1 (patch-vowpalwabbit_accumulate.cc) = 605cb7e6d1bf1efe0051c4a35a609b277b4f7f4d +SHA1 (patch-vowpalwabbit_allreduce__sockets.cc) = d412ecea83a70af56d08752fb5f99675dd6fd0e4 +SHA1 (patch-vowpalwabbit_bfgs.cc) = 4e1532fd3fd7b3ccf37480a2b443309e0c7ff797 +SHA1 (patch-vowpalwabbit_main.cc) = 46bdcaca26ea4635ab0b5c361227fe907e3fbfd9 SHA1 (patch-vowpalwabbit_parser.cc) = 1ea77e94b53ec7a24b5fabbd9e05cb9b47ac6707 SHA1 (patch-vowpalwabbit_sender.cc) = 796daf462f50d9d2b7a90d6a032cbf69f7a3a374 diff --git a/math/vowpal_wabbit/patches/patch-vowpalwabbit_accumulate.cc b/math/vowpal_wabbit/patches/patch-vowpalwabbit_accumulate.cc new file mode 100644 index 00000000000..c277c75ddda --- /dev/null +++ b/math/vowpal_wabbit/patches/patch-vowpalwabbit_accumulate.cc @@ -0,0 +1,12 @@ +$NetBSD: patch-vowpalwabbit_accumulate.cc,v 1.1 2016/10/01 13:04:16 joerg Exp $ + +--- vowpalwabbit/accumulate.cc.orig 2016-09-30 09:24:37.000000000 +0000 ++++ vowpalwabbit/accumulate.cc +@@ -9,7 +9,6 @@ Alekh Agarwal and John Langford, with he + */ + + #include <iostream> +-#include <sys/timeb.h> + #include <cmath> + #include <stdint.h> + #include "global_data.h" diff --git a/math/vowpal_wabbit/patches/patch-vowpalwabbit_allreduce__sockets.cc b/math/vowpal_wabbit/patches/patch-vowpalwabbit_allreduce__sockets.cc new file mode 100644 index 00000000000..684c7c4e905 --- /dev/null +++ b/math/vowpal_wabbit/patches/patch-vowpalwabbit_allreduce__sockets.cc @@ -0,0 +1,12 @@ +$NetBSD: patch-vowpalwabbit_allreduce__sockets.cc,v 1.1 2016/10/01 13:04:16 joerg Exp $ + +--- vowpalwabbit/allreduce_sockets.cc.orig 2016-09-30 09:24:32.000000000 +0000 ++++ vowpalwabbit/allreduce_sockets.cc +@@ -24,7 +24,6 @@ Alekh Agarwal and John Langford, with he + #include <unistd.h> + #include <arpa/inet.h> + #endif +-#include <sys/timeb.h> + #include "allreduce.h" + #include "vw_exception.h" + diff --git a/math/vowpal_wabbit/patches/patch-vowpalwabbit_bfgs.cc b/math/vowpal_wabbit/patches/patch-vowpalwabbit_bfgs.cc new file mode 100644 index 00000000000..ccd05afc7ee --- /dev/null +++ b/math/vowpal_wabbit/patches/patch-vowpalwabbit_bfgs.cc @@ -0,0 +1,90 @@ +$NetBSD: patch-vowpalwabbit_bfgs.cc,v 1.1 2016/10/01 13:04:16 joerg Exp $ + +--- vowpalwabbit/bfgs.cc.orig 2016-09-30 09:20:08.000000000 +0000 ++++ vowpalwabbit/bfgs.cc +@@ -15,7 +15,7 @@ Implementation by Miro Dudik. + #include <string.h> + #include <stdio.h> + #include <assert.h> +-#include <sys/timeb.h> ++#include <sys/time.h> + #include "accumulate.h" + #include "gd.h" + #include "vw_exception.h" +@@ -62,10 +62,10 @@ struct bfgs + double wolfe1_bound; + + size_t final_pass; +- struct timeb t_start, t_end; ++ struct timeval t_start, t_end; + double net_comm_time; + +- struct timeb t_start_global, t_end_global; ++ struct timeval t_start_global, t_end_global; + double net_time; + + v_array<float> predictions; +@@ -553,8 +553,8 @@ int process_pass(vw& all, bfgs& b) + else + { b.step_size = 0.5; + float d_mag = direction_magnitude(all); +- ftime(&b.t_end_global); +- b.net_time = (int) (1000.0 * (b.t_end_global.time - b.t_start_global.time) + (b.t_end_global.millitm - b.t_start_global.millitm)); ++ gettimeofday(&b.t_end_global, NULL); ++ b.net_time = (int) (1000.0 * (b.t_end_global.tv_sec - b.t_start_global.tv_sec) + 0.001 * (b.t_end_global.tv_usec - b.t_start_global.tv_usec)); + if (!all.quiet) + fprintf(stderr, "%-10s\t%-10.5f\t%-10.5f\n", "", d_mag, b.step_size); + b.predictions.erase(); +@@ -602,8 +602,8 @@ int process_pass(vw& all, bfgs& b) + /********************************************************************/ + else if (b.backstep_on && (wolfe1<b.wolfe1_bound || b.loss_sum > b.previous_loss_sum)) + { // curvature violated, or we stepped too far last time: step back +- ftime(&b.t_end_global); +- b.net_time = (int) (1000.0 * (b.t_end_global.time - b.t_start_global.time) + (b.t_end_global.millitm - b.t_start_global.millitm)); ++ gettimeofday(&b.t_end_global, NULL); ++ b.net_time = (int) (1000.0 * (b.t_end_global.tv_sec - b.t_start_global.tv_sec) + 0.001 * (b.t_end_global.tv_usec - b.t_start_global.tv_usec)); + float ratio = (b.step_size==0.f) ? 0.f : (float)new_step/(float)b.step_size; + if (!all.quiet) + fprintf(stderr, "%-10s\t%-10s\t(revise x %.1f)\t%-10.5f\n", +@@ -647,8 +647,8 @@ int process_pass(vw& all, bfgs& b) + } + else + { float d_mag = direction_magnitude(all); +- ftime(&b.t_end_global); +- b.net_time = (int) (1000.0 * (b.t_end_global.time - b.t_start_global.time) + (b.t_end_global.millitm - b.t_start_global.millitm)); ++ gettimeofday(&b.t_end_global, NULL); ++ b.net_time = (int) (1000.0 * (b.t_end_global.tv_sec - b.t_start_global.tv_sec) + 0.001 * (b.t_end_global.tv_usec - b.t_start_global.tv_usec)); + if (!all.quiet) + fprintf(stderr, "%-10s\t%-10.5f\t%-10.5f\n", "", d_mag, b.step_size); + b.predictions.erase(); +@@ -685,8 +685,8 @@ int process_pass(vw& all, bfgs& b) + + b.predictions.erase(); + update_weight(all, b.step_size); +- ftime(&b.t_end_global); +- b.net_time = (int) (1000.0 * (b.t_end_global.time - b.t_start_global.time) + (b.t_end_global.millitm - b.t_start_global.millitm)); ++ gettimeofday(&b.t_end_global, NULL); ++ b.net_time = (int) (1000.0 * (b.t_end_global.tv_sec - b.t_start_global.tv_sec) + 0.001 * (b.t_end_global.tv_usec - b.t_start_global.tv_usec)); + if (!all.quiet) + fprintf(stderr, "%-10.5f\t%-10.5f\t%-10.5f\n", b.curvature / b.importance_weight_sum, d_mag, b.step_size); + b.gradient_pass = true; +@@ -700,8 +700,8 @@ int process_pass(vw& all, bfgs& b) + accumulate(all, all.reg, W_COND); //Accumulate preconditioner + //preconditioner_to_regularizer(all, b, all.l2_lambda); + } +- ftime(&b.t_end_global); +- b.net_time = (int) (1000.0 * (b.t_end_global.time - b.t_start_global.time) + (b.t_end_global.millitm - b.t_start_global.millitm)); ++ gettimeofday(&b.t_end_global, NULL); ++ b.net_time = (int) (1000.0 * (b.t_end_global.tv_sec - b.t_start_global.tv_sec) + 0.001 * (b.t_end_global.tv_usec - b.t_start_global.tv_usec)); + + if (all.save_per_pass) + save_predictor(all, all.final_regressor_name, b.current_pass); +@@ -883,7 +883,7 @@ void save_load(bfgs& b, io_buf& model_fi + } + + b.net_time = 0.0; +- ftime(&b.t_start_global); ++ gettimeofday(&b.t_start_global, NULL); + + if (!all->quiet) + { const char * header_fmt = "%2s %-10s\t%-10s\t%-10s\t %-10s\t%-10s\t%-10s\t%-10s\t%-10s\t%-10s\n"; diff --git a/math/vowpal_wabbit/patches/patch-vowpalwabbit_main.cc b/math/vowpal_wabbit/patches/patch-vowpalwabbit_main.cc new file mode 100644 index 00000000000..a6b9569a877 --- /dev/null +++ b/math/vowpal_wabbit/patches/patch-vowpalwabbit_main.cc @@ -0,0 +1,38 @@ +$NetBSD: patch-vowpalwabbit_main.cc,v 1.1 2016/10/01 13:04:16 joerg Exp $ + +--- vowpalwabbit/main.cc.orig 2016-09-30 09:21:08.000000000 +0000 ++++ vowpalwabbit/main.cc +@@ -9,7 +9,7 @@ license as described in the file LICENSE + #include <sys/socket.h> + #include <arpa/inet.h> + #endif +-#include <sys/timeb.h> ++#include <sys/time.h> + #include "parse_args.h" + #include "parse_regressor.h" + #include "accumulate.h" +@@ -91,8 +91,8 @@ int main(int argc, char *argv[]) + + vw& all = *alls[0]; + +- struct timeb t_start, t_end; +- ftime(&t_start); ++ struct timeval t_start, t_end; ++ gettimeofday(&t_start, NULL); + + VW::start_parser(all); + if (alls.size() == 1) +@@ -102,10 +102,10 @@ int main(int argc, char *argv[]) + + VW::end_parser(all); + +- ftime(&t_end); +- double net_time = (int) (1000.0 * (t_end.time - t_start.time) + (t_end.millitm - t_start.millitm)); ++ gettimeofday(&t_end, NULL); ++ double net_time = (t_end.tv_sec - t_start.tv_sec) + (t_end.tv_usec - t_start.tv_usec) * 0.000001; + if(!all.quiet && all.all_reduce != nullptr) +- cerr<<"Net time taken by process = "<<net_time/(double)(1000)<<" seconds\n"; ++ cerr<<"Net time taken by process = "<<net_time<<" seconds\n"; + + for (vw* v : alls) + { VW::sync_stats(*v); |