C++ implementation of the eratosthenes sieve using control and data parallelism.
Sieve of Eratosthenes is a simple and ancient algorithm used to find the prime numbers up to any given limit. It is one of the most efficient ways to find small prime numbers.
For a given upper limit nn the algorithm works by iteratively marking the multiples of primes as composite, starting from 2. Once all multiples of 2 have been marked composite, the muliples of next prime, ie 3 are marked composite. This process continues until p ≤ √n where p is a prime number.
Algorithm steps for primes below 121.
- C++ 14/17 or later
- OpenMp
- Optional:
- Linux
## CMakeLists
cmake_minimum_required(VERSION 3.17)
project(SieveEratosthenes)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fopenmp")
add_executable(your_file.cpp)