User Tools

Site Tools


haas:fall2017:discrete:projects:pnc0

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:fall2017:discrete:projects:pnc0 [2017/07/13 14:26] wedgehaas:fall2017:discrete:projects:pnc0 [2017/10/15 21:11] (current) – [Programs] wedge
Line 3: Line 3:
 <WRAP><fs 150%>CSCS2330 Discrete Structures</fs></WRAP> <WRAP><fs 150%>CSCS2330 Discrete Structures</fs></WRAP>
 </WRAP> </WRAP>
- 
-~~TOC~~ 
  
 ======Project: ALGORITHMS - PRIME NUMBER CALCULATION (pnc0)====== ======Project: ALGORITHMS - PRIME NUMBER CALCULATION (pnc0)======
Line 15: Line 13:
 ====Revision List==== ====Revision List====
   * revision 0: initial release (20170712)   * revision 0: initial release (20170712)
 +    * 0.1: there were some stray mentions of "cprog" class desig and "C/C++ Programming" (I copied and then rewrote most of this document from a cprog project), which I've corrected to reflect discrete/Discrete Structures as appropriate (20170713)
 +    * 0.2: added an additional requirement to implementation constraints: you **must** use meaningful variable names (20170713)
 +    * 0.3: added new check/verify options to Makefile menu; checkqty, checkrange, verifyqty, verifyrange, verifyall. These will allow you to check to see if your programs are functioning within project specifications (20170714)
 +    * 0.4: added further explanation to "sqrt()-less square root approximation" section below, to clarify what I am asking for (20170815)
 +    * 0.5: for increased readability, I've moved the information on the various "verifyall" tests below the sample output closer to the bottom of the project, and gave it its own unique section (20170830)
   * revision #: <description> (DATESTRING)   * revision #: <description> (DATESTRING)
  
Line 92: Line 95:
   * you know the starting value and the terminating condition, so you have a clear starting and ending point to work with.   * you know the starting value and the terminating condition, so you have a clear starting and ending point to work with.
   * I want you to use two **DIFFERENT** kind of loops in your programs. If you use a **for()** loop in your outer loop, I want you to use a **while()** or **do-while()** loop in your inner loop (and whatever combination you end up with).   * I want you to use two **DIFFERENT** kind of loops in your programs. If you use a **for()** loop in your outer loop, I want you to use a **while()** or **do-while()** loop in your inner loop (and whatever combination you end up with).
 +  * I do **NOT** want to see ambiguous, one-letter variables used in your implementation(s). Please use //meaningful// variable names.
 +    * Some good examples of variable names would be:
 +      * **number**: the number being tested
 +      * **factor**: the value being divided into number to test for primality
 +      * **step**: the rate by which some variable is changing
 +      * **qty**: the count of the current tally of primes
 +      * **max**: the maximum count we seek
 +      * **start**: a value we are starting at
 +      * **lower**: a lower bound
 +      * **upper**: an upper bound
 +      * see how much more readable and meaningful these are, especially as compared to **a**, **i**, **n**, **x**? You may even find it helps with debugging and understanding your code better.
   * let the loops drive the overall process. Identify prime/composite status separate from loop terminating conditions.   * let the loops drive the overall process. Identify prime/composite status separate from loop terminating conditions.
     * and remember, the baseline brute force algorithm (**primereg**) may well identify a value as composite, but won't terminate the loop.     * and remember, the baseline brute force algorithm (**primereg**) may well identify a value as composite, but won't terminate the loop.
-  * your timing should start before the loop (just AFTER argument processing), and terminate immediately following the terminating newline outside the loops. +  * your timing should start before the loop (just AFTER argument processing), and terminate immediately following the terminating output newline outside the loops. 
 +  * you may **NOT** split **qty** and **range** functionality into two separate code blocks (ie have two sets of two loops). Only the one set as indicated. 
 =====prime algorithm optimizations===== =====prime algorithm optimizations=====
 To give us a decent appreciation of the subtleties of algorithm development in a theme of programs, I have identified the following optimizations that we will be implementing. To give us a decent appreciation of the subtleties of algorithm development in a theme of programs, I have identified the following optimizations that we will be implementing.
