User Tools

Site Tools


haas:spring2017:sysprog:projects:pnc1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

haas:spring2017:sysprog:projects:pnc1 [2016/02/28 17:29] – external edit 127.0.0.1haas:spring2017:sysprog:projects:pnc1 [2017/03/21 19:41] (current) wedge
Line 6: Line 6:
 ~~TOC~~ ~~TOC~~
  
-======Project: ALGORITHMS - PRIME NUMBER CALCULATION (pnc1)======+======Project: OPTIMIZING ALGORITHMS - PRIME NUMBER CALCULATION (pnc1)======
  
 =====Objective===== =====Objective=====
-To apply your skills in the implementation of prime number calculating algorithms, this time in a concurrent setting. +To apply your skills in algorithmic optimization through the implementation of improved prime number calculating programs.
- +
-=====Prerequisites/Corequisites===== +
-In addition to the new skills required on previous projects, to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved: +
- +
-  * **fork**(**2**) +
-  * algorithms to appropriately split up the work among a group+
  
 =====Algorithmic Complexity===== =====Algorithmic Complexity=====
Line 24: Line 18:
 Additionally, if optimizing for time (specifically to reduce the amount of time taken), strategic approaches are taken to reduce unnecessary or redundant operations (yet still achieving the desired end results). Additionally, if optimizing for time (specifically to reduce the amount of time taken), strategic approaches are taken to reduce unnecessary or redundant operations (yet still achieving the desired end results).
  
-Through the concurrent implementations in this project, we should start to see some of the impacts those approaches can have on runtime. It may not offer exact 50% cuts in runtime, but more fully utilizing available computing resources should have a notable and appreciable impact on overall runtime.+This project will endeavor to introduce you to the notion that the algorithms and constructs you use in coding your solution can and do make a difference to the overall runtime of your code.
  
-=====Background===== +=====Optimizing the prime number calculation===== 
-We explored the basic essence of prime numbers in the last projectThis time around, we will be modifying the brute force and square root variants to utilize **fork()**, so the work can be split up and performed by child processes (the parent will merely be coordinating the effort, and not performing any prime computational work).+We should be fairly familiar with the process of computing primes by now, which is an essential beginning step to accomplish before pursuing optimizationFollowing will be some optimizations I'd like you to implement (as separate programs) so we can analyze the differences in approaches, and how they influence runtimes.
  
-=====Calculating the primality of a number===== +====odds (primeodds)==== 
-As of yetthere is no quick and direct way of determining the primality of a given number. Insteadwe must perform a series of tests to determine if it fails primality (typically by proving it is composite).+Some optimizations can be the result of sheer common sense observations. For instancewith the exception of 2all primes are odd numbers.
  
-This process incurs a considerable amount of processing overhead on the task, so much so that increasingly large values take increasing amounts of time. Often, approaches to prime number calculation involve various algorithmswhich offer various benefits (less time) and drawback (more complex code). +So does it make sense to check an even number for primality? No, it doesn't.
- +
-Your task for this project is to implement 2 prime number programs: +
- +
-  - forked brute force prime calculation +
-  - forked square root-optimized brute force calculation +
- +
-====brute force==== +
-The brute force approach is the simplest to implement (and likely also the worst-performing). We will use it as our baseline (it is nice to  have something to compare against). +
- +
-To perform it, we simply attempt to evenly divide all the values between 1 and the number in question. If any one of them divides evenly, the number is **NOT** prime, but instead a composite value. +
- +
-Checking the remainder of a division indicates whether or not a division was clean (having 0 remainder indicates such a state). +
- +
-For example, the number 11: +
- +
-<code> +
-11 % 2 = 1 (2 is not a factor of 11) +
-11 % 3 = 2 (3 is not a factor of 11) +
-11 % 4 = 3 (4 is not a factor of 11) +
-11 % 5 = 1 (5 is not a factor of 11) +
-11 % 6 = 5 (6 is not a factor of 11) +
-11 % 7 = 4 (7 is not a factor of 11) +
-11 % 8 = 3 (8 is not a factor of 11) +
-11 % 9 = 2 (9 is not a factor of 11) +
-11 % 10 = 1 (10 is not a factor of 11) +
-</code> +
- +
-Because none of the values 2-10 evenly divided into 11, we can say it passed the test: **11 is a prime number** +
- +
-On the other hand, take 119: +
- +
-<code> +
-119 % 2 = 1 (2 is not a factor of 119) +
-119 % 3 = 2 (3 is not a factor of 119) +
-119 % 4 = 3 (4 is not a factor of 119) +
-119 % 5 = 4 (5 is not a factor of 119) +
-119 % 6 = 5 (6 is not a factor of 119) +
-119 % 7 = 0 (7 is a factor of 119) +
-</code>+
  
