Ejemplo n.º 1
0
void test_zero_copy_serialization(double d, T1& arg1, std::string const& s,
    int i, T2& arg2)
{
    hpx::naming::id_type const here = hpx::find_here();
    hpx::naming::address addr(hpx::get_locality(),
        hpx::components::component_invalid,
        reinterpret_cast<std::uint64_t>(&test_function2));

    // compose archive flags
    unsigned out_archive_flags = 0U;
#ifdef BOOST_BIG_ENDIAN
    out_archive_flags |= hpx::serialization::endian_big;
#else
    out_archive_flags |= hpx::serialization::endian_little;
#endif

    // create a parcel with/without continuation
    hpx::naming::gid_type dest = here.get_gid();
    hpx::parcelset::parcel outp(
        hpx::parcelset::detail::create_parcel::call(std::true_type(), std::true_type(),
            std::move(dest), std::move(addr),
            hpx::actions::typed_continuation<int>(here),
            test_action3(), hpx::threads::thread_priority_normal, d, arg1, s, i, arg2
        )
    );

    outp.set_source_id(here);

    test_parcel_serialization(std::move(outp), out_archive_flags, true);
}
void test_zero_copy_serialization(T1& arg1, T2& arg2)
{
    hpx::naming::id_type const here = hpx::find_here();
    hpx::naming::address addr(hpx::get_locality(),
        hpx::components::component_invalid,
        reinterpret_cast<boost::uint64_t>(&test_function2));

    // compose archive flags
    unsigned out_archive_flags = 0U;
#ifdef BOOST_BIG_ENDIAN
    out_archive_flags |= hpx::serialization::endian_big;
#else
    out_archive_flags |= hpx::serialization::endian_little;
#endif

    // create a parcel with/without continuation
    hpx::parcelset::parcel outp(here, addr,
        new hpx::actions::transfer_action<test_action2>(
            hpx::threads::thread_priority_normal, arg1, arg2),
        new hpx::actions::typed_continuation<int>(here));

    outp.set_parcel_id(hpx::parcelset::parcel::generate_unique_id());
    outp.set_source(here);

    test_parcel_serialization(outp, out_archive_flags, true);
}
Ejemplo n.º 3
0
void test_normal_serialization(T& arg)
{
    hpx::naming::id_type const here = hpx::find_here();
    hpx::naming::address addr(hpx::get_locality(),
        hpx::components::component_invalid,
        reinterpret_cast<std::uint64_t>(&test_function1));

    // compose archive flags
    unsigned out_archive_flags = hpx::serialization::disable_data_chunking;
#ifdef BOOST_BIG_ENDIAN
    out_archive_flags |= hpx::serialization::endian_big;
#else
    out_archive_flags |= hpx::serialization::endian_little;
#endif

    // create a parcel with/without continuation
    hpx::naming::gid_type dest = here.get_gid();
    hpx::parcelset::parcel outp(
        hpx::parcelset::detail::create_parcel::call(std::true_type(), std::true_type(),
            std::move(dest), std::move(addr),
            hpx::actions::typed_continuation<int>(here),
            Action(), hpx::threads::thread_priority_normal, arg
        )
    );

    outp.set_source_id(here);

    test_parcel_serialization(std::move(outp), out_archive_flags, false);
}
Ejemplo n.º 4
0
void test_zero_copy_serialization(double d, T1& arg1, std::string const& s,
    int i, T2& arg2)
{
    hpx::naming::id_type const here = hpx::find_here();
    hpx::naming::address addr(hpx::get_locality(),
        hpx::components::component_invalid,
        reinterpret_cast<boost::uint64_t>(&test_function2));

    // compose archive flags
    int in_archive_flags = boost::archive::no_header;
    int out_archive_flags = boost::archive::no_header;
#ifdef BOOST_BIG_ENDIAN
    out_archive_flags |= hpx::util::endian_big;
#else
    out_archive_flags |= hpx::util::endian_little;
#endif

    // create a parcel with/without continuation
    hpx::parcelset::parcel outp(here, addr,
        new hpx::actions::transfer_action<test_action3>(
            hpx::threads::thread_priority_normal,
                hpx::util::forward_as_tuple(d, arg1, s, i, arg2)),
        new hpx::actions::typed_continuation<int>(here));

    outp.set_parcel_id(hpx::parcelset::parcel::generate_unique_id());
    outp.set_source(here);

    test_parcel_serialization(outp, in_archive_flags, out_archive_flags, true);
}