https://github.com/tonitaga/parallel-algorithms-cpp
Implementation of parallel algorithms and comparison from speed of operation with sequential implementation. Algorithms: Ant Colony Optimization Algorithm, Gauss Algorithm, Winograd Algorithm
https://github.com/tonitaga/parallel-algorithms-cpp
algorithms ant-colony-optimization cpp17 gauss-elimination parallel-computing winograd-algorithm
Last synced: 10 months ago
JSON representation
Implementation of parallel algorithms and comparison from speed of operation with sequential implementation. Algorithms: Ant Colony Optimization Algorithm, Gauss Algorithm, Winograd Algorithm
- Host: GitHub
- URL: https://github.com/tonitaga/parallel-algorithms-cpp
- Owner: tonitaga
- License: mit
- Created: 2023-10-08T20:28:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-08T20:51:09.000Z (about 2 years ago)
- Last Synced: 2025-01-03T10:46:06.406Z (12 months ago)
- Topics: algorithms, ant-colony-optimization, cpp17, gauss-elimination, parallel-computing, winograd-algorithm
- Language: C++
- Homepage:
- Size: 667 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Parallel Algorithms
## Install
---
To install the parallel algorithms implementation, follow these steps:
1. Clone or download the matrix library repository.
```shell
git clone https://github.com/tonitaga/Parallel-Algorithms-CPP.git
```
2. Ensure you have the g++ compiler installed on your system.
3. Build all targets
```shell
make all
```
Or build them separately
```shell
make ant
```
```shell
make gauss
```
```shell
make winograd
```
4. Run need target
```shell
make run_ant
```
```shell
make run_gauss
```
```shell
make run_winograd
```
## Ant colony optimization
---
[Ant Colony Optimization article <- click](https://habr.com/ru/companies/timeweb/articles/754462/)
The Ant Colony Optimization algorithm is a algorithm
inspired by the foraging behavior of ants.
It uses a probabilistic approach to find optimal solutions
by simulating the pheromone trail communication and collective
decision-making of ants, effectively exploring and exploiting solution spaces.
In the parallel version, we employed two approaches within
the same algorithm based on the size of the input data:
1) If the graph size exceeds 50, additional computation threads are utilized.
2) If the graph size is less than 50, we employ parallel computation using the ` -> std::execution::par` library.
Irrespective of the graph size, ants are created in parallel
in the parallel algorithm to expedite their creation time.
## Gauss elimination
---
The Gauss Algorithm, also known as the Gauss Method, is an alternative way
to solve a system of linear algebraic equations.
The advantage of this method is its simplicity,
as it only requires a piece of paper and knowledge of addition and
subtraction.
To implement parallel calculations, we have used OpenMP
directives, specifically parallelization of the main for loop using the
'#pragma omp parallel for' directive.
It is well-known that parallel computation can be costly,
so sequential computation will be faster for small data sizes.
To observe the performance, create a matrix with sizes starting
from 250.
## Winograd algorithm
---
The Winograd algorithm is an optimized matrix multiplication
method that was proposed by Winograd
This algorithm is based on the observation that some calculations
in a standard matrix multiplication algorithm can be performed
in advance and their results can be reused to reduce the number of
"operations.