-Because 7 evenly divided into 119it failed the test119 is **not** a prime, but instead a composite number.+And can we predict even numbers? Yeswe canthey occur every other number.
  
-There is no further need to check the remaining valuesas once we have proven the non-primality of a number, the state is set: it is composite. So be sure to use a **break** statement to terminate the computation loop (will also be a nice boost to runtime).+Therefore, we can start our number checking at 3and skip 2 values each time (3, 5, 7, 9, 11, etc.).
  
-So when contemplating a concurrent solutionimagine we were computing the primes between 2-4096, and we were splitting up the work among 4 child processes: +To make our output correct, we would simply display the "2" outright. We know it is prime, and will make that assumption with this program.
-  * 4096 / 4 is 1024 +
-    * one child would do 2-1024 +
-    * another would do 1025-2048 +
-    * a third would do 2049-3072 +
-    * and the last would do 3073-4096 (4095, technically)+
  
-This way the same amount of work is being performed, only instead of in one batch run, as 4 concurrent fractions of the work. Theoretically, this should result in a near 4X performance improvement, but as we will see, it won'be that direct, due to hardware and software details (I/O, memory access, OS mechanisms, etc.); there should be notable improvements, however.+This program should be an optimization based on your **primebruteopt** program from pnc0.
  
-====square root====+====square root (primesqrt)====
 An optimization to the computation of prime numbers is the square root trick. Basically, if we've processed numbers up to the square root of the number we're testing, and none have proven to be evenly divisible, we can also assume primality and bail out. An optimization to the computation of prime numbers is the square root trick. Basically, if we've processed numbers up to the square root of the number we're testing, and none have proven to be evenly divisible, we can also assume primality and bail out.
  
Line 116: Line 66:
 This will dramatically improve the runtime, and offers a nice comparison against our brute force baseline. This will dramatically improve the runtime, and offers a nice comparison against our brute force baseline.
  
-Similar to the forked brute force, we will look to split up the work among a group of child processes, with the parent being the coordinator.+NOTE: You will be reverting to checking all numbers (both even and odd) with this program.
  
-=====Program===== +This program should be an optimization based on your **primebruteopt** program from pnc0.
-It is your task to write 2 separate prime number calculating programs:+
  
-  - **primebrutefork.c**: for your forked brute force implementation +====sqrt() odds (primesqrtodds)==== 
-  **primesqrtfork.c**: for your forked square root-optimization of the brute force+In the previous program we used **sqrt()** against all the values, even or odd.
  
