示例#1
0
int  main(int argc, char* argv[])
{
    ConfigXML cfg = set_parameters("SingleSampleCCE.xml");

    string log_file = LOG_PATH + cfg.getStringParameter("Data", "log_file");
    _START_EASYLOGGINGPP(argc, argv);
    easyloggingpp::Configurations confFromFile(log_file.c_str());
    easyloggingpp::Loggers::reconfigureAllLoggers(confFromFile);

    
    int worker_num(0), my_rank(0);
    int mpi_status = MPI_Init(&argc, &argv);
    assert (mpi_status == MPI_SUCCESS);

    MPI_Comm_size(MPI_COMM_WORLD, &worker_num);
    MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

    LOG(INFO) << "my_rank = " << my_rank << "  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Program begins vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"; 

    // create defect center
    NVCenter nv = create_defect_center(cfg);

    // CCE
    SingleSampleCCE sol(my_rank, worker_num, &nv, cfg);
    sol.run();

    LOG(INFO) << "my_rank = " << my_rank << "  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Program ends ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"; 

    mpi_status = MPI_Finalize();
    assert (mpi_status == MPI_SUCCESS);
}
示例#2
0
int main(int argc, char** argv) {
    _START_EASYLOGGINGPP(argc, argv);

    // TODO: Use getopt with following params
    //         -p : process_type
    //         -s : source_file (for split only)
    //         -d : destination_dir / destination_file (depending on process_type)
    //         -t : total_parts (for split only)
    //       For [parts...] in join we just force user to have last arguments to be all parts

    if (argc > 2) {
        int status = -1;
        if (strcmp(argv[1], "split") == 0) {
            //use splitter core
            split(argc - 2, argv + 2);
        } else if ((strcmp(argv[1], "merge") == 0) || (strcmp(argv[1], "join") == 0)) {
            //use merger core
            merge(argc - 2, argv + 2);
        } else {
            LOG(ERROR) << "Invalid process type!";
        }
        return status;
    } else {
        QApplication app(argc, argv);
        MainWindow w;
        w.show();
        return app.exec();
    }
}
示例#3
0
int  main(int argc, char* argv[])
{
    po::variables_map para = ParseCommandLineOptions(argc, argv);

    ////////////////////////////////////////////////////////////////////////////////
    //{{{  MPI Preparation
    int worker_num(0), my_rank(0);
    int mpi_status = MPI_Init(&argc, &argv);
    assert (mpi_status == MPI_SUCCESS);

    MPI_Comm_size(MPI_COMM_WORLD, &worker_num);
    MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
    //}}}
    ////////////////////////////////////////////////////////////////////////////////
    
    ////////////////////////////////////////////////////////////////////////////////
    //{{{ LOGGING 
    string log_file = LOG_PATH +  para["logfile"].as<string>();
    _START_EASYLOGGINGPP(argc, argv);
    easyloggingpp::Configurations confFromFile(log_file.c_str());
    easyloggingpp::Loggers::reconfigureAllLoggers(confFromFile);
    //}}}
    ////////////////////////////////////////////////////////////////////////////////

    LOG(INFO) << "my_rank = " << my_rank << "  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Program begins vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"; 

    EnsembleCCE sol(my_rank, worker_num, para);

    // Step 1: make a defect center
    NVCenter nv = create_defect_center(para);  
    sol.set_defect_center(&nv);

    // Step 2: make bath spins 
    cSpinSourceUniformRandom spinUR = create_spin_source(para);
    sol.set_bath_spin(&spinUR);
    
    
    // Step 3: make clusters
    cSpinCollection bath_spins = sol.getSpinCollecion();
    cDepthFirstPathTracing   dfpt = create_spin_cluster_algrithm(para, bath_spins);
    sol.set_bath_cluster(&dfpt);

    // Step 4: run_each_cluster 
    sol.run_each_clusters();

    // Step 5: post_treatment
    sol.post_treatment();

    LOG(INFO) << "my_rank = " << my_rank << "  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Program ends ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"; 

    ////////////////////////////////////////////////////////////////////////////////
    //{{{ MPI Finializing
    mpi_status = MPI_Finalize();
    assert (mpi_status == MPI_SUCCESS);
    //}}}
    ////////////////////////////////////////////////////////////////////////////////
}
示例#4
0
int main(int argc,const char* argv[])
{
    _START_EASYLOGGINGPP(argc,argv);
    el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime : %msg");

    LOG(INFO) << "Parsing command line arguments";
    cmdargs_t args = parse_args(argc,argv);

    LOG(INFO) << "Parsing collection directory " << args.collection_dir;
    collection col(args.collection_dir);

    auto patterns = pattern_parser::parse_file<false>(args.pattern_file);
    LOG(INFO) << "Parsed " << patterns.size() << " patterns from file " << args.pattern_file;

    /* verify index */
    // {
    //     index_sort<> index(col);
    //     verify_index(index,patterns,"SORT");
    // }
    // {
    //     index_wt<> index(col);
    //     verify_index(index,patterns,"WT");
    // }
    // {
    //     index_sada<> index(col);
    //     verify_index(index,patterns,"SADA");
    // }
    {
        using invidx_type = index_invidx<optpfor_list<128,true>,optpfor_list<128,false>>;
        index_abspos<eliasfano_list<true>,invidx_type> index(col);
        verify_index(index,patterns,"ABS-EF");
    }
    {
        using invidx_type = index_invidx<optpfor_list<128,true>,optpfor_list<128,false>>;
        index_abspos<eliasfano_sskip_list<32,true>,invidx_type> index(col);
        verify_index(index,patterns,"ABS-ESSF-64");
    }
    {
        using invidx_type = index_invidx<optpfor_list<128,true>,optpfor_list<128,false>>;
        index_abspos<eliasfano_skip_list<64,true>,invidx_type> index(col);
        verify_index(index,patterns,"ABS-ESF-64");
    }
    // {
    //     using invidx_type = index_invidx<optpfor_list<128,true>,optpfor_list<128,false>>;
    //     index_abspos<uniform_eliasfano_list<128>,invidx_type> index(col);
    //     verify_index(index,patterns,"ABS-UEF-128");
    // }
    // {
    //     using invidx_type = index_invidx<optpfor_list<128,true>,optpfor_list<128,false>>;
    //     index_nextword<eliasfano_list<true>,invidx_type> index(col);
    //     verify_index(index,patterns,"NEXT-EF");
    // }

    return 0;
}
示例#5
0
int main(int argc,const char* argv[])
{
    _START_EASYLOGGINGPP(argc,argv);
    el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime : %msg");

    /* parse command line */
    LOG(INFO) << "Parsing command line arguments";
    cmdargs_t args = parse_args(argc,argv);

    /* parse the collection */
    LOG(INFO) << "Parsing collection directory " << args.collection_dir;
    collection col(args.collection_dir);

    /* load pattern file */
    auto patterns = pattern_parser::parse_file<false>(args.pattern_file);
    LOG(INFO) << "Parsed " << patterns.size() << " patterns from file " << args.pattern_file;

    /* filter patterns */
    if (args.patterns_per_bucket != 0) {
        std::sort(patterns.begin(), patterns.end(), [](const pattern_t& a, const pattern_t& b) {
            return a.bucket < b.bucket;
        });
        size_t freq = 0;
        size_t cnt = 0;
        size_t bucket = patterns[0].bucket;
        auto itr = patterns.begin();
        while (itr != patterns.end()) {
            if (itr->bucket != bucket) {
                LOG(INFO) << "bucket = " << bucket << " cnt = " << cnt;
                bucket = itr->bucket;
                freq = 0;
                cnt = 0;
            }
            if (freq >= args.patterns_per_bucket) {
                itr = patterns.erase(itr);
            } else {
                itr++;
                cnt++;
            }
            freq++;
        }
        LOG(INFO) << "bucket = " << bucket << " cnt = " << cnt;
        LOG(INFO) << "Filtered " << patterns.size() << " patterns";
    }

    /* load indexes and test */
    using invidx_typeA = index_invidx<uniform_eliasfano_list<128>,optpfor_list<128,false>>;
    invidx_typeA indexA(col);

    using invidx_typeB = index_invidx<eliasfano_skip_list<64,true>,optpfor_list<128,false>>;
    invidx_typeB indexB(col);
    compare_index(indexA,indexB,patterns);

    return 0;
}
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
    _START_EASYLOGGINGPP(argc, argv);
 
    LOG(INFO) << "My log message - hopefully you have reconfigured log file by using"
        << " --default-log-file=blah.log and defined _ELPP_NO_DEFAULT_LOG_FILE";

    return 0;
}
示例#7
0
int main(int argc, char** argv)
{
     _START_EASYLOGGINGPP(argc, argv);

      el::Helpers::installLogDispatchCallback<MyHandler>("MyHandler");

     // Your thread ID specification
     el::CustomFormatSpecifier myThreadIdSpecifier("%mythreadId", getThreadId_CustomVersion);
     el::Helpers::installCustomFormatSpecifier(myThreadIdSpecifier);

     el::Loggers::addFlag(el::LoggingFlag::MultiLoggerSupport);

     // Note your %mythreadId or built-in, both are logged
     el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime %level (%thread | %mythreadId) [%logger] [%func] [%loc] %msg");
     el::Loggers::reconfigureAllLoggers(el::Level::Verbose, el::ConfigurationType::Format, "%datetime %level-%vlevel (%thread | %mythreadId) [%logger] [%func] [%loc] %msg");
     el::Loggers::getLogger("network");

     pthread_t thread1, thread2, thread3, thread4;

     // Create independent threads each of which will execute function 
     pthread_create( &thread1, NULL, write, (void*)"1");
     pthread_create( &thread2, NULL, write, (void*)"2");
     pthread_create( &thread3, NULL, write, (void*)"3");
     
     el::Logger* logger = el::Loggers::getLogger("default");
     args.thrId = "4";
     args.logger = logger;
     pthread_create( &thread4, NULL, write2, (void*)&args);

     pthread_join(thread1, NULL);
     pthread_join(thread2, NULL); 
     pthread_join(thread3, NULL); 
     pthread_join(thread4, NULL); 

#if 0 // Change this to 1 for some serious multiple threads
    int i = 5; // Last one we created was 4 so we dont want to confuse
    const int max = i + 500;
    for (; i <= max; ++i) {
        pthread_t thread;
        std::string s = std::to_string(static_cast<long long>(i));
        if (i % 2 == 0)
            pthread_create( &thread, NULL, write, (void*)s.c_str());
        else {
            args.thrId = s.c_str();
            args.logger = logger;
            pthread_create( &thread, NULL, write2, (void*)&args);
        }
        pthread_join(thread, NULL); 
    }
#endif

    exit(0);
}
示例#8
0
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
  _START_EASYLOGGINGPP(argc, argv);
  LOG(INFO) << "This is demo for verbose logs";
  VLOG(1) << "This will be printed when program is started using argument --v=1";
  VLOG(2) << "This will be printed when program is started using argument --v=2";
  VLOG(1) << "This will be printed when program is started using argument --v=1";
  VLOG_IF(true, 1) << "Always verbose for level 1";

  VLOG_EVERY_N(1, 3) << "Verbose every N";

  VLOG(4) << "Command line arguments provided " << *el::Helpers::commandLineArgs();
  return 0;
}
示例#9
0
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
  _START_EASYLOGGINGPP(argc, argv);

  for (int i = 1;i < 1000; ++i) {
     LOG_EVERY_N(20, INFO) << "LOG_EVERY_N i = " << i;
     LOG_EVERY_N(100, INFO) << "LOG_EVERY_N Current position is " << ELPP_COUNTER_POS;
  }
  for (int i = 1;i <= 10; ++i) {
     LOG_AFTER_N(6, INFO) << "LOG_AFTER_N i = " << i;
  }
  for (int i = 1;i < 100; ++i) {
     LOG_N_TIMES(50, INFO) << "LOG_N_TIMES i = " << i;
  }
  return 0;
}
示例#10
0
_INITIALIZE_EASYLOGGINGPP

