esuau / parallel-word-count

⚡ A simple word counter algorithm implementing parallel processing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parallel Word Count

The purpose of this project is to experiment parallel processing with the MPJ Express library. This program reads a text file and counts the number of occurrences in the text for a given word.

Here, we use the first core to read the file and distribute each line to the other cores. Each of these cores count the number of occurrences of the given word in the line they receive. Then, they return their result to the main core that combines them, printing the final result.

Requirements

JDK

Download and install the last version of Java SE Development Kit 8.

MPJ Express

Download the MPJ Express software on SourceForge.

Add MPJ_HOME to your environment variables:

export MPJ_HOME=/path/to/mpj

Update your PATH variable:

export PATH=$MPJ_HOME/bin:$PATH

For more information, read the official user guide for your operating system.

Compile

Compile with javac:

javac -d bin -cp .:$MPJ_HOME/lib/mpj.jar src/fr/upec/esipe/ParallelWordCount.java

Run

Run with mpjrun:

cd bin/
mpjrun -np <number of cores> fr.upec.esipe.ParallelWordCount <path/to/textfile> <word to count> 

Note that the number of cores has to be greater or equal to two.

About

⚡ A simple word counter algorithm implementing parallel processing


Languages

Language:Java 100.0%