Last active
February 7, 2018 20:30
-
-
Save shahrzad/2b177e39f8e863fc7b355238b490460c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2018 Shahrzad Shirzad | |
// | |
// Distributed under the Boost Software License, Version 1.0. (See accompanying | |
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
#include <phylanx/phylanx.hpp> | |
#include <hpx/hpx_init.hpp> | |
#include <iostream> | |
#include <boost/program_options.hpp> | |
/////////////////////////////////////////////////////////////////////////////// | |
char const* const tecode = R"(block( | |
define(fib_test,iterations, | |
block( | |
define(x, 1.0), | |
define(z, 0.0), | |
define(y, 1.0), | |
define(temp,0.0), | |
define(step, 0), | |
while( | |
step < iterations, | |
block( | |
store(z, x+y), | |
store(temp,y), | |
store(y,z), | |
store(x,temp), | |
store(step, step + 1) | |
) | |
),z | |
) | |
), | |
fib_test | |
))"; | |
int hpx_main(boost::program_options::variables_map& vm) | |
{ | |
// compile the given code | |
phylanx::execution_tree::compiler::function_list snippets; | |
auto fib_test = phylanx::execution_tree::compile(tecode, snippets); | |
auto result=fib_test(static_cast<std::int64_t>(10)); | |
return hpx::finalize(); | |
} | |
int main(int argc, char* argv[]) | |
{ | |
// command line handling | |
boost::program_options::options_description desc("usage: test [options]"); | |
return hpx::init(desc, argc, argv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment