当前位置: 首页>>代码示例>>C++>>正文


C++ hpx::find_here方法代码示例

本文整理汇总了C++中hpx::find_here方法的典型用法代码示例。如果您正苦于以下问题:C++ hpx::find_here方法的具体用法?C++ hpx::find_here怎么用?C++ hpx::find_here使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hpx的用法示例。


在下文中一共展示了hpx::find_here方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: system_2d

void system_2d( const state_type &q , state_type &dpdt )
{
    // works on shared data, but coupling data is provided as copy
    const size_t N = q.size();
    //state_type dpdt_(N);
    // first row
    dpdt[0] = dataflow< system_first_block_action >( find_here() , q[0] , 
                                                     dataflow< first_row_action >( find_here() , q[1] ) , 
                                                     dpdt[0] , 0 );
    // middle rows
    for( size_t i=1 ; i<N-1 ; i++ )
    {
        dpdt[i] = dataflow< system_center_block_action >( find_here() , q[i] , 
                                                          dataflow< last_row_action >( find_here() , q[i-1] ) , 
                                                          dataflow< first_row_action >( find_here() , q[i+1] ) , 
                                                          dpdt[i] , i );
    }
    dpdt[N-1] = dataflow< system_last_block_action >( find_here() , q[N-1] , 
                                                      dataflow< last_row_action >( find_here() , q[N-2] ) , 
                                                      dpdt[N-1] , N-1);

    // coupling synchronization step
    // dpdt[0] = dataflow< sys_sync1_action >( fing_here() , dpdt_[0] , dpdt_[1] );
    // for( size_t i=1 ; i<N-1 ; i++ )
    // {
    //     dpdt[i] = dataflow< sys_sync2_action >( find_here() , dpdt_[i] , dpdt_[i] , q[i+1] , dpdt[i] );
    // }
    // dpdt_[N-1] = dataflow< system_last_block_action >( find_here() , q[N-1] , q[N-2] , dpdt[N-1] );

}
开发者ID:mariomulansky,项目名称:hpx_playgrounds,代码行数:30,代码来源:2d_system.hpp

示例2: synchronized_swap

void synchronized_swap( state_type &x_in , state_type &x_out )
{
    const size_t N = x_in.size();
    for( size_t n=0 ; n<N ; ++n )
    {
        dataflow_base< shared_vec > x_tmp = dataflow< sync_identity2_action >( find_here() , 
                                                                               x_in[n] , 
                                                                               x_out[n] );
        x_in[n] = dataflow< sync_identity2_action >( find_here() , x_out[n] , x_tmp );
        x_out[n] = dataflow< sync_identity2_action >( find_here() , x_tmp , x_out[n] );
    }
}
开发者ID:mariomulansky,项目名称:hpx_playgrounds,代码行数:12,代码来源:perf2d.cpp

示例3: hpx_test_main

void hpx_test_main(
    variables_map& vm
    )
{
    boost::uint64_t const delay = vm["delay"].as<boost::uint64_t>();

    {
        /// AGAS reference-counting test 1 (from #126):
        ///
        ///     Create a component locally and let all references to it go out
        ///     of scope. The component should be deleted.

        Client monitor(find_here());

        cout << "id: " << monitor.get_gid() << " "
             << get_management_type_name
                    (monitor.get_gid().get_management_type()) << "\n"
             << flush;

        {
            // Detach the reference.
            id_type id = monitor.detach().get();

            // The component should still be alive.
            HPX_TEST_EQ(false, monitor.is_ready(milliseconds(delay)));
        }

        // Flush pending reference counting operations.
        garbage_collect();
        garbage_collect();

        // The component should be out of scope now.
        HPX_TEST_EQ(true, monitor.is_ready(milliseconds(delay)));
    }
}
开发者ID:AntonBikineev,项目名称:hpx,代码行数:35,代码来源:scoped_ref_to_local_object.cpp

示例4: measure_action_futures

