Skylark (Sketching Library)  0.1
/var/lib/jenkins/jobs/Skylark/workspace/ml/train.cpp
Go to the documentation of this file.
00001 #include <elemental.hpp>
00002 #include <skylark.hpp>
00003 #include <fstream>
00004 #include <iostream>
00005 #include <sstream>
00006 #include <cstdlib>
00007 #include <string>
00008 #include <boost/mpi.hpp>
00009 #include <boost/program_options.hpp>
00010 #include <boost/any.hpp>
00011 #include "kernels.hpp"
00012 #include "hilbert.hpp"
00013 #include <omp.h>
00014 #include "../base/context.hpp"
00015 
00016 
00017 namespace bmpi =  boost::mpi;
00018 namespace po = boost::program_options;
00019 
00020 typedef skylark::base::sparse_matrix_t<double> sparse_matrix_t;
00021 
00022 
00023 int main (int argc, char** argv) {
00024     /* Various MPI/Skylark/Elemental/OpenMP initializations */
00025 
00026         std::cout << "Running skylark_ml" << std::endl;
00027 
00028     int provided;
00029     MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
00030     bmpi::environment env (argc, argv);
00031     boost::mpi::communicator comm;
00032 
00033     hilbert_options_t options (argc, argv, comm.size());
00034     skylark::base::context_t context (options.seed);
00035 
00036     elem::Initialize (argc, argv);
00037 
00038     if (options.exit_on_return) { return -1; }
00039     if (comm.rank() == 0)
00040         std::cout << options.print();
00041 
00042     bool sparse = (options.fileformat == LIBSVM_SPARSE) || (options.fileformat == HDF5_SPARSE);
00043     int flag = 0;
00044 
00045     if (sparse)
00046         flag = run<sparse_matrix_t, elem::Matrix<double> >(comm, context, options);
00047     else
00048         flag = run<LocalMatrixType, LocalMatrixType>(comm, context, options);
00049 
00050     comm.barrier();
00051     elem::Finalize();
00052     return flag;
00053 }