string searching in parallel by sowmya padmanabhan n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
String Searching In Parallel By Sowmya Padmanabhan PowerPoint Presentation
Download Presentation
String Searching In Parallel By Sowmya Padmanabhan

Loading in 2 Seconds...

play fullscreen
1 / 9

String Searching In Parallel By Sowmya Padmanabhan - PowerPoint PPT Presentation


  • 96 Views
  • Uploaded on

String Searching In Parallel By Sowmya Padmanabhan. Final Term Project Presentation for Parallel Processing Dr. Charles Fulton. One way to parallelize is:.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'String Searching In Parallel By Sowmya Padmanabhan' - wallis


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
string searching in parallel by sowmya padmanabhan

String Searching In ParallelBy Sowmya Padmanabhan

Final Term Project Presentation for Parallel Processing

Dr. Charles Fulton

one way to parallelize is
One way to parallelize is:
  • Consider a huge text document ( something like an encyclopedia available electronically ) and you want to search through it for several words or phrases or sentences at the same time.
  • We call what we are searching as “search_string”.
  • Rather than having one processor look for all the search_strings in the given huge document, we could take advantage of parallel processing and have 10 different processors look for 10 different search_strings simultaneously thereby doing the searching really quickly and efficiently.
one way to parallelize is1
One way to parallelize is:
  • My first program basically accomplishes this objective.
  • The document in which I am searching for search_strings is an actual document, collection of William Shakespeare’s works, downloaded from an online resource and consists of approximately 400 Million characters.
  • My program is capable of handling up to 450 Million characters.
second way to parallelize
Second Way to Parallelize
  • Think of this scenario:

I have to look up the available huge electronic document (again imagine an encyclopedia ) for just one word or phrase or sentence at a time.

  • How do I take advantage of parallel processing?

Simple!

Divide the whole document into as many equal parts

as there are processors. Let’s call these “sub-documents” and allot each sub-document to one processor.

Now, what do we do with these sub-documents?

second way to parallelize1
Second Way to Parallelize
  • Yes, you are right!
  • Have each of the processors search for the search_string in only the sub-document that it has been allotted.
  • Sounds great! So, how do I code it?
  • Using MPI_Scatter Of Course!
  • Note: This program works when no. of processors are 10 and above, for less no. of processors, the buffer gets exceeded for MPI_Scatter command.
comparison of times
Comparison of Times
  • See Table of Comparisons.
algorithm for string searching
Algorithm for String Searching
  • int string_searching_algo (char *string, char *search_string) {
  • int i, j, k;
  • int count = 0, occurences = 0;
  • const int len_search_string = strlen ( search_string );
  • const int len_given_string = strlen ( string );
  • for (i = 0; i <= (len_given_string - len_search_string); i++ ) {

count = 0;

  • for(j = i,k = 0; k < (len_search_string) ; j++, k++) {
  • if ( *(string + j) != *(search_string + k) ) {
  • break;
  • } else {
  • count++;
  • }
  • if ( count == len_search_string ) {
  • occurences++;
  • }
  • }
  • }
  • return occurences;
  • }
conclusion
Conclusion
  • String searching done in parallel saves a lot of time especially when string searching needs to be done in an extremely huge document and is more efficient than single-processor searching.
  • One way to parallelize is to have several processors search different strings in one document in parallel and second way is to have several processors search for the same string in different portions(sub-documents) of the same document in parallel.
one problem however
One Problem however…
  • The second program that uses MPI_Scatter has one drawback that is, when a search_string overlaps in two sub-documents (one portion of it exists at the end of one sub-document and the other portion of the search-string exists at the beginning of next sub-document, available with some other processor), then the program will not give proper results.