void measure_action_futures(boost::uint64_t count, bool csv)
{
    const id_type here = find_here();

    std::vector<unique_future<double> > futures;
    futures.reserve(count);

    // start the clock
    high_resolution_timer walltime;

    for (boost::uint64_t i = 0; i < count; ++i)
        futures.push_back(async<null_action>(here));

    wait(futures, [&] (std::size_t, double r) { global_scratch += r; });

    // stop the clock
    const double duration = walltime.elapsed();

    if (csv)
        cout << ( boost::format("%1%,%2%\n")
                % count
                % duration)
              << flush;
    else
        cout << ( boost::format("invoked %1% futures (actions) in %2% seconds\n")
                % count
                % duration)
              << flush;
}
开发者ID:adk9,项目名称:hpx,代码行数:29,代码来源:future_overhead.cpp

示例5: pass_object_void

std::size_t pass_object_void()
{
    Object obj;
    async<Action>(find_here(), obj).get();

    return obj.get_count();
}
开发者ID:johnforce,项目名称:hpx,代码行数:7,代码来源:plain_action_move_semantics.cpp

示例6: hpx_main

int hpx_main(variables_map& vm)
{
    boost::uint64_t const futures = vm["futures"].as<boost::uint64_t>();
    boost::uint64_t const grain_size = vm["grain-size"].as<boost::uint64_t>();

    {
        id_type const prefix = find_here();

        thread_id_type thread_id = register_thread_nullary
            (boost::bind(&test_dummy_thread, futures));
        boost::uint64_t thread = boost::uint64_t(thread_id);

        // Flood the queues with suspension operations before the rescheduling
        // attempt.
        future<void> before =
            async<tree_boot_action>(prefix, futures, grain_size, prefix, thread);

        set_thread_state(thread_id, pending, wait_signaled);

        // Flood the queues with suspension operations after the rescheduling
        // attempt.
        future<void> after =
            async<tree_boot_action>(prefix, futures, grain_size, prefix, thread);

        before.get();
        after.get();

        set_thread_state(thread_id, pending, wait_terminate);
    }

    finalize();

    return 0;
}
开发者ID:NOMORECOFFEE,项目名称:hpx,代码行数:34,代码来源:thread_rescheduling.cpp

示例7: move_object_void

std::size_t move_object_void()
{
    Object obj;
    async<Action>(find_here(), boost::move(obj)).get();

    return obj.get_count();
}
开发者ID:johnforce,项目名称:hpx,代码行数:7,代码来源:plain_action_move_semantics.cpp

示例8: pass_object_void

std::size_t pass_object_void()
{
    Object obj;
    dataflow<Action>(find_here(), obj).get_future().get();

    return obj.get_count();
}
开发者ID:Stevejohntest,项目名称:hpx,代码行数:7,代码来源:plain_action_dataflow_move_semantics.cpp

示例9: hpx_test_main

void hpx_test_main(
    variables_map& vm
)
{
    boost::uint64_t const delay = vm["delay"].as<boost::uint64_t>();

    {
        /// AGAS reference-counting test 3 (from #126):
        ///
        ///     Create two components locally, and have the second component
        ///     store a reference to the first component. Let the original
        ///     references to both components go out of scope. Both components
        ///     should be deleted.

        Client monitor0(find_here());
        Client monitor1(find_here());

        cout << "id0: " << monitor0.get_id() << " "
             << get_management_type_name
             (monitor0.get_id().get_management_type()) << "\n"
             << "id1: " << monitor1.get_id() << " "
             << get_management_type_name
             (monitor1.get_id().get_management_type()) << "\n"
             << flush;

        {
            // Have the second object store a reference to the first object.
            monitor1.take_reference(monitor0.get_id());

            // Detach the references.
            id_type id1 = monitor0.detach().get();
            id_type id2 = monitor1.detach().get();

            // Both components should still be alive.
            HPX_TEST_EQ(false, monitor0.is_ready(milliseconds(delay)));
            HPX_TEST_EQ(false, monitor1.is_ready(milliseconds(delay)));
        }

        // Flush pending reference counting operations.
        garbage_collect();
        garbage_collect();

        // Both components should be out of scope now.
        HPX_TEST_EQ(true, monitor0.is_ready(milliseconds(delay)));
        HPX_TEST_EQ(true, monitor1.is_ready(milliseconds(delay)));
    }
}
开发者ID:pra85,项目名称:hpx,代码行数:47,代码来源:local_embedded_ref_to_local_object.cpp

