Parallel matrix multiplication using HPX (High Performance ParalleX), a C++ standard library for parallelism and concurrency.
This project multiplies two N × N matrices (double) in parallel using hpx::experimental::for_loop with the par execution policy — each row of the result is computed on a separate HPX thread.
Two storage layouts are provided (compile-time selectable):
| Mode | Storage | Toggle |
|---|---|---|
| 1D (default) | Flat std::vector<double> with IDX(i,j) macro |
USE_2D = false |
| 2D | std::vector<std::vector<double>> |
USE_2D = true |
- CMake ≥ 3.18
- C++17 compatible compiler
- HPX library installed and discoverable by CMake
# Configure (adjust HPX_DIR if needed)
cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/hpx
# Build
cmake --build build
# Run
./build/matrix_multHPX parallel matrix multiply (1024x1024) — 1D layout
2048 (expected 2048)
Edit the constants at the top of main.cpp:
constexpr bool USE_2D = false; // switch to true for 2D layout
constexpr int N = 1024; // matrix dimension├── CMakeLists.txt # Build configuration
├── main.cpp # Matrix multiplication implementation
└── README.md
This project is unlicensed — feel free to use it however you like.