Line 118: Line 132:
 That is, if your program to implement is **primerego**, that means you are ONLY to implement the brute force algorithm and odds-only checking. **NO** break on composite, **NO** sqrt() trick, etc. We are establishing separate data points for analytical comparison. That is, if your program to implement is **primerego**, that means you are ONLY to implement the brute force algorithm and odds-only checking. **NO** break on composite, **NO** sqrt() trick, etc. We are establishing separate data points for analytical comparison.
  
-Some of these optimizations can co-exist easily (break + map, odd + sqrt()), others are conditionally compatible (map + odd can coexist in a certain form), while others are mutually exclusive (sqrt() and approximated square root conflict). So there are definitely a few combinations that are possible using this scheme.+Some of these optimizations can co-exist easily (break + map, odd + sqrt()), others are partially compatible (map + odd can coexist in a certain form), while others are mutually exclusive (sqrt() and approximated square root conflict). So there are definitely a few combinations that are possible using this scheme.
  
 Here are the variants you'll be implementing for this project: Here are the variants you'll be implementing for this project:
Line 145: Line 159:
 This optimization employs the approximated square root trick (**NOT** utilizing an existing square root function, but using simpler logic you implement to approximate the square root point). This optimization employs the approximated square root trick (**NOT** utilizing an existing square root function, but using simpler logic you implement to approximate the square root point).
  
 +===Further explanation===
 +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.
 +
 +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:
 +
 +<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>
 +
 +Or, if perhaps we instead order by square root value:
 +
 +<cli>
 +lab46:~$ oldsqrt=$(echo "sqrt(2)" | bc -q); for ((i=2; i<49; i++)); do newsqrt=$(echo "sqrt($i)" | bc -q); if [ "${newsqrt}" -ne "${oldsqrt}" ]; then echo; fi; printf "[%3d] %2d " "${i}" "${newsqrt}"; oldsqrt="${newsqrt}"; 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
 +</cli>
 +
 +We see that the square root of 36 is 6, but so is the square root of 37, 38, 39... etc. up until we hit 49 (where the whole number square root increments to 7).
 +
 +Therefore, if we were checking 42 to be prime, we'd only have to check up to 6.
 +
 +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 checking, we know to continue.
 +
 +There are some important lessons at play here:
 +
 +  * approximation can be powerful
 +  * approximation can result in a simpler algorithm, improving runtime
 +    * **sqrt()** is more complex than you may be aware, not to mention it is in a function. By avoiding that function call, we eliminate some overhead, and that can make a difference in runtime performance.
 +
 +Depending on how you implement this and the original sqrt() algorithms, this version may have a noticeable performance difference. If, on the other hand, you were really optimal in both implementations, the performance difference may be narrower (if negligible).
 + 
 ====primeregbm==== ====primeregbm====
 To get a taste for combining optimizations, you'll also implement a variant that incorporates both the **break** AND the **map** optimizations. To get a taste for combining optimizations, you'll also implement a variant that incorporates both the **break** AND the **map** optimizations.
Line 164: Line 228:
 It is your task to write the following prime number variants: It is your task to write the following prime number variants:
  
-  **primereg.c**: our baseline (does JUST the process, no optimizations) +  **primereg.c**: our baseline (does JUST the process, no optimizations) 
-  **primeregb.c**: tests specifically the break optimization +  **primeregb.c**: tests specifically the break optimization 
-  **primeregm.c**: tests specifically the map traversal +  **primeregm.c**: tests specifically the map traversal 
-  **primerego.c**: tests specifically the odd traversal +  **primerego.c**: tests specifically the odd traversal 
-  **primeregs.c**: tests specifically the square root trick (using sqrt()) +  **primeregs.c**: tests specifically the square root trick (using sqrt()) 
-  **primerega.c**: tests specifically the square root trick by approximating square root +  **primerega.c**: tests specifically the square root trick by approximating square root 
-  **primeregbm.c**: tests the break and map optimizations (together) +  **primeregbm.c**: tests the break and map optimizations (together) 
-  **primeregbo.c**: tests the break and odd optimizations (together) +  **primeregbo.c**: tests the break and odd optimizations (together) 
-  **primeregbs.c**: tests the break and sqrt() optimizations (together) +  **primeregbs.c**: tests the break and sqrt() optimizations (together) 
-  **primeregba.c**: tests the break and approximated square root optimizations (together)+  **primeregba.c**: tests the break and approximated square root optimizations (together)
  
 ====Program Specifications==== ====Program Specifications====
