Luca,

I am forwarding you email to the hpx-users list. We handle user requests and questions there.

Can you post the debug into that comes with the Seg. Fault? We need to know things such as the version of HPX and the platform you are running on.

Adrian


On 8/29/2017 9:09 AM, luca de silvestris wrote:
dear stellar group,
i'm a student and i try to use your library Hpx, but i have a problem.
i try to run one of your examples (Fibonacci), and the program run with no problem
but there isn't the output.
this is the code:

/////////////////////////////////////////////////////////////////////////////// //[fib_action // forward declaration of the Fibonacci function std::uint64_t fibonacci(std::uint64_t n);

// This is to generate the required boilerplate we need for the remote // invocation to work. HPX_PLAIN_ACTION(fibonacci, fibonacci_action); //] /////////////////////////////////////////////////////////////////////////////// //[fib_func std::uint64_t fibonacci(std::uint64_t n)
{
     if (n <2)
         return n;

     // We restrict ourselves to execute the Fibonacci function locally. 
hpx::naming::id_type const locality_id =hpx::find_here();

// Invoking the Fibonacci algorithm twice is inefficient. // However, we intentionally demonstrate it this way to create some // heavy workload. fibonacci_action fib;
     hpx::future<std::uint64_t> n1 =
             hpx::async(fib, locality_id, n -1);
     hpx::future<std::uint64_t> n2 =
             hpx::async(fib, locality_id, n -2);

     return n1.get() + n2.get();// wait for the Futures to return their values }
//] /////////////////////////////////////////////////////////////////////////////// //[fib_hpx_main int hpx_main(boost::program_options::variables_map& vm)
{
     // extract command line argument, i.e. fib(N) std::uint64_t n = 
vm["n-value"].as<std::uint64_t>();

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

         // Wait for fib() to return the value fibonacci_action fib;
         std::uint64_t r = fib(hpx::find_here(), n);

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

     return hpx::finalize();// Handles HPX shutdown }
//] /////////////////////////////////////////////////////////////////////////////// //[fib_main int main(int argc,char* argv[])
{
     // Configure application-specific options boost::program_options::options_description 
desc_commandline("Usage: " HPX_APPLICATION_STRING " [options]");

     desc_commandline.add_options()
             ( "n-value",
               
boost::program_options::value<std::uint64_t>()->default_value(10),
               "n value for the Fibonacci function") ;

     // Initialize and run HPX return hpx::init(desc_commandline, argc, argv);
}
AND THIS IS THE GDB: Type "apropos word" to search for commands related to "word". [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff4366700 (LWP 6134)] [New Thread 0x7ffff3b65700 (LWP 6135)] Thread 1 "fibonacci_paral" received signal SIGABRT, Aborted. 0x00007ffff5c6e428 in raise () from /lib/x86_64-linux-gnu/libc.so.6

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virus-free. www.avg.com <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


_______________________________________________
Fellows mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/fellows

--
Adrian Serio
Scientific Program Coordinator
2118 Digital Media Center
225.578.8506

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

Reply via email to