adding timing

This commit is contained in:
nachocano 2014-12-05 16:00:47 -08:00
parent 54eb5623cb
commit 67b68ceae6
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,7 @@ This is an example job submit script for hadoop streaming
import argparse
import sys
import os
import time
import subprocess
sys.path.append('./src/')
import rabit_master as master
@ -26,4 +27,6 @@ def hadoop_streaming(nslaves, slave_args):
print cmd
subprocess.check_call(cmd, shell = True)
start = time.time()
master.submit(args.nslaves, [], fun_submit= hadoop_streaming)
print 'All run took %s' % (time.time() - start)

View File

@ -3,6 +3,7 @@
#include <rabit.h>
#include <utils.h>
#include "./toolkit_util.h"
#include <time.h>
using namespace rabit;
@ -85,6 +86,8 @@ int main(int argc, char *argv[]) {
printf("Usage: <data_dir> num_cluster max_iter <out_model>\n");
return 0;
}
clock_t tStart = clock();
srand(0);
// load the data
SparseMat data;
@ -140,6 +143,7 @@ int main(int argc, char *argv[]) {
if (rabit::GetRank() == 0) {
model.centroids.Print(argv[4]);
}
utils::LogPrintf("[%d] Time taken: %f seconds\n", rabit::GetRank(), static_cast<float>(clock() - tStart) / CLOCKS_PER_SEC);
rabit::Finalize();
return 0;
}