BOOL APIENTRY DllMain(HMODULE hModule,
					  DWORD  ul_reason_for_call,
					  LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:	
		_START_EASYLOGGINGPP(0, (const char**)nullptr);
		el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime{%H:%m:%s.%g} [%thread] %level  %msg");
		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
示例#11
0
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
    _START_EASYLOGGINGPP(argc, argv);
    el::Helpers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
    
    LOG(INFO);
    LOG(DEBUG);
    LOG(WARNING);
    LOG(ERROR);
    LOG(TRACE);
    VLOG(1);
    LOG(FATAL);

    DLOG(INFO);
    DLOG(DEBUG);
    DLOG(WARNING);
    DLOG(ERROR);
    DLOG(TRACE);
    DVLOG(1);
    DLOG(FATAL);

    LOG_IF(true, INFO);
    LOG_IF(true, DEBUG);
    LOG_IF(true, WARNING);
    LOG_IF(true, ERROR);
    LOG_IF(true, TRACE);
    VLOG_IF(true, 1);
    LOG_IF(true, FATAL);

    LOG_EVERY_N(1, INFO);
    LOG_EVERY_N(1, DEBUG);
    LOG_EVERY_N(1, WARNING);
    LOG_EVERY_N(1, ERROR);
    LOG_EVERY_N(1, TRACE);
    VLOG_EVERY_N(1, 1);
    LOG_EVERY_N(1, FATAL);

    CHECK(1 == 1);
    CCHECK(1 == 1, "default");
    return 0;
}
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {

  _START_EASYLOGGINGPP(argc, argv); //register arguments for verbose logs

  int n = 5;

  int n2 = 2;
  
  for (int i = 1; i <= 100; i++) {
     LINFO_EVERY_N(n) << "This will be printed every " << n << " iteration multiple, this is iteration " << i;

     LINFO_EVERY_N(n2) << "iter = " << i;

     LVERBOSE_EVERY_N(n2, 2) << "This is verbose level 2 log for iteration " << i;
  }
 
   return 0;
}
示例#13
0
文件: main.cpp 项目: treewojima/game
int main(int argc, char *argv[])
{
    _START_EASYLOGGINGPP(argc, argv);

    try
    {
        Game::run(parseArgs(argc, argv));
    }
    catch (TCLAP::ArgException &e)
    {
        LOG(ERROR) << "ARG EXCEPTION: " << e.error();
        return 1;
    }
    catch (std::exception &e)
    {
        LOG(ERROR) << "EXCEPTION: " << e.what();
        return 1;
    }

    LOG(INFO) << "shut down cleanly";
    return 0;
}
示例#14
0
MyLib::MyLib(int argc, char** argv) {
    _START_EASYLOGGINGPP(argc, argv);
    LOG(INFO) << "---MyLib Constructor(int, char**) ---";
}
示例#15
0
int main(int argc,const char* argv[])
{
    _START_EASYLOGGINGPP(argc,argv);
    el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime : %msg");

    /* parse command line */
    LOG(INFO) << "Parsing command line arguments";
    cmdargs_t args = parse_args(argc,argv);

    /* parse the collection */
    LOG(INFO) << "Parsing collection directory " << args.collection_dir;
    collection col(args.collection_dir);

    /* load pattern file */
    auto patterns = pattern_parser::parse_file<false>(args.pattern_file);
    LOG(INFO) << "Parsed " << patterns.size() << " patterns from file " << args.pattern_file;

    /* filter patterns */
    std::sort(patterns.begin(), patterns.end(), [](const pattern_t& a, const pattern_t& b) {
        return a.bucket < b.bucket;
    });
    size_t freq = 0;
    size_t cnt = 0;
    size_t bucket = patterns[0].bucket;
    auto itr = patterns.begin();
    while (itr != patterns.end()) {
        if (itr->bucket != bucket) {
            LOG(INFO) << "bucket = " << bucket << " cnt = " << cnt;
            bucket = itr->bucket;
            freq = 0;
            cnt = 0;
        }
        if (freq >= args.patterns_per_bucket || bucket > 6) {
            itr = patterns.erase(itr);
        } else {
            itr++;
            cnt++;
        }
        freq++;
    }
    LOG(INFO) << "bucket = " << bucket << " cnt = " << cnt;
    LOG(INFO) << "Filtered " << patterns.size() << " patterns";

    /* open output file */
    std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
    auto sec_since_epoc = std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch());
    auto time_str = std::to_string(sec_since_epoc.count());
    ofstream resfs(col.path+"/results/bench_doc-"+time_str+".csv");

    resfs << "type;id;len;ndoc;nocc;list_sum;min_list_len;bucket;time_ns" << std::endl;

    /* load indexes and test */
    {
        using invidx_type = index_invidx<uniform_eliasfano_list<128>,optpfor_list<128,false>>;
        index_abspos<uniform_eliasfano_list<128>,invidx_type> index(col);
        bench_doc_intersection(index,patterns,"ABSPOS-UEF-128",resfs);
    }
    {
        using invidx_type = index_invidx<uniform_eliasfano_list<128>,optpfor_list<128,false>>;
        index_abspos<eliasfano_sskip_list<64,true>,invidx_type> index(col);
        bench_doc_intersection(index,patterns,"ABSPOS-ESSF",resfs);
    }
    {
        using invidx_type = index_invidx<uniform_eliasfano_list<128>,optpfor_list<128,false>>;
        index_abspos<eliasfano_skip_list<64,true>,invidx_type> index(col);
        bench_doc_intersection(index,patterns,"ABSPOS-ESF",resfs);
    }
    {
        using invidx_type = index_invidx<uniform_eliasfano_list<128>,optpfor_list<128,false>>;
        index_nextword<uniform_eliasfano_list<128>,invidx_type> index(col);
        bench_doc_intersection(index,patterns,"NEXTWORD-UEF-128",resfs);
    }
    {
        using invidx_type = index_invidx<uniform_eliasfano_list<128>,optpfor_list<128,false>>;
        index_abspos<eliasfano_list<true,false>,invidx_type> index(col);
        bench_doc_intersection(index,patterns,"ABSPOS-EF",resfs);
    }
    {
        index_sort<> index(col);
        bench_doc_intersection(index,patterns,"SORT",resfs);
    }
    {
        index_wt<> index(col);
        bench_doc_intersection(index,patterns,"WT",resfs);
    }
    {
        index_sada<> index(col);
        bench_doc_intersection(index,patterns,"SADA",resfs);
    }

    return 0;
}