Skip to content

LeoGori/parallel-grep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grep parallelization with MPI

This project consists in a simplified implementation of a string matching algorithm, with the introduction of parallel computation through the use of Microsoft MPI APIs.

Code Description

The main files that build up the project are:

  • grep.h: class that defines the grep namespaces, which includes data types and functiions that are useful for the implementation of the algorithm.
  • grep-main.cpp: the entry point fo the program, which implements the string matching algorithm, with the management of multiple processes.

Language and APIs

The code is entirely written in C++ programming language, with the use of the following libraries and APIs (omitting the standard ones):

  • fstream: used for parsing the text file
  • cstring: used for copying the content of vectors of strings into an unique array of chars, that is necessary as a consistent input for MPI functions
  • mpi.h: which introduces parallel computation in the algorithm, through a message passing mechanism between processes.

Performance analysis

Check the analysis of the performances of the implementation here

How to run the code (Windows)

  1. Install MinGw64
  2. Install CMake version ≥ 3.23
  3. Create folder for building project
  mkdir build
  cd build
  1. Generate the makefiles
  cmake -G “MinGW Makefiles” ..
  1. Build the project
  cmake --build .
  1. Run the program
  mpiexec -np <num_proc> .\parallel_grep.exe <word_to_search> ..\resources\input_file.txt

where <num_proc> needs to be replaced by a positive integer representing the number of processes that will execute the code, and <word_to_search> needs to be replaced by a string representing the word to be found

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published