This project is a minimal demo to help new users get familiar with the HPX library. It demonstrates how to use HPX's core functionality, including asynchronous output (hpx::cout
). The program prints "The answer is 42!" to the console using HPX's parallel execution engine.
HPX is a C++ Standard Library for concurrency and parallelism, enabling distributed and asynchronous computing. HPX provides a unified API for local and distributed execution, making it ideal for applications that require high performance, scalability, and parallelism.
This project uses HPX's hpx_main
to handle the underlying runtime initialization, allowing developers to focus directly on the code logic without worrying about manually managing the HPX runtime.
simple_hpx.cpp
: The main source file that prints"The answer is 42!"
using HPX's asynchronous output capabilities (hpx::cout
).CMakeLists.txt
: The CMake configuration file that sets up the project, including the necessary HPX and Boost libraries.
To compile and run this project, you'll need the following dependencies:
- HPX: Install HPX via your package manager or build from source. Check out HPX installation guide.
- Boost: Ensure Boost (version 1.71 or higher) is installed on your system. Boost installation guide.
Follow these steps to build and run the project:
-
Clone the repository:
git clone https://github.com/brakmic/simple_hpx.git cd simple_hpx
-
Create a build directory:
mkdir build && cd build
-
Configure the project using CMake:
cmake ..
-
Build the project:
make
-
Run the program:
./simple_hpx
You should see the following output:
The answer is 42!