示例10: main

int main()
{
    test_client t = test_client::create(find_here());
    HPX_TEST_NEQ(hpx::naming::invalid_id, t.get_gid());

    t.check_gid();

    return hpx::util::report_errors();
}
开发者ID:AntonBikineev,项目名称:hpx,代码行数:9,代码来源:get_gid.cpp

示例11: hpx_test_main

void hpx_test_main(
    variables_map& vm
    )
{
    boost::uint64_t const delay = vm["delay"].as<boost::uint64_t>();

    {
        /// AGAS reference-counting test 4 (from #126):
        ///
        ///     Create two components, one locally and one one remotely.
        ///     Have the local component store a reference to the remote
        ///     component. Let the original references to both components go
        ///     out of scope. Both components should be deleted.

        typedef typename Client::server_type server_type;

        component_type ctype = get_component_type<server_type>();
        std::vector<id_type> remote_localities = hpx::find_remote_localities(ctype);

        if (remote_localities.empty())
            throw std::logic_error("this test cannot be run on one locality");

        Client monitor_remote(remote_localities[0]);
        Client monitor_local(find_here());

        cout << "id_remote: " << monitor_remote.get_gid() << " "
             << get_management_type_name
                    (monitor_remote.get_gid().get_management_type()) << "\n"
             << "id_local:  " << monitor_local.get_gid() << " "
             << get_management_type_name
                    (monitor_local.get_gid().get_management_type()) << "\n"
             << flush;

        {
            // Have the local object store a reference to the remote object.
            monitor_local.take_reference(monitor_remote.get_gid());

            // Detach the references.
            id_type id1 = monitor_remote.detach().get();
            id_type id2 = monitor_local.detach().get();

            // Both components should still be alive.
            HPX_TEST_EQ(false, monitor_remote.is_ready(milliseconds(delay)));
            HPX_TEST_EQ(false, monitor_local.is_ready(milliseconds(delay)));
        }

        // Flush pending reference counting operations.
        garbage_collect(remote_localities[0]);
        garbage_collect();
        garbage_collect(remote_localities[0]);
        garbage_collect();

        // Both components should be out of scope now.
        HPX_TEST_EQ(true, monitor_remote.is_ready(milliseconds(delay)));
        HPX_TEST_EQ(true, monitor_local.is_ready(milliseconds(delay)));
    }
}
开发者ID:AntonBikineev,项目名称:hpx,代码行数:57,代码来源:local_embedded_ref_to_remote_object.cpp

示例12: main

int main()
{
    // action too big to compile...
    dataflow_base<double> df = dataflow<large_action>(
        find_here() , 1 , 1 , 1 , 1 , 1 , 1 , 1);
    HPX_TEST_EQ(df.get_future().get(), 1);

    return hpx::util::report_errors();
}
开发者ID:41i,项目名称:hpx,代码行数:9,代码来源:set_hpx_limit_771.cpp

示例13: hpx_test_main

