Skip to content

2D Fast Fourier Transform (2D FFT) parallel algorithm using OpenMPI. The algorithm is implemented in C and it is based on the Cooley-Tukey iterative algorithm.

License

Notifications You must be signed in to change notification settings

zamb0/2D_Fast_Fourier_Transform_OpenMPI

Repository files navigation

C-Language OpenMPI

2D Fast Fourier Transform (2D FFT) OpenMPI Implementation

fft_cover

This repository contains the code for the Advanced Computer Architecture project (2022/2023).

Aim of the Project

The aim of the project is to parallelize a serial C code of a 2D Fast Fourier Transform (FFT) algorithm, the Colley-Tukey one, through OpenMPI. The input of the algorithm is a type P2 PGM image and the outputs are the 2D FFT of the image and the 2D iFFT image.

Execution Instructions

1 - Setup the Git Repository

If not already done, download and install git from git-scm.com. Then clone the repository with the following command:

git clone https://github.com/zamb0/ACA.git

2 - Install OpenMPI

Download Open MPI 4.1.1 from the official Open MPI website and install it.

3 - Compile

To compile and run the serial application, run the following commands:

gcc -Wall -o executableFile -lm -std=c99 *.c

you need to compile using all the .c files in the folder but fft_parallel.c and img_generator.c.

If you want to compile and run the parallel application instead, then compile in the following way:

mpicc -Wall -o executableFile -lm -std=c99 *.c

also in this case you need to compile using all the .c files in the folder but fft_serial.c and img_generator.c.

3b - Generate the Images (if needed)

If you do not have images to run the 2D FFT algorithm on, you can compile the img_generator.c to generate sample images of your choice. To compile the image generator, run the following command:

gcc -Wall -o img_gen img_generator.c pgm.c

Then, to generate an image, run the following command:

./img_gen [outputFile] [width] [height] [pgmType] [maxValue]

where outputFile is the name of the file where the image will be saved, width is the width of the image, height is the height of the image, pgmType is the type of pgm image (i.e. P2 is the one allowed to be used in our project), maxValue is the maximum value of the pixels in the image.

4 - Run the Program

To compile and run the serial application, run the following commands:

./executableFile [inputImage]

If you want to run the parallel application instead:

mpirun -np N executableFile [inputImage]

where N is the number of processes you want to use.

About

2D Fast Fourier Transform (2D FFT) parallel algorithm using OpenMPI. The algorithm is implemented in C and it is based on the Cooley-Tukey iterative algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages