Exemplo n.º 1
0
void run_empty(uint64_t num){
    uint64_t i;
    double ot = timer_overhead(num);
    Vector packages;
    hpx::naming::id_type lid = hpx::find_here();
    high_resolution_timer t;
    create_packages<Vector, Package>(packages, num);
    for(i = 0; i < num; ++i){
        packages[i]->apply(lid);
    }
    vector<hpx::lcos::future<T> > futures;
    get_futures<Vector, vector<hpx::lcos::future<T> >, Package>
        (packages, futures, num, ot); 
    packages.clear();
    double mean = get_results1<Vector, vector<hpx::lcos::future<T> >, Package>
        (packages, futures, num, ot);
    create_packages<Vector, Package>(packages, num);
    for(i = 0; i < num; ++i){
        packages[i]->apply(lid);
    }
    futures.clear();
    get_futures<Vector, vector<hpx::lcos::future<T> >, Package>
        (packages, futures, num, ot); 
    packages.clear();
    get_results2<Vector, vector<hpx::lcos::future<T> >, Package>
        (packages, futures, num, ot, mean);
}
void run_void(uint64_t num){
    double ot = timer_overhead(num);
    Vector packages;

    //first test
    create_packages<Vector, Package>(packages, num, ot);
}
void run_tests(bool empty, uint64_t num, T a1){
    uint64_t i = 0;
    double ot = timer_overhead(num);
    string message;
    vector<double> time;
    Vector packages;
    hpx::naming::id_type lid = hpx::find_here();

    create_packages<Vector, Package>(packages, num);

    //next test applies actions directly, skipping get_gid stage
    high_resolution_timer tt;
    for(i = 0; i < num; ++i)
        hpx::apply<Action>(lid, a1);
    double mean = tt.elapsed()/num;
    time.reserve(num);
    message = "Measuring time required to apply actions directly:";
    for(i = 0; i < num; i++){
        high_resolution_timer t1;
        hpx::apply<Action>(lid, a1);
        time.push_back(t1.elapsed());
    }
    printout(time, ot, mean, message);
 
}
void run_tests(bool empty, uint64_t num){
    uint64_t i = 0;
    double ot = timer_overhead(num);
    string message;
    vector<double> time;
    Vector packages;

    //first create packages
    create_packages<Vector, Package>(packages, num);

    //find the local id to give as the apply destination (we don't want to
    //perform a remote action in this test)
    hpx::naming::id_type lid = hpx::find_here();

    //obtain the mean time of applying the action
    high_resolution_timer tt;
    for(i = 0; i < num; ++i)
        hpx::apply<Action>(lid);
    double mean = tt.elapsed()/num;

    time.reserve(num);
    message = "Measuring time required to apply actions directly:";
    //obtain a statistical sampling of the apply time
    for(i = 0; i < num; i++){
        high_resolution_timer t1;
        hpx::apply<Action>(lid);
        time.push_back(t1.elapsed());
    }
    printout(time, ot, mean, message);
}
Exemplo n.º 5
0
void run_tests(uint64_t num){
    //uint64_t i = 0;
    double ot = timer_overhead(num);
    string message;
    vector<double> time;
    Vector packages;
    create_packages<Vector, Package>(packages, num);

//    test_get_base_gid<Vector>(packages, num, ot);
    test_get_gid<Vector>(packages, num, ot);
}
Exemplo n.º 6
0
void run_tests(bool empty, uint64_t num, T a1, T a2, T a3, T a4){
    double ot = timer_overhead(num);
    vector<double> time;
    Vector packages;
    create_packages<Vector, Package>(packages, num);
    hpx::naming::id_type lid = hpx::find_here();
    typedef typename hpx::actions::extract_action<Action>::type action_type;
    typedef 
        typename hpx::actions::extract_action<action_type>::result_type
        result_type;
    typedef hpx::actions::base_lco_continuation<result_type> rc_type;
    vector<rc_type*> continuations;

    //measures creation time of continuations
    apply_create_continuations<Vector, vector<rc_type*>, result_type>
        (packages, continuations, num, ot);
}
//measure how long it takes to spawn threads with a simple argumentless function 
void run_tests(uint64_t num){
    uint64_t i = 0;
    double ot = timer_overhead(num);
    double mean2;
    vector<double> time;
    vector<hpx::thread> threads;
    threads.reserve(2*num);

    //first create a large number of threads
    //then measure how long it takes to join them back together
    for(; i < num; ++i)
        threads.push_back(hpx::thread(&void_thread));
    for(i = 0; i < num; i++){
        threads.push_back(hpx::thread(&void_thread));
    }

    //this is here simply to ensure that all other threads have completed the
    //assigned empty function; the scheduler should have had each of the other
    //threads run before this one
    hpx::thread temp(&void_thread);
    temp.join();

    //obtain the average join time
    high_resolution_timer t;
    for(i = 0; i < num; i++){
        threads[i].join();
    }
    mean2 = t.elapsed()/num;

    //obtain a statistical sampling of the join time
    time.reserve(num);
    string message = "Measuring how long it takes to join threads:";
    for(i = num; i < num+num; ++i){
        high_resolution_timer t1;
        threads[i].join();
        time.push_back(t1.elapsed());
    }
    printout(time, ot, mean2, message);
}
void run_void(uint64_t num, T a1, T a2, T a3, T a4){
    double ot = timer_overhead(num);
    Vector packages;
    create_packages<Vector, Package>(packages, num, ot);
}
void run_empty(uint64_t num, T a1){
    double ot = timer_overhead(num);
    Vector packages;
    create_packages<Vector, Package>(packages, num, ot);
}
Exemplo n.º 10
0
void run_tests(bool empty, uint64_t num, T a1, T a2, T a3, T a4){
    uint64_t i = 0;
    double ot = timer_overhead(num);
    string message;
    vector<double> time;
    Vector packages;
    create_packages<Vector, Package>(packages, num);
    hpx::naming::id_type lid = hpx::find_here();
    //first measure base case
    high_resolution_timer t;
    for(; i < num; ++i) packages[i]->apply(lid, a1, a2, a3, a4);
    double mean = t.elapsed()/num;
    packages.clear();
    create_packages<Vector, Package>(packages, num);
    time.reserve(num);
    for(i = 0; i < num; ++i){
        high_resolution_timer t1;
        packages[i]->apply(lid, a1, a2, a3, a4);
        time.push_back(t1.elapsed());
    }
    message = "Measuring time required to apply packaged_actions by calling "
              "packaged_action.apply():";
    printout(time, ot, mean, message);
    time.clear();

    //now we begin measuring the individual components
/*    packages.clear();
    create_packages<Vector, Package>(packages, num);

    if(empty){
        typedef typename hpx::actions::extract_action<Action>::type action_type;
        typedef 
            typename hpx::actions::extract_action<action_type>::result_type
            result_type;
        typedef hpx::actions::base_lco_continuation<result_type> rc_type;
        vector<rc_type*> continuations;

        //measures creation time of continuations
        apply_create_continuations<Vector, vector<rc_type*>, result_type>
            (packages, continuations, num, ot);

        //finally apply the continuations directly
        high_resolution_timer tt;
        for(i = 0; i < num; i++) 
            hpx::apply<action_type>(lid, a1, a2, a3, a4);
        mean = tt.elapsed()/num;
        time.reserve(num);
        message = "Measuring time required to apply continuations directly:";

        for(i = 0; i < num; i++){
            high_resolution_timer t1;
            hpx::apply<action_type>(lid, a1, a2, a3, a4);
            time.push_back(t1.elapsed());
        }
        printout(time, ot, mean, message);
    }
    else{
        //next test applies actions directly, skipping get_gid stage
        high_resolution_timer tt;
        for(i = 0; i < num; ++i)
            hpx::apply<Action>(lid, a1, a2, a3, a4);
        mean = tt.elapsed()/num;
        time.reserve(num);
        message = "Measuring time required to apply actions directly:";
        for(i = 0; i < num; i++){
            high_resolution_timer t1;
            hpx::apply<Action>(lid, a1, a2, a3, a4);
            time.push_back(t1.elapsed());
        }
        printout(time, ot, mean, message);
    }*/
}