void hpx_test_main(
    variables_map& vm
    )
{
    boost::uint64_t const delay = vm["delay"].as<boost::uint64_t>();

    {
        /// AGAS reference-counting test 7 (from #126):
        ///
        ///     Create a component locally, and register a symbolic name for it.
        ///     Then, let all references to the component go out of scope. The
        ///     component should still be alive. Finally, unregister the
        ///     symbolic name. The component should be deleted after the
        ///     symbolic name is unregistered.

        char const name[] = "/tests(refcnt_checker#7)";

        Client monitor(find_here());

        cout << "id: " << monitor.get_id() << " "
             << get_management_type_name
                    (monitor.get_id().get_management_type()) << "\n"
             << flush;

        // Associate a symbolic name with the object.
        HPX_TEST_EQ(true, register_name_sync(name, monitor.get_id()));

        hpx::naming::gid_type gid;

        {
            // Detach the reference.
            id_type id = monitor.detach().get();

            // The component should still be alive.
            HPX_TEST_EQ(false, monitor.is_ready(milliseconds(delay)));

            gid = id.get_gid();

            // let id go out of scope
        }

        // The component should still be alive, as the symbolic binding holds
        // a reference to it.
        HPX_TEST_EQ(false, monitor.is_ready(milliseconds(delay)));

        // Remove the symbolic name. This should return the final credits
        // to AGAS.
        HPX_TEST_EQ(gid, unregister_name_sync(name).get_gid());

        // Flush pending reference counting operations.
        garbage_collect();
        garbage_collect();

        // The component should be destroyed.
        HPX_TEST_EQ(true, monitor.is_ready(milliseconds(delay)));
    }
}
开发者ID:Bcorde5,项目名称:hpx,代码行数:57,代码来源:refcnted_symbol_to_local_object.cpp

示例14: osc_sys

void osc_sys( const state_type &q , state_type &dpdt )
{
    const size_t N = q.size();
    //std::cout << "system call with N=" << N << std::endl;
    dpdt[0] = dataflow< osc_operation_action >( find_here() ,
                                                q[0] , q[N-1] , q[1] ,
                                                dpdt[0] );

    for( size_t i=1 ; i<N-1 ; ++i )
        dpdt[i] = dataflow< osc_operation_action >( find_here() , 
                                                    q[i] , q[i-1] , q[i+1] ,
                                                    dpdt[i] );

    dpdt[N-1] = dataflow< osc_operation_action >( find_here() ,
                                                  q[N-1] , q[N-2] , q[0] ,
                                                  dpdt[N-1] );
    //std::cout << "-------" << std::endl;
}
开发者ID:mariomulansky,项目名称:hpx_playgrounds,代码行数:18,代码来源:coupled_oscillators.cpp

示例15: hpx_main

int hpx_main(variables_map& vm)
{
  here = find_here();
  pi = boost::math::constants::pi<double>();

  //    dt = vm["dt-value"].as<double>();
  //    dx = vm["dx-value"].as<double>();
  //    c = vm["c-value"].as<double>();
  nx = vm["nx-value"].as<boost::uint64_t>();
  nt = vm["nt-value"].as<boost::uint64_t>();

  c = 1.0;

  dt = 1.0/(nt-1);
  dx = 1.0/(nx-1);
  alpha_squared = (c*dt/dx)*(c*dt/dx);

  // check that alpha_squared satisfies the stability condition
  if (0.25 < alpha_squared)
    {
      cout << (("alpha^2 = (c*dt/dx)^2 should be less than 0.25 for stability!\n"))
          << flush;
    }

  u = std::vector<std::vector<data> >(nt, std::vector<data>(nx));

  cout << (boost::format("dt = %1%\n") % dt) << flush;
  cout << (boost::format("dx = %1%\n") % dx) << flush;
  cout << (boost::format("alpha^2 = %1%\n") % alpha_squared) << flush;

  {
    // Keep track of the time required to execute.
    high_resolution_timer t;

    std::vector<future<double> > futures;
    for (boost::uint64_t i=0;i<nx;i++)
      futures.push_back(async<wave_action>(here,nt-1,i));

    // open file for output
    std::ofstream outfile;
    outfile.open ("output.dat");

    wait(futures, [&](std::size_t i, double n)
         { double x_here = i*dx;
           outfile << (boost::format("%1% %2%\n") % x_here % n) << flush; });

    outfile.close();

    char const* fmt = "elapsed time: %1% [s]\n";
    std::cout << (boost::format(fmt) % t.elapsed());

  }

  finalize();
  return 0;
}
开发者ID:HadrienG2,项目名称:hpx,代码行数:56,代码来源:1d_wave_equation.cpp


注:本文中的hpx::find_here方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。