Line 257: Line 321:
 **                                                                    ** **                                                                    **
 ** make debug               - build everything with debug symbols     ** ** make debug               - build everything with debug symbols     **
-** make check               - check implementation for validity       **+** make checkqty            - runtime evaluation for qty              ** 
 +** make checkrange          - runtime evaluation for range            ** 
 +**                                                                    ** 
 +** make verifyqty           check implementation for qty validity   ** 
 +** make verifyrange         - check implementation for range validity ** 
 +** make verifyall           - verify project specifications           **
 **                                                                    ** **                                                                    **
 ** make save                - create a backup archive                 ** ** make save                - create a backup archive                 **
Line 282: Line 351:
   * **make submit**: archive and submit your project   * **make submit**: archive and submit your project
  
-Just another "nice thingwe deserve.+The various "checkoptions do a runtime performance grid, allowing you to compare timings between your implementations.
  
 +The various "verify" options do more aggressive checks, helping to ensure your project falls within stated project specifications.
 +
 +Just another "nice thing" we deserve.
 =====Command-Line Arguments===== =====Command-Line Arguments=====
-To automate our comparisons, we will be making use of command-line arguments in our programs. As we have yet to really get into arrays, I will provide you some code that you can use that will allow you to utilize them for the purposes of this project.+To automate our comparisons, we will be making use of command-line arguments in our programs.
  
 ====header files==== ====header files====
Line 303: Line 375:
 int main(int argc, char **argv) int main(int argc, char **argv)
 </code> </code>
 +
 +There are two very important variables involved here (the types are actually what are important, the names given to the variables are actually quite, variable; you may see other references refer to them as things like "ac" and "av"):
 +
 +  * int argc: the count (an integer) of tokens given on the command line (program name + arguments)
 +  * <nowiki>char **argv</nowiki>: an array of strings (technically an array of an array of char) that contains "strings" of the various tokens provided on the command-line.
  
 The arguments are accessible via the argv array, in the order they were specified: The arguments are accessible via the argv array, in the order they were specified:
Line 311: Line 388:
   * argv[3]: conditionally optional; represents lower bound   * argv[3]: conditionally optional; represents lower bound
   * argv[4]: conditionally optional; represents upper bound   * argv[4]: conditionally optional; represents upper bound
 +
 +Additionally, let's not forget the **argc** variable, an integer, which contains a count of arguments (argc == argument count). If we provided argv[0] through argv[4], argc would contain a 5.
 +
 +===example===
 +For example, if we were to execute the **primereg** program:
 +
 +<cli>
 +lab46:~/src/discrete/pnc0$ ./primereg 128 1 2 2048
 +</cli>
 +
 +We'd have:
 +
 +  * <nowiki>argv[0]</nowiki>: "./primereg" 
 +  * <nowiki>argv[1]</nowiki>: "128" (note, NOT the scalar integer 128, but a string) 
 +  * <nowiki>argv[2]</nowiki>: "1"
 +  * <nowiki>argv[3]</nowiki>: "2" 
 +  * <nowiki>argv[4]</nowiki>: "2048" 
 +
 +and let's not forget:
 +
 +  * argc: 5   (there are 5 things, argv indexes 0, 1, 2, 3, and 4)
 +
 +With the conditionally optional arguments as part of the program spec, for a valid execution of the program, argc could be a value anywhere from 3 to 5.
  
 ====Simple argument checks==== ====Simple argument checks====
Line 511: Line 611:
  
 <cli> <cli>
-lab46:~/src/DESIG/pnc0$ ./primereg 24 1+lab46:~/src/discrete/pnc0$ ./primereg 24 1
 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.0001   0.0001
-lab46:~/src/DESIG/pnc0$ +lab46:~/src/discrete/pnc0$ 
 </cli> </cli>
  
Line 523: Line 623:
  
 <cli> <cli>
-lab46:~/src/DESIG/pnc0$ ./primerego 32 1 0 +lab46:~/src/discrete/pnc0$ ./primerego 32 1 0 
-./primebrute: invalid lower bound +./primerego: invalid lower bound 
-lab46:~/src/DESIG/pnc0$ +lab46:~/src/discrete/pnc0$ 
 </cli> </cli>
  
Line 534: Line 634:
  
 <cli> <cli>
