Research Article

Performance Comparison of OpenMP, MPI, and MapReduce in Practical Problems

Algorithm 6

MPI pseudocode for the join problem.
MPI_JOIN_PAGES(char* koFile, char* enFile, char* outFile)
 koFileLineSize getFileLines(koFile)
 MPI-Init
 nRank process ID number within communicator
 divLine the number of each process’s allocated lines
 line move file pointer to the first of allocated lines
 if nRank = 0 then
  while true do
   send (NULL, NULL, NULL, NULL, true)
    to another processes
   receive (title, koUrl, word, enUrl, isLast)
    from another processes
   out.Write(title, koUrl, word, enUrl)
   if isLast(ALL) then break
 else
  for = 0 to divLine do
   text enFile.nextLine(line  +  )
   title searchTitle(text)
   content searchContent(text)
   koUrl searchUrl(text)
   wordListEngKeyword(content)
   foreach word wordList do
    if isExist(word, enFile) then
     enUrl getUrl(word, enFile)
    else
     
    send (title, koUrl, word, enUrl, isLast)
     to another processes
    receive (title, koUrl, word, enUrl, isLast)
     from another processes
   if isLast(ALL) then break
 MPI-Finalize