home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / wizards / 3604 < prev    next >
Encoding:
Text File  |  1992-08-13  |  3.7 KB  |  77 lines

  1. Newsgroups: comp.unix.wizards
  2. Path: sparky!uunet!sun-barr!ames!network.ucsd.edu!dog.ee.lbl.gov!hellgate.utah.edu!fcom.cc.utah.edu!cs.weber.edu!terry
  3. From: terry@cs.weber.edu (A Wizard of Earth C)
  4. Subject: Re: MP CPU-time phenomena
  5. Message-ID: <1992Aug14.063450.25740@fcom.cc.utah.edu>
  6. Sender: news@fcom.cc.utah.edu
  7. Organization: Weber State University  (Ogden, UT)
  8. References: <1992Aug6.214740.164@socrates.umd.edu> <15250002@hprpcd.rose.hp.com>
  9. Date: Fri, 14 Aug 92 06:34:50 GMT
  10. Lines: 65
  11.  
  12. In article <15250002@hprpcd.rose.hp.com> tmilner@hprpcd.rose.hp.com (Tom Milner) writes:
  13. >In comp.unix.wizards, boyd@prl.dec.com (Boyd Roberts) writes:
  14. >
  15. >|  In article <1992Aug6.214740.164@socrates.umd.edu>, steves@socrates.umd.edu (Steven Sonnenberg) writes:
  16. >|  > The cpu-bound application is:
  17. >|  > 
  18. >|  >     while (1) i++;
  19. >|  > 
  20. >|  > I am measuring process CPU utilization based on u.u_utime + u.u_stime
  21. >|  > over the elapsed time (CPU seconds).  For example, in 10 seconds
  22. >|  > there are 20 seconds on CPU time (assuming 2 processors).
  23. >|  > 
  24. >|  And just how is your while loop going to run on both processors at the same time?
  25. >There's no reason that a processor switch could not occur anywhere in
  26. >the code... In a 10 second window, all processors could have a chance to
  27. >execute the code stream. 
  28.  
  29. At the same time, or are you switching processors (ie: serializing)?  I suspect
  30. that even if you forced a processor switch, that's all it'd be.  I mean, you
  31. can't seriously be expecting i to increment n times as fast for n processors!
  32.  
  33. What you need to do to force concurrent utilization is to take a concurrent
  34. benchmark and compile it with the right compiler (that knows about breaking
  35. concurrent code into multiple threads of execution) and then run it.  Even
  36. then, you probably aren't going to get aggregate CPU time, especially if you
  37. are runing an SMP'able kernel (it might be possible to get aggregate time if
  38. you are using an ASMP box and measuring using the master... but not likely).
  39.  
  40. The only alternative to this might be to gather statistics in the scheduler...
  41. but then, of course, you have to subtract out your statistics gathering to
  42. be accurate, and then subtract out your subtract time, etc.
  43.  
  44. A lot of "how much paralellization" you get is related to "how paralellizable
  45. is my problem" and "how good at generating paralell code are the tools I'm
  46. using".  The Cray FORTRAN compiler for the Y/MP, for instance, has a
  47. ridiculous (even more than ANSI C) number of hints you give it to tell it
  48. about how to paralellize your code (like ANSI C, it isn't too smart about
  49. knowing precisely what a programmer is doing and how it maps to the
  50. architecture, otherwise).
  51.  
  52. This all goes to show you why throwing a bazillion processors at a problem
  53. won't necessarily solve it faster.
  54.  
  55. My suggestion would be to build a model with something that is unit
  56. benchmarkable for multiple threads of execution (like a preemptive threads
  57. package... so Sun's doesn't qualify).  Then build an infinitely paralellizable
  58. benchmark (or as close as you can get ;-), run it, and use it to model by
  59. linear scaling the performance you'll probably get, assuming you never
  60. context switch.
  61.  
  62. Of course, if your actual application isn't infinitely paralellizable, you
  63. may get different mileage...
  64.  
  65.  
  66.                     Terry Lambert
  67.                     terry_lambert@gateway.novell.com
  68.                     terry@icarus.weber.edu
  69. ---
  70. Any opinions in this posting are my own and not those of my present
  71. or previous employers.
  72. -- 
  73. -------------------------------------------------------------------------------
  74.                                                        terry@icarus.weber.edu
  75.  "I have an 8 user poetic license" - me
  76. -------------------------------------------------------------------------------
  77.