-Your program should: +This program will eliminate the even values, checking only the odds.
-  * obtain 3 parameters from the command-line (see **command-line arguments** section below): +
-    * argv[1]: maximum value to calculate to (your program should run from (approximately) 2 through that number (inclusive of that number) +
-    * argv[2]: visibility. If a **1** is provided, print out the prime numbers in a space separated list; if a **0** is provided, run silent: only display the runtime information. +
-    * argv[3]: number of child processes to fork (we'll be testing with 2 and 4 child processes). +
-    * these values should be positive integer values; you can make the assumption that the user will always do the right thing. +
-  * start your stopwatch (see **timing** section below): +
-  * determine how to split up the work load, and fork() the requested number of child processes +
-  * have each child perform its share of the work utilizing the given algorithm  +
-    * if enabled, display the prime numbers found in the range +
-    * in a concurrent implementation, you'll likely want to have each child open up a unique file and output all its values there. When the children are finished, the parent can then reassemble and display the primes in sequential order. +
-  * output the processing run-time to STDERR (do this always). +
-  * your output **MUST** be conformant to the example output in the **execution** section below. This is also a test to see how well you can implement to specifications. Basically: +
-    * if primes are being displayed, they are space-separated (first prime hugs the left margin), and when all said and done, a newline is issued. +
-    * the timing information will be displayed in accordance to code I will provide (in the **timing** section).+
  
-====Other considerations==== +This program should be an optimization of your **primesqrt** program.
-All your programs MUST perform the calculations to determine primality- you may not always be printing it out (depending on argv[2]), but work must be done to ensure the value is identified as a prime/composite value.+
  
-For example:+====sqrt()-less square root (primesqrtopt)==== 
 +An optimization to the previous process, which used **sqrt()**, this variation will do the exact same thing, but without using the **sqrt()** function. It will approximate the square root.
  
-<code> +We know that a square root (especially a whole numbered square root)is when we have whole number factors that are squared. But in addition, only considering the whole number aspect of the square root, we start seeing series of values with the same whole square root value:
-if (show == 1) +
-+
- work to determine if it is prime +
- if prime +
- print number +
-+
-</code>+
  
-will actually skip the core processing, and you’ll see some amazing runtimes as a result. They may be amazing, but they’re not real, because you’re not actually doing anything.+<cli> 
 +lab46:~$ count=0; for ((i=2; i<152; i++)); do printf "[%3d] %2d " "${i}" `echo "sqrt($i)" | bc -q`; let count=count+1; if [ "${count}" -eq 10 ]; then echo; count=0; fi; done; echo 
 +[  2]  1 [  3]  1 [  4]  2 [  5]  2 [  6]  2 [  7]  2 [  8]  2 [  9]  3 [ 10]  3 [ 11]  3 
 +[ 12]  3 [ 13]  3 [ 14]  3 [ 15]  3 [ 16]  4 [ 17]  4 [ 18]  4 [ 19]  4 [ 20]  4 [ 21]  4 
 +[ 22]  4 [ 23]  4 [ 24]  4 [ 25]  5 [ 26]  5 [ 27]  5 [ 28]  5 [ 29]  5 [ 30]  5 [ 31]  5 
 +[ 32]  5 [ 33]  5 [ 34]  5 [ 35]  5 [ 36]  6 [ 37]  6 [ 38]  6 [ 39]  6 [ 40]  6 [ 41]  6 
 +[ 42]  6 [ 43]  6 [ 44]  6 [ 45]  6 [ 46]  6 [ 47]  6 [ 48]  6 [ 49]  7 [ 50]  7 [ 51]  7 
 +[ 52]  7 [ 53]  7 [ 54]  7 [ 55]  7 [ 56]  7 [ 57]  7 [ 58]  7 [ 59]  7 [ 60]  7 [ 61]  7 
 +[ 62]  7 [ 63]  7 [ 64]  8 [ 65]  8 [ 66]  8 [ 67]  8 [ 68]  8 [ 69]  8 [ 70]  8 [ 71]  8 
 +[ 72]  8 [ 73]  8 [ 74]  8 [ 75]  8 [ 76]  8 [ 77]  8 [ 78]  8 [ 79]  8 [ 80]  8 [ 81]  9 
 +[ 82]  9 [ 83]  9 [ 84]  9 [ 85]  9 [ 86]  9 [ 87]  9 [ 88]  9 [ 89]  9 [ 90]  9 [ 91]  9 
 +[ 92]  9 [ 93]  9 [ 94]  9 [ 95]  9 [ 96]  9 [ 97]  9 [ 98]  9 [ 99]  9 [100] 10 [101] 10 
 +[102] 10 [103] 10 [104] 10 [105] 10 [106] 10 [107] 10 [108] 10 [109] 10 [110] 10 [111] 10 
 +[112] 10 [113] 10 [114] 10 [115] 10 [116] 10 [117] 10 [118] 10 [119] 10 [120] 10 [121] 11 
 +[122] 11 [123] 11 [124] 11 [125] 11 [126] 11 [127] 11 [128] 11 [129] 11 [130] 11 [131] 11 
 +[132] 11 [133] 11 [134] 11 [135] 11 [136] 11 [137] 11 [138] 11 [139] 11 [140] 11 [141] 11 
 +[142] 11 [143] 11 [144] 12 [145] 12 [146] 12 [147] 12 [148] 12 [149] 12 [150] 12 [151] 12 
 +</cli>
  
-What you want instead:+Square root of 81 is 9, but so is the square root of 82, 83, 84... etc. up until we hit 100.
  
-<code> +If we were checking 87 to be prime, we'd only have to check up to 9.
-work to determine if it is prime +
-if (show == 1) +
-+
- if prime +
- print number +
-+
-</code>+
  
-there are many ways to express the abovethrough compound if statements and other arrangementsbut notice how nothing is holding back “work to determine if it is prime”.+We don't need a **sqrt()** function to tell us this, we can determine the approximate square root point ourselves- by squaring the current factor being tested, and so long as it hasn't exceeded the value we're checkingwe know to continue.
  
-That also isn’t to say you can’t avoid doing work run if you’re able to determine its non-primality with simple pretest (even value, factor of 3, etc.), but that’s actually considered more of the core “work”so it is more than okay (and encouraged in the optimized prime variants).+There are some important lessons at play here: 
 + 
 +  * approximation can be powerful 
 +  * approximation can result in simpler algorithm, improving runtime 
 +    * **sqrt()** is more complex than you may be aware, not to mention it is in function. By avoiding that function call, we eliminate some overhead, and that can make a big difference in runtime performance. 
 + 
 +NOTE: Again, for comparison sake, check ALL numbers (even and odd) for this variant. 
 + 
 +This program should be an optimization of your **primesqrt** program. 
 + 
 +====sqrt()-less odds (primesqrtoptodds)==== 
 +Andto round out our analysis, enhance the optimized sqrt variant to only check odd values.  
 + 
 +This program should be an optimization of your **primesqrtopt** program. 
 + 
 +=====Program===== 
 +It is your task to write some optimized prime number calculating programs: 
 + 
 +  - **primeodds.c**: checking only odd values 
 +  - **primesqrt.c**: for your **sqrt()**-based implementation 
 +  - **primesqrtodds.c**: **sqrt()**-based implementation only checking odds 
 +  - **primesqrtopt.c**: for your **sqrt()**-less square root approximated implementation 
 +  - **primesqrtoptodds.c**: **sqrt()**-less square root only checking odds  
 + 
 +Your program should: 
 +  * obtain 1 parameter from the command-line (see **command-line arguments** section below): 
 +    * argv[1]: maximum value to calculate to (your program should run from (approximately) 2 through that number (inclusive of that number) 
 +    * this value should be a positive integer value; you can make the assumption that the user will always do the right thing. 
 +  * do the specified algorithmic optimizations 
 +    * please take note in differences in run-timecontemplating the impact the various algorithms and approaches have on performance. 
 +  * start your stopwatch (see **timing** section below): 
 +  * perform the correct algorithm against the input 
 +  * display (to STDOUT) the prime numbers found in the range 
 +  * output the processing run-time to STDERR 
 +  * your output **MUST** be conformant to the example output in the **execution** section below. This is also a test to see how well you can implement to specifications. Basically: 
 +    * as primes are being displayed, they are space-separated (first prime hugs the left margin), and when all said and done, a newline is issued. 
 +    * the timing information will be displayed in accordance to code I will provide (in the **timing** section).
  
 =====Command-Line Arguments===== =====Command-Line Arguments=====
Line 195: Line 169:
   * argv[0]: program invocation (path + program name)   * argv[0]: program invocation (path + program name)
   * argv[1]: our maximum / upper bound   * argv[1]: our maximum / upper bound
-  * argv[2]: visibility (1 to show primes, 0 to be silent) 
-  * argv[3]: processes (number of child processes to fork; 2,4) 
- 
-There are ways to do flexible argument parsing, and even to have dashed options as we have on various commands. But such things are beyond the scope of our current endeavors, so we will stick to this basic functionality for now. 
  
 ====Simple argument checks==== ====Simple argument checks====
-Although I'm not going to require extensive argument checking for this project, here's how we would check to see if the minimal number of arguments has been provided:+Although I'm not going to require extensive argument parsing or checking for this project, we should check to see if the minimal number of arguments has been provided:
  
 <code c> <code c>
-    if (argc < 4)  // if less than arguments have been provided+    if (argc < 2)  // if less than arguments have been provided
     {     {
         fprintf(stderr, "Not enough arguments!\n");         fprintf(stderr, "Not enough arguments!\n");
Line 211: Line 181:
 </code> </code>
  
-If you're wondering, "why 4? I thought we only had 3.", C includes the program's name as the first argument, so we want program + max + visibility + processes, or 4. +====Grab and convert max==== 
- +Finally, we need to put the argument representing the maximum value into a variable.
-====Grab and convert max and visibility==== +
-Finally, we need to put the arguments representing the maximum value, visibility settings, and number of processes into variables.+
  
-I'd recommend declaring two variables of type **int**.+I'd recommend declaring a variable of type **int**.
  
 We will use the **atoi(3)** function to quickly convert the command-line arguments into **int** values: We will use the **atoi(3)** function to quickly convert the command-line arguments into **int** values:
Line 222: Line 190:
 <code c> <code c>
     max  = atoi(argv[1]);     max  = atoi(argv[1]);
-    show = atoi(argv[2]); 
-    np   = atoi(argv[3]); 
 </code> </code>
  
Line 283: Line 249:
  
 =====Execution===== =====Execution=====
-Several operating behaviors are shown as examples. +Your program output should be as follows (given the specified range):
- +
-Brute force showing primes, 2 child processes:+
  
 <cli> <cli>
-lab46:~/src/sysprog/pnc1$ ./primebrutefork 90 1 2+lab46:~/src/sysprog/pnc1$ ./primesqrt 90
 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89  2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 
   0.000088   0.000088
 lab46:~/src/sysprog/pnc1$  lab46:~/src/sysprog/pnc1$ 
 </cli> </cli>
- 
-Brute force not showing primes, 2 child processes: 
- 
-<cli> 
-lab46:~/src/sysprog/pnc1$ ./primebrutefork 90 0 2 
-  0.000008 
-lab46:~/src/sysprog/pnc1$  
-</cli> 
- 
-Similarly, for the square root version (showing primes, 4 child processes): 
- 
-<cli> 
-lab46:~/src/sysprog/pnc1$ ./primesqrtfork 90 1 4 
-2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89  
-  0.000089 
-lab46:~/src/sysprog/pnc1$  
-</cli> 
- 
-And, without showing primes (4 child processes): 
- 
-<cli> 
-lab46:~/src/sysprog/pnc1$ ./primesqrtfork 90 0 4 
-  0.000006 
-lab46:~/src/sysprog/pnc1$  
-</cli> 
- 
-Don't be alarmed by the visible square root actually seeming to take MORE time; we have to consider the range as well: 90 is barely anything, and there is overhead incurred from the **sqrt()** function call. The real savings will start to be seen once we get into the thousands (and beyond). 
- 
-And that's another neat thing with algorithm comparison: a "better" algorithm may have a sweet spot or power band: they may actually perform worse until (especially at the beginning). 
- 
-The same goes for your optimized solution (same parameters). 
  
 The execution of the programs is short and simple- grab the parameters, do the processing, produce the output, and then terminate. The execution of the programs is short and simple- grab the parameters, do the processing, produce the output, and then terminate.
Line 330: Line 263:
 If you'd like to compare your implementations, I rigged up a script called **primerun** which you can run. If you'd like to compare your implementations, I rigged up a script called **primerun** which you can run.
  
-In order to work, you **MUST** be in the directory where your **primebrutefork** and **primesqrtfork**. +In order to work, you **MUST** be in the directory where your **primesqrt**, **primesqrtopt** and **primemap** binaries reside, and must be named as suchYou'll also want to copy in your **primebrute** and **primebruteopt** binaries to truly get the full picture.
- +
-It is recommended to have your single process versions of **primebrute**, **primesqrt**, and **primeopt** available in the same directory for comparisons against these new variants.+
  
-For instance (running on my implementations):+For instance (running on my implementations of the programs):
  
 <cli> <cli>
 lab46:~/src/sysprog/pnc1$ primerun lab46:~/src/sysprog/pnc1$ primerun
-============================================ +==================================================================================================== 
-   range       brute        sqrt         opt  +    range        brute     bruteopt         odds         sqrt     sqrtodds      sqrtopt  sqrtoptodds  
-============================================ +==================================================================================================== 
-       8    0.000002    0.000002    0.000002   +      128     0.000179     0.000139     0.000124     0.000108     0.000085     0.000112     0.000078  
-      16    0.000002    0.000002    0.000002   +      256     0.000401     0.000161     0.000120     0.000149     0.000128     0.000119     0.000085  
-      32    0.000003    0.000004    0.000002   +      512     0.001535     0.000345     0.000213     0.000207     0.000179     0.000134     0.000134  
-      64    0.000005    0.000020    0.000003   +     1024     0.005385     0.000919     0.000542     0.000428     0.000268     0.000184     0.000159  
-     128    0.000012    0.000023    0.000003   +     2048     0.019076     0.002767     0.001481     0.000857     0.000517     0.000335     0.000302  
-     256    0.000037    0.000029    0.000006   +     4096     0.070836     0.009331     0.004770     0.002034     0.001148     0.000708     0.000480  
-     512    0.000165    0.000036    0.000014   +     8192     0.270955     0.032402     0.016253     0.004934     0.002525     0.001575     0.000950  
-    1024    0.000540    0.000080    0.000033   +    16384     1.059970     0.116575     0.058424     0.012190     0.006239     0.003676     0.002117  
-    2048    0.001761    0.000187    0.000078   +    32768     4.209891     0.424113     0.212701     0.030711     0.015568     0.008867     0.004950  
-    4096    0.006115    0.000438    0.000189   +    65536   ----------     1.626774     0.787444     0.078278     0.039605     0.022158     0.012015  
-    8192    0.021259    0.001036    0.000458   +   131072   ----------     7.769508     3.954632     0.211732     0.105749     0.066574     0.035054  
-   16384    0.077184    0.002520    0.001153   +   262144   ----------   ----------   ----------     0.553307     0.275414     0.175391     0.091195  
-   32768    0.281958    0.006156    0.002826   +   524288   ----------   ----------   ----------     1.440572     0.713855     0.444240     0.229179  
-   65536    1.046501    0.015234    0.007135   +  1048576   ----------   ----------   ----------     3.743303     1.856485     1.137094     0.574455  
-  131072    5.160141    0.045482    0.021810   +  2097152   ----------   ----------   ----------   ----------     4.857408     2.923402     1.451850  
-  262144    --------    0.119042    0.057520   +  4194304   ----------   ----------   ----------   ----------   ----------   ----------     3.708858  
-  524288    --------    0.301531    0.146561   +  8388608   ----------   ----------   ----------   ----------   ----------   ----------   ----------  
- 1048576    --------    0.758027    0.370700   +==================================================================================================== 
- 2097152    --------    1.921014    0.943986   + verify:       OK           OK           OK           OK           OK           OK           OK       
- 4194304    --------    4.914725    2.423202   +====================================================================================================
- 8388608    --------    --------    --------   +
-============================================ +
- verify:       OK          OK          OK      +
-============================================+
 lab46:~/src/sysprog/pnc1$  lab46:~/src/sysprog/pnc1$ 
 </cli> </cli>
Line 374: Line 301:
 If you don't feel like waiting, simply hit **CTRL-c** and the script will terminate. If you don't feel like waiting, simply hit **CTRL-c** and the script will terminate.
  
-In the example output above, my **primeopt** is playing with an implementation of the **6a+/-1** algorithm. +I also include a validation check- to ensure your prime programs are actually producing the correct list of prime numbers. If the check is successful, you will see "OK" displayed beneath in the appropriate column; if unsuccessful, you will see "MISMATCH".
- +
-I also include a validation check- to ensure your prime programs are actually producing the correct list of prime numbers. If the check is successful, you will see "OK" displayed beneath in the appropriate column; if unsuccessful, you will be "MISMATCH". +
- +
-If you'd like to experiment with other variations, the script also recognizes prime variants of the following names: +
-  * primeoptfork (for an additional optimization) +
-  * primemapfork +
-  * primesievefork+
  
 =====Submission===== =====Submission=====
Line 389: Line 309:
   * Output must be correct, and match the form given in the sample output above.   * Output must be correct, and match the form given in the sample output above.
   * Code must be nicely and consistently indented (you may use the **indent** tool)   * Code must be nicely and consistently indented (you may use the **indent** tool)
-  * Code must utilize the algorithm(s) presented above: +  * Code must utilize the algorithm(s) presented above
-    * **primebrutefork.c** must do the forked unoptimized brute force method +    * **primeodds.c** 
-    * **primesqrtfork.c** must utilize the forked brute force method along with the square root trick (no other tricks)+    * **primesqrt.c** 
 +    * **primesqrtodds.c** 
 +    * **primesqrtopt.c** 
 +    * **primesqrtoptodds.c**
   * Code must be commented   * Code must be commented
     * have a properly filled-out comment banner at the top     * have a properly filled-out comment banner at the top
Line 403: Line 326:
  
 <cli> <cli>
-$ submit sysprog pnc1 primebrutefork.c primesqrtfork.c+$ submit sysprog pnc1 primeodds.c primesqrt.c primesqrtodds.c primesqrtopt.c primesqrtoptodds.c
 Submitting sysprog project "pnc1": Submitting sysprog project "pnc1":
-    -> primebrutefork.c(OK) +    -> primeodds.c(OK) 
-    -> primesqrtfork.c(OK)+    -> primesqrt.c(OK) 
 +    -> primesqrtodds.c(OK) 
 +    -> primesqrtopt.c(OK) 
 +    -> primesqrtoptodds.c(OK)
  
 SUCCESSFULLY SUBMITTED SUCCESSFULLY SUBMITTED
Line 412: Line 338:
  
 You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches. You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.
 +
 +What I will be looking for:
 +
 +<code>
 +78:pnc1:final tally of results (78/78)
 +*:pnc1:submit all programs correctly named using submit tool [3/3]
 +*:pnc1:primeodds.c no negative compiler messages [2/2]
 +*:pnc1:primeodds.c implements only specified algorithm [4/4]
 +*:pnc1:primeodds.c adequate indentation and comments [3/3]
 +*:pnc1:primeodds.c output conforms to specifications [3/3]
 +*:pnc1:primeodds.c primerun runtime tests succeed [3/3]
 +*:pnc1:primesqrt.c no negative compiler messages [2/2]
 +*:pnc1:primesqrt.c implements only specified algorithm [4/4]
 +*:pnc1:primesqrt.c adequate indentation and comments [3/3]
 +*:pnc1:primesqrt.c output conforms to specifications [3/3]
 +*:pnc1:primesqrt.c primerun runtime tests succeed [3/3]
 +*:pnc1:primesqrtodds.c no negative compiler messages [2/2]
 +*:pnc1:primesqrtodds.c implements only specified algorithm [4/4]
 +*:pnc1:primesqrtodds.c adequate indentation and comments [3/3]
 +*:pnc1:primesqrtodds.c output conforms to specifications [3/3]
 +*:pnc1:primesqrtodds.c primerun runtime tests succeed [3/3]
 +*:pnc1:primesqrtopt.c no negative compiler messages [2/2]
 +*:pnc1:primesqrtopt.c implements only specified algorithm [4/4]
 +*:pnc1:primesqrtopt.c adequate indentation and comments [3/3]
 +*:pnc1:primesqrtopt.c output conforms to specifications [3/3]
 +*:pnc1:primesqrtopt.c primerun runtime tests succeed [3/3]
 +*:pnc1:primesqrtoptodds.c no negative compiler messages [2/2]
 +*:pnc1:primesqrtoptodds.c implements only specified algorithm [4/4]
 +*:pnc1:primesqrtoptodds.c adequate indentation and comments [3/3]
 +*:pnc1:primesqrtoptodds.c output conforms to specifications [3/3]
 +*:pnc1:primesqrtoptodds.c primerun runtime tests succeed [3/3]
 +</code>
haas/spring2017/sysprog/projects/pnc1.1456680577.txt.gz · Last modified: 2016/02/28 17:29 by 127.0.0.1