-lab46:~/src/cprog/pnc0$ ./primeregs 128 1 7 23+lab46:~/src/discrete/pnc0$ ./primeregs 128 1 7 23
 7 11 13 17 19 23 7 11 13 17 19 23
   0.0001   0.0001
-lab46:~/src/cprog/pnc0$ +lab46:~/src/discrete/pnc0$ 
 </cli> </cli>
  
Line 543: Line 643:
  
 =====Check Results===== =====Check Results=====
-If you'd like to compare your implementations, I rigged up a Makefile checking rule called "**make check**" which you can run to get a nice side-by-side comparison of your implementations.+If you'd like to compare your implementations, I rigged up a Makefile checking rule called "**make checkqty**" and "**make checkrange**" which you can run to get a nice side-by-side runtime comparisons of your implementations.
  
 In order to work, you **MUST** be in the directory where your pnc0 binaries reside, and must be named as such (which occurs if you ran **make** to compile them). In order to work, you **MUST** be in the directory where your pnc0 binaries reside, and must be named as such (which occurs if you ran **make** to compile them).
  
 +====check qty====
 For instance (running on my implementation of the pnc0 programs, some output omitted to keep the surprise alive): For instance (running on my implementation of the pnc0 programs, some output omitted to keep the surprise alive):
  
 <cli> <cli>
-lab46:~/src/discrete/pnc0$ make check+lab46:~/src/discrete/pnc0$ make checkqty
 ========================================================================================= =========================================================================================
       qty     reg    regm    rego    regb   regbm   regbo    regs    rega   regbs   regba       qty     reg    regm    rego    regb   regbm   regbo    regs    rega   regbs   regba
Line 562: Line 663:
 ... ...
    262144  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------    262144  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------
 +=========================================================================================
 + verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +=========================================================================================
 +lab46:~/src/discrete/pnc0$ 
 +</cli>
 +
 +====check range====
 +Or check range runtimes:
 +
 +<cli>
 +lab46:~/src/discrete/pnc0$ make checkrange
 +=========================================================================================
 +    range     reg    regm    rego    regb   regbm   regbo    regs    rega   regbs   regba
 +=========================================================================================
 +       32  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001
 +       64  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001
 +      128  0.0002  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001
 +      256  0.0004  0.0002  0.0002  0.0001  0.0002  0.0002  0.0002  0.0002  0.0001  0.0001
 +      512  0.0015  0.0006  0.0005  0.0003  0.0003  0.0002  0.0002  0.0002  0.0002  0.0002
 +     1024  0.0053  0.0018  0.0014  0.0009  0.0010  0.0005  0.0005  0.0005  0.0002  0.0002
 +     2048  0.0191  0.0063  0.0049  0.0028  0.0027  0.0015  0.0011  0.0011  0.0004  0.0003
 +     4096  0.0709  0.0232  0.0177  0.0094  0.0091  0.0048  0.0029  0.0030  0.0008  0.0008
 +     8192  0.2712  0.0887  0.0672  0.0322  0.0315  0.0163  0.0078  0.0077  0.0019  0.0016
 +...
 +  2097152  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------
 ========================================================================================= =========================================================================================
  verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK  verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
