Dear all,

quick question on dataflow: I have a function with two different
parameters and I'd to add this to my dataflow graph. How should I
define the operation and/or the parameters in dataflow()?

The attached code gives me a compile error, but it works if I modify
it so ping() has only one type of parameter (either the vector or the
int) and supply only that parameter in dataflow(). Am I missing
something obvious?

Thanks!
-Andreas


-- 
==========================================================
Andreas Schäfer
HPC and Supercomputing
Institute for Multiscale Simulation
Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany
+49 9131 85-20866
PGP/GPG key via keyserver
http://www.libgeodecomp.org
==========================================================

(\___/)
(+'.'+)
(")_(")
This is Bunny. Copy and paste Bunny into your
signature to help him gain world domination!
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <iostream>

using boost::program_options::variables_map;
using boost::program_options::options_description;

class Foo
{
public:
    int ping(std::vector<double>, int a)
    {
        std::cout << "Foo::ping()\n";
        return 0;
    }
};

int hpx_main(variables_map & vm)
{
    std::cout << "hello world!\n";

    using hpx::dataflow;
    using hpx::util::unwrapped;

    Foo foo;

    std::vector<hpx::shared_future<double> > dependencies;
    dependencies.push_back(hpx::make_ready_future(4.5));

    auto Operation = unwrapped(boost::bind(&Foo::ping, foo, _1, _2));
    auto result = dataflow(
        hpx::launch::async,
        Operation,
        dependencies,
        hpx::make_ready_future(5));

    result.get();
    return hpx::finalize();
}

int main(int argc, char **argv)
{
    std::vector<std::string> config(1, "hpx.run_hpx_main!=1");
    options_description desc_commandline("usage: " HPX_APPLICATION_STRING " [options]");

    return hpx::init(desc_commandline, argc, argv, config);
}

Attachment: signature.asc
Description: Digital signature

_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to