1 Replies - 2572 Views - Last Post: 16 May 2011 - 06:31 AM Rate Topic: -----

#1 kevin_911  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 127
  • Joined: 02-April 09

Round-Robin Scheduling

Posted 16 May 2011 - 05:48 AM

Hi Guys,

I am trying to do multiple pattern searching using MPI. While searching I came
across Round-Robin scheduling where I can distribute the load balance between
each processes.

My current scheduling which has flaws doesnt always return the right result by what I mean is it either returns too many pattern searches or too less, As shown
below:

	FILE *out;
	char fileName[1000];
#ifdef DOS
	sprintf (fileName, "result_%d.txt",rank);
#else
	sprintf (fileName, "result_%d.txt",rank);
#endif
	out = fopen( fileName, "w+");
	if (out == NULL)
		return 0;

	while ( readTextData(textNumber) ) {
	
		if (readPatternData(rank)) {
			patternNumber = rank;
				hostMatch(out, textNumber, patternNumber, control, appearances );	 
		}
		textNumber++;
	} 
	MPI_Barrier(MPI_COMM_WORLD);
	MPI_Finalize();
	fclose(out);


By doing a printf this is how each process are carrying out the job:

Quote

Process 0: Pattern 0 Text 0
Process 0: Pattern 1 Text 1
Process 0: Pattern 1 Text 2
Process 0: Pattern 1 Text 3
Process 0: Pattern 1 Text 4
Process 1: Pattern 0 Text 0
Process 2: Pattern 0 Text 0
Process 1: Pattern 2 Text 1
Process 2: Pattern 3 Text 1
Process 1: Pattern 2 Text 2
Process 2: Pattern 3 Text 2
Process 1: Pattern 2 Text 3
Process 2: Pattern 3 Text 3
Process 1: Pattern 2 Text 4
Process 2: Pattern 3 Text 4
Process 3: Pattern 0 Text 0
Process 3: Pattern 4 Text 1
Process 3: Pattern 4 Text 2
Process 3: Pattern 4 Text 3
Process 4: Pattern 0 Text 0
Process 3: Pattern 4 Text 4
Process 4: Pattern 5 Text 1
Process 4: Pattern 5 Text 2
Process 4: Pattern 5 Text 3
Process 4: Pattern 5 Text 4
etc...........


Well say if I have 16 processors and if I have 'n' numbers of pattern+texts to distribute between the processors, how could I do this by using the round-robin scheduling?

Thanks

This post has been edited by kevin_911: 16 May 2011 - 05:49 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Round-Robin Scheduling

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6057
  • View blog
  • Posts: 23,494
  • Joined: 23-August 08

Re: Round-Robin Scheduling

Posted 16 May 2011 - 06:31 AM

Sigh...Objective-C is NOT standard C, which is what your code is. Objective-C is an object-oriented language used primarily in Apple products and more closely approximates C++ than C.

Please post C questions in the C and C++ Forum.

Moved there.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1