Line 572: Line 698:
 If you don't feel like waiting, simply hit **CTRL-c** (maybe a couple of times) and the script will terminate. If you don't feel like waiting, simply hit **CTRL-c** (maybe a couple of times) and the script will terminate.
  
 +====Verification====
 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 see "MISMATCH".
  
 +====Full Verification Compliance====
 +There's also a more rigorous verification step you can take, which runs your programs through a series to tests to see if they conform to project specifications:
 +
 +<cli>
 +lab46:~/src/discrete/pnc0$ make verifyall
 +=========================================================================================
 +              reg    regm    rego    regb   regbm   regbo    regs    rega   regbs   regba
 +=========================================================================================
 + qtynorm:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + qtypart:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + rngnorm:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + rngpart:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +    coop:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +   coop2:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +   coop3:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +  noargs:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + invargs:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +  invqty:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + invnary:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +  invlow:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + invhigh:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +=========================================================================================
 +lab46:~/src/discrete/pnc0$ 
 +</cli>
 +
 +===verifyall tests===
 +The "**verifyall**" is an industrial grade verification; there are 13 specific tests performed, they are:
 +  * **qtynorm**: a normal quantity run (2-max)
 +    * **./primealg 2048 1 2 0**
 +  * **qtypart**: an offset quantity run (24-max)
 +    * **./primealg 2048 1 24 0**
 +  * **rngnorm**: a normal range run (2-max)
 +    * **./primealg 0 1 2 2048**
 +  * **rngpart**: an offset range run (24-max)
 +    * **./primealg 0 1 24 2048**
 +  * **coop**: both qty and upper bounds set (q: 2048, ub: 8192)
 +    * **./primealg 2048 1 2 8192**
 +  * **coop2**: both qty and upper bounds set (q: 512, ub: 8192)
 +    * **./primealg 512 1 2 8192**
 +  * **coop3**: both qty and upper bounds set, offset start (24-max, q: 2048, ub: 8192)
 +    * **./primealg 2048 1 24 8192**
 +  * **noargs**:  no arguments provided on command line (invokes error message)
 +    * **./primealg**
 +  * **invargs**: insufficient number of arguments provided (invokes error)
 +    * **./primealg 128**
 +  * **invqty**: invalid value for quantity argument given (invokes error)
 +    * **./primealg -2 1**
 +  * **invnary**: invalid value given for n-ary (invokes error)
 +    * **./primealg 128 2**
 +  * **invlow**: invalid value given for lower bound (invokes error)
 +    * **./primealg 128 1 1**
 +  * **invhigh**: invalid value given for upper bound (invokes error)
 +    * **./primealg 128 1 32 24**
 +
 +If you'd actually to see the output your program's output is being tested against, that can be found in the **/usr/local/etc** directory in the file **primeTEST**, where "TEST" is the name of the verify test mentioned above.
 +
 +For example, if you wanted to see the intended output of the **invnary** test, that would be found in:
 +
 +  * **/usr/local/etc/primeinvnary**
 +
 +You could easily run your program with the stated arguments for the test, then use **cat** to display the test results and do a visual comparison.
 +====In general====
 Analyze the times you see... do they make sense, especially when comparing the algorithm used and the quantity being processed? These are related to some very important core Computer Science considerations we need to be increasingly mindful of as we design our programs and implement our solutions. Algorithmic complexity and algorithmic efficiency will be common themes in all we do. Analyze the times you see... do they make sense, especially when comparing the algorithm used and the quantity being processed? These are related to some very important core Computer Science considerations we need to be increasingly mindful of as we design our programs and implement our solutions. Algorithmic complexity and algorithmic efficiency will be common themes in all we do.
  
Line 633: Line 822:
 You should get that final "SUCCESSFULLY SUBMITTED" with no error messages occurring. If not, check for typos and or locational mismatches. You should get that final "SUCCESSFULLY SUBMITTED" with no error messages occurring. If not, check for typos and or locational mismatches.
  
-What I will be looking for:+====Evaluation Criteria==== 
 +Grand total points: 
 + 
 +<code> 
 +390:pnc0:final tally of results (390/390) 
 +</code> 
 + 
 +What I will be looking for (for each file):
  
 <code> <code>
