prime_mpi


prime_mpi, a Fortran90 code which counts the number of primes between 1 and N, using MPI to carry out the calculation in parallel.

The algorithm is completely naive. For each integer I, it simply checks whether any smaller J evenly divides it. The total amount of work for a given N is thus roughly proportional to 1/2*N^2.

This program is mainly a starting point for investigations into parallelization.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

prime_mpi is available in a C version and a C++ version and a Fortran90 version and a Python version.

Related Data and Programs:

prime_mpi_test

mpi_test, a Fortran90 code which use the message passing interface (MPI) for parallel computations in a distributed memory environment.

Reference:

  1. Eratosthenes,
    A Method For Finding Prime Numbers,
    Papyrus 487.

Source Code:


Last revised on 19 August 2020.