-260:pnc0:final tally of results (260/260) +*:pnc0:primeALGO.c compiles cleanly, no compiler messages [3/3
-*:pnc0:primereg.c performs proper argument checking [2/2] +*:pnc0:primeALGO.c implements only specified algorithm [6/6] 
-*:pnc0:primereg.c no negative compiler messages [2/2+*:pnc0:primeALGO.c consistent indentation throughout code [3/3
-*:pnc0:primereg.c implements only specified algorithm [6/6] +*:pnc0:primeALGO.c relevant comments throughout code [3/3
-*:pnc0:primereg.c consistent indentation and comments [4/4+*:pnc0:primeALGO.c code conforms to project specifications [3/3
-*:pnc0:primereg.c data and output conform to specifications [6/6] +*:pnc0:primeALGO.c runtime output conforms to specifications [4/4] 
-*:pnc0:primereg.c make check runtime tests succeed [6/6] +*:pnc0:primeALGO.c make checkqty test times within reason [2/2] 
-*:pnc0:primeregb.c performs proper argument checking [2/2] +*:pnc0:primeALGO.c make checkrange test times within reason [2/2] 
-*:pnc0:primeregb.c no negative compiler messages [2/2] +*:pnc0:primeALGO.c make verifyall tests succeed [13/13]
-*:pnc0:primeregb.c implements only specified algorithm [6/6] +
-*:pnc0:primeregb.c consistent indentation and comments [4/4+
-*:pnc0:primeregb.c data and output conform to specifications [6/6+
-*:pnc0:primeregb.c make check runtime tests succeed [6/6] +
-*:pnc0:primeregm.c performs proper argument checking [2/2] +
-*:pnc0:primeregm.c no negative compiler messages [2/2] +
-*:pnc0:primeregm.c implements only specified algorithm [6/6] +
-*:pnc0:primeregm.c consistent indentation and comments [4/4] +
-*:pnc0:primeregm.c data and output conform to specifications [6/6] +
-*:pnc0:primeregm.c make check runtime tests succeed [6/6] +
-*:pnc0:primerego.c performs proper argument checking [2/2] +
-*:pnc0:primerego.c no negative compiler messages [2/2] +
-*:pnc0:primerego.c implements only specified algorithm [6/6] +
-*:pnc0:primerego.c consistent indentation and comments [4/4] +
-*:pnc0:primerego.c data and output conform to specifications [6/6] +
-*:pnc0:primerego.c make check runtime tests succeed [6/6] +
-*:pnc0:primeregs.c performs proper argument checking [2/2] +
-*:pnc0:primeregs.c no negative compiler messages [2/2] +
-*:pnc0:primeregs.c implements only specified algorithm [6/6] +
-*:pnc0:primeregs.c consistent indentation and comments [4/4] +
-*:pnc0:primeregs.c data and output conform to specifications [6/6] +
-*:pnc0:primeregs.c make check runtime tests succeed [6/6] +
-*:pnc0:primerega.c performs proper argument checking [2/2] +
-*:pnc0:primerega.c no negative compiler messages [2/2] +
-*:pnc0:primerega.c implements only specified algorithm [6/6] +
-*:pnc0:primerega.c consistent indentation and comments [4/4] +
-*:pnc0:primerega.c data and output conform to specifications [6/6] +
-*:pnc0:primerega.c make check runtime tests succeed [6/6] +
-*:pnc0:primeregbm.c performs proper argument checking [2/2] +
-*:pnc0:primeregbm.c no negative compiler messages [2/2] +
-*:pnc0:primeregbm.c implements only specified algorithm [6/6] +
-*:pnc0:primeregbm.c consistent indentation and comments [4/4] +
-*:pnc0:primeregbm.c data and output conform to specifications [6/6] +
-*:pnc0:primeregbm.c make check runtime tests succeed [6/6] +
-*:pnc0:primeregbo.c performs proper argument checking [2/2] +
-*:pnc0:primeregbo.c no negative compiler messages [2/2] +
-*:pnc0:primeregbo.c implements only specified algorithm [6/6] +
-*:pnc0:primeregbo.c consistent indentation and comments [4/4] +
-*:pnc0:primeregbo.c data and output conform to specifications [6/6] +
-*:pnc0:primeregbo.c make check runtime tests succeed [6/6] +
-*:pnc0:primeregbs.c performs proper argument checking [2/2] +
-*:pnc0:primeregbs.c no negative compiler messages [2/2] +
-*:pnc0:primeregbs.c implements only specified algorithm [6/6] +
-*:pnc0:primeregbs.c consistent indentation and comments [4/4] +
-*:pnc0:primeregbs.c data and output conform to specifications [6/6] +
-*:pnc0:primeregbs.c make check runtime tests succeed [6/6] +
-*:pnc0:primeregba.c performs proper argument checking [2/2] +
-*:pnc0:primeregba.c no negative compiler messages [2/2] +
-*:pnc0:primeregba.c implements only specified algorithm [6/6] +
-*:pnc0:primeregba.c consistent indentation and comments [4/4] +
-*:pnc0:primeregba.c data and output conform to specifications [6/6] +
-*:pnc0:primeregba.c make check runtime tests succeed [6/6]+
 </code> </code>
  
 +As the optimizations improve upon others, some evaluations will be based upon differences between a baseline (in some cases, primereg) and the optimization.
haas/fall2017/discrete/projects/pnc0.1499956008.txt.gz · Last modified: 2017/07/13 14:26 by wedge