User Tools

Site Tools


haas:fall2017:discrete:projects:pnc1

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:pnc1 [2017/07/13 15:46] – [Submission] wedgehaas:fall2017:discrete:projects:pnc1 [2017/10/15 21:09] (current) wedge
Line 4: Line 4:
 </WRAP> </WRAP>
  
-~~TOC~~ +======Project: ALGORITHM OPTIMIZATION - PRIME NUMBER COMPUTATION (pnc1)======
- +
-======Project: ALGORITHMS - PRIME NUMBER CALCULATION (pnc1)======+
  
 =====Errata===== =====Errata=====
Line 14: Line 12:
  
 ====Revision List==== ====Revision List====
-  * revision 0: initial release (20170712)+
   * revision #: <description> (DATESTRING)   * revision #: <description> (DATESTRING)
  
Line 20: Line 18:
  
 =====Objective===== =====Objective=====
-To continue applying your skills in the implementation of more detailed combinations of optimizations to our "brute force" prime number calculating algorithm.+To continue our exploration of algorithms and optimizations applied to them, through further work on the prime number computation programs started in pnc0.
  
 =====Background===== =====Background=====
Line 36: Line 34:
 Your task for this project is to implement a prime number program using the straightforward, unoptimized brute-force algorithm, which determines the primality of a number in a "trial by division" approach. Your task for this project is to implement a prime number program using the straightforward, unoptimized brute-force algorithm, which determines the primality of a number in a "trial by division" approach.
  
-=====Review of main algorithm: brute force (primereg)===== +=====Main algorithm: brute force (primereg)===== 
-The brute force approach is the simplest to implementalthough it does come at some cost, which hopefully you have realized by now having completed **pnc0**.+The brute force approach is the simplest to implement (although at some cost).  
 + 
 +As we will be looking to do some time/performance analysis and comparisonsit is often good to have a baseline. This program will be it.
  
-To review the process of computing the primality of a number, we simply attempt to evenly divide all the potential factors between 2 and one less than the number into the number in question. If any one of them divides evenly, the number is **NOT** prime, but instead classified as composite (meaning made up of various parts, in this case those "parts" are factor pairs).+To perform the process of computing the primality of a number, we simply attempt to evenly divide all the values between 2 and one less than the number in question. If any one of them divides evenly, the number is **NOT** prime, but instead composite.
  
-Checking the **remainder** of an integer division indicates whether or not a division was clean (having 0 remainder indicates such a state).+Checking the **remainder** of division indicates whether or not a division was clean (having 0 remainder indicates such a state).
  
-For example, with the number 11:+For example, the number 11:
  
 <code> <code>
Line 78: Line 78:
  
 Because, during our range of testing every value from 2-118, we find that 7 evenly divides into 119, it failed the test: 119 is **not** prime, but is instead a composite number. Because, during our range of testing every value from 2-118, we find that 7 evenly divides into 119, it failed the test: 119 is **not** prime, but is instead a composite number.
 +
 +Please NOTE: Even once a number is identified as composite, your **primereg** MUST **CONTINUE** evaluating the remainder of the values (up to 119-1, or 118). It might seem pointless (and it is for a production program), but I want you to see the performance implications this creates.
  
 ====algorithm==== ====algorithm====
Line 100: Line 102:
       * 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.       * 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.
-  be mindful of the particular combination of optimizations you are implementing+    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=====
Line 124: Line 127:
  
 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.
- 
-On the other hand, if your program to implement is **primeregbms**, that means your are implementing the "break on composite", "map traversal", and "sqrt() trick" optimizations. 
  
 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. 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.
  
-For this project, you'll be implementing the remaining (14combinations of optimizationsgiving us a full set of programs to analyze performance.+=====A note on comments===== 
 +Something I noticed (and have historically noticed) in relation to comments that I'd like to point out: 
 + 
 +Comments should be describing what is going on in your code. 
 + 
 +With projects like this, often relying on a common base, comments become even more important, as they allow me to see specifically what is changed or unique about one variant over the other. 
 + 
 +As such, when evaluating the project, I will be looking for pertinent comments specifically covering the how or why of the particular change unique to the variant in question. 
 + 
 +And notice I said the "how" and/or "why". NOT the "what". I see all the time vague comments like "<nowiki>// doing the sqrt() optimization</nowiki>"... but: 
 + 
 +  * WHY is that important to the process? 
 +  * HOW does it impact the efficiency of the algorithm? 
 + 
 +These are things I'd like to see addressed in your commentsas there were some cases where the WHAT was claimed, yet what actually followed had little resemblance (if any) on the requirements for that variant. 
 + 
 +Just like if you can't do it by hand you have no business trying to code it- if you cannot adequately explain the WHY and HOW, you similarly will have trouble.
  
 =====Programs===== =====Programs=====
 +It is your task to write the following prime number variants:
  
-Those variants to implement are: 
   * the remainder of the viable double optimization combinations:   * the remainder of the viable double optimization combinations:
     * **primeregmo.c**: map + odd traversal optimizations     * **primeregmo.c**: map + odd traversal optimizations
Line 151: Line 168:
     * **primeregbmos.c**: break + map + odd + sqrt() trick     * **primeregbmos.c**: break + map + odd + sqrt() trick
     * **primeregbmoa.c**: break + map + odd + approximated square root trick     * **primeregbmoa.c**: break + map + odd + approximated square root trick
- 
-You should, if you haven't already, started to notice commonalities and patterns between the implementations. This should help you realize that although there are a number of distinct programs being produced, the actual development effort is realized to be far less. 
  
 ====Program Specifications==== ====Program Specifications====
Line 183: Line 198:
     * each program is to have no fewer and no more than 2 loops in this prime processing section.     * each program is to have no fewer and no more than 2 loops in this prime processing section.
     * in each program, you are not allowed to use a given loop type (for(), while(), do-while()) more than once!     * in each program, you are not allowed to use a given loop type (for(), while(), do-while()) more than once!
-    * utilize meaningful variable names (I do not want to see things like **a**, **i**, **n**, **x** being used which have no meaningful bearing on the role they serve). 
   * display identified primes (space-separated) to a file pointer called **primelist**   * display identified primes (space-separated) to a file pointer called **primelist**
   * stop your stopwatch immediately following your prime processing loops (and terminating newline display to **primelist**). Calculate the time that has transpired (ending time minus starting time).   * stop your stopwatch immediately following your prime processing loops (and terminating newline display to **primelist**). Calculate the time that has transpired (ending time minus starting time).
Line 195: Line 209:
  
 To "grab" it: To "grab" it:
- 
-NOTE: You will **NEED** to specify the semester as indicated as the semester in question has not yet started. 
  
 <cli> <cli>
-lab46:~/src/discrete$ SEMESTER=fall2017 grabit discrete pnc1 +lab46:~/src/discrete$ grabit discrete pnc1 
-make: Entering directory '/var/public/fall2017/discrete/pnc1' +make: Entering directory '/var/public/SEMESTER/discrete/pnc1' 
-Commencing copy process for fall2017 discrete project pnc1:+Commencing copy process for SEMESTER discrete project pnc1:
  -> Creating project pnc1 directory tree           ... OK  -> Creating project pnc1 directory tree           ... OK
  -> Copying pnc1 project files                     ... OK  -> Copying pnc1 project files                     ... OK
Line 209: Line 221:
 *** Copy COMPLETE! You may now go to the '/home/USER/src/discrete/pnc1' directory *** *** Copy COMPLETE! You may now go to the '/home/USER/src/discrete/pnc1' directory ***
  
-make: Leaving directory '/var/public/fall2017/discrete/pnc1'+make: Leaving directory '/var/public/SEMESTER/discrete/pnc1'
 lab46:~/src/discrete/ lab46:~/src/discrete/
 lab46:~/src/discrete$ cd pnc1 lab46:~/src/discrete$ cd pnc1
-lab46:~/src/discrete/pnc0+lab46:~/src/discrete/pnc1
 </cli> </cli>
  
Line 231: Line 243:
 ** make                     - build everything                        ** ** make                     - build everything                        **
 ** make showerrors          - display compiler warnings/errors        ** ** make showerrors          - display compiler warnings/errors        **
-**                                                                    ** 
 ** 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 link                - link in previous prime programs         ** ** make link                - link in previous prime programs         **
Line 254: Line 270:
  
   * **make**: compile everything   * **make**: compile everything
-    * any **warnings** or **errors** generated by the compiler will go into a file in the base directory of the project in a file called **errors**; you can **cat** it to view the information.+    * any **warnings** or **errors** generated by the compiler will go into a file in the base directory of pnc0 in a file called **errors**; you can **cat** it to view the information.
   * **make debug**: compile everything with debug support   * **make debug**: compile everything with debug support
     * any **warnings** or **errors** generated by the compiler will be displayed to the screen as the programs compile.     * any **warnings** or **errors** generated by the compiler will be displayed to the screen as the programs compile.
Line 260: Line 276:
   * **make save**: make a backup of your current work   * **make save**: make a backup of your current work
   * **make submit**: archive and submit your project   * **make submit**: archive and submit your project
 +
 +The various "check" options 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. 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 282: Line 302:
 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 290: Line 315:
   * 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 **primeregbms** program:
 +
 +<cli>
 +lab46:~/src/discrete/pnc1$ ./primeregbms 128 1 2 2048
 +</cli>
 +
 +We'd have:
 +
 +  * <nowiki>argv[0]</nowiki>: "./primeregbms" 
 +  * <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 378: Line 426:
  
 <cli> <cli>
-lab46:~/src/discrete/pnc1$ ./primeregmo 24 1+lab46:~/src/discrete/pnc1$ ./primeregoa 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
Line 390: Line 438:
  
 <cli> <cli>
-lab46:~/src/discrete/pnc1$ ./primeregos 32 1 0 +lab46:~/src/discrete/pnc1$ ./primeregbmo 32 1 0 
-./primeregos: invalid lower bound+./primeregbmo: invalid lower bound
 lab46:~/src/discrete/pnc1$  lab46:~/src/discrete/pnc1$ 
 </cli> </cli>
Line 401: Line 449:
  
 <cli> <cli>
-lab46:~/src/cprog/pnc1$ ./primeregbms 128 1 7 23+lab46:~/src/discrete/pnc1$ ./primeregos 128 1 7 23
 7 11 13 17 19 23 7 11 13 17 19 23
   0.0001   0.0001
-lab46:~/src/cprog/pnc1$ +lab46:~/src/discrete/pnc1$ 
 </cli> </cli>
  
Line 410: Line 458:
  
 =====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).
  
-For instance (running on my implementation of the pnc0 programs, some output omitted to keep the surprise alive):+====check qty==== 
 +For instance (running on my implementation of the pnc1 programs, some output omitted to keep the surprise alive):
  
 <cli> <cli>
-lab46:~/src/discrete/pnc1$ make check +lab46:~/src/discrete/pnc1$ make checkqty 
-========================================================================================= +========================================================================================================================= 
-      qty     reg    regm    rego    regb   regbm   regbo    regs    rega   regbs   regba +      qty   regmo  regbmo   regms   regma   regos   regoa  regmos  regmoa  regbms  regbma  regbos regbmos  regboa regbmoa 
-========================================================================================= +========================================================================================================================= 
-       32  0.0002  0.0001  0.0001  0.0002  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001 +       32  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001 
-       64  0.0006  0.0003  0.0002  0.0002  0.0002  0.0001  0.0001  0.0002  0.0002  0.0001 +       64  0.0002  0.0002  0.0001  0.0002  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001 
-      128  0.0028  0.0010  0.0008  0.0006  0.0006  0.0003  0.0004  0.0003  0.0002  0.0002 +      128  0.0005  0.0003  0.0002  0.0001  0.0002  0.0002  0.0002  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001 
-      256  0.0123  0.0041  0.0031  0.0020  0.0019  0.0010  0.0009  0.0008  0.0004  0.0003 +      256  0.0022  0.0011  0.0003  0.0003  0.0003  0.0004  0.0003  0.0003  0.0003  0.0003  0.0003  0.0002  0.0002  0.0002 
-      512  0.0574  0.0188  0.0144  0.0077  0.0077  0.0040  0.0025  0.0026  0.0008  0.0007 +      512  0.0096  0.0039  0.0009  0.0008  0.0009  0.0008  0.0006  0.0006  0.0006  0.0006  0.0005  0.0004  0.0004  0.0004 
-     1024  0.2690  0.0880  0.0665  0.0320  0.0312  0.0161  0.0077  0.0080  0.0019  0.0016+     1024  0.0444  0.0159  0.0025  0.0025  0.0023  0.0021  0.0016  0.0015  0.0015  0.0014  0.0011  0.0010  0.0010  0.0009 
 +     2048  0.2061  0.0676  0.0076  0.0075  0.0065  0.0062  0.0044  0.0042  0.0040  0.0038  0.0028  0.0025  0.0023  0.0022 
 +     4096  0.9626  0.2905  0.0236  0.0231  0.0194  0.0188  0.0129  0.0125  0.0108  0.0104  0.0069  0.0063  0.0061  0.0059 
 +     8192  5.4731  1.5194  0.0812  0.0805  0.0646  0.0633  0.0431  0.0424  0.0334  0.0321  0.0197  0.0185  0.0182  0.0175
 ... ...
-   262144  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------ +   262144  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------ 
-========================================================================================= +========================================================================================================================= 
- verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK + verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK 
-=========================================================================================+========================================================================================================================= 
 +lab46:~/src/discrete/pnc1$  
 +</cli> 
 + 
 +====check range==== 
 +Or check range runtimes: 
 + 
 +<cli> 
 +lab46:~/src/discrete/pnc1$ make checkrange 
 +========================================================================================================================= 
 +    range   regmo  regbmo   regms   regma   regos   regoa  regmos  regmoa  regbms  regbma  regbos regbmos  regboa regbmoa 
 +========================================================================================================================= 
 +       32  0.0001  0.0001  0.0001  0.0001  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  0.0001  0.0001  0.0001  0.0001 
 +      128  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001 
 +      256  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001  0.0001 
 +      512  0.0003  0.0002  0.0002  0.0001  0.0002  0.0001  0.0001  0.0001  0.0001  0.0001  0.0002  0.0001  0.0001  0.0001 
 +     1024  0.0010  0.0005  0.0002  0.0002  0.0002  0.0002  0.0002  0.0002  0.0002  0.0002  0.0002  0.0002  0.0001  0.0002 
 +     2048  0.0033  0.0015  0.0004  0.0004  0.0004  0.0004  0.0003  0.0003  0.0003  0.0003  0.0003  0.0003  0.0003  0.0003 
 +     4096  0.0118  0.0047  0.0010  0.0010  0.0009  0.0009  0.0007  0.0007  0.0006  0.0006  0.0006  0.0005  0.0005  0.0005 
 +     8192  0.0448  0.0161  0.0026  0.0025  0.0023  0.0022  0.0016  0.0015  0.0015  0.0015  0.0011  0.0011  0.0010  0.0009 
 +    16384  0.1742  0.0576  0.0067  0.0067  0.0058  0.0055  0.0038  0.0046  0.0036  0.0034  0.0024  0.0022  0.0021  0.0020 
 +    32768  0.6861  0.2096  0.0186  0.0181  0.0152  0.0147  0.0101  0.0099  0.0086  0.0083  0.0055  0.0051  0.0049  0.0048 
 +    65536  2.7211  0.7758  0.0503  0.0500  0.0410  0.0397  0.0270  0.0268  0.0215  0.0208  0.0132  0.0123  0.0119  0.0117 
 +... 
 +  4194304  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------ 
 +========================================================================================================================= 
 + verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK 
 +=========================================================================================================================
 lab46:~/src/discrete/pnc1$  lab46:~/src/discrete/pnc1$ 
 </cli> </cli>
Line 439: Line 519:
 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/pnc1$ make verifyall
 +=========================================================================================================================
 +            regmo  regbmo   regms   regma   regos   regoa  regmos  regmoa  regbms  regbma  regbos regbmos  regboa regbmoa
 +=========================================================================================================================
 + qtynorm:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + qtypart:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + rngnorm:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + rngpart:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +    coop:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +   coop2:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +   coop3:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +  noargs:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + invargs:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +  invqty:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + invnary:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +  invlow:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 + invhigh:    OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK      OK
 +=========================================================================================================================
 +lab46:~/src/discrete/pnc1$ 
 +</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 512: Line 656:
  
 Submitting discrete project "pnc1": Submitting discrete project "pnc1":
-    -> ../pnc1-20170713-11.tar.gz(OK)+    -> ../pnc1-20170907-16.tar.gz(OK)
  
 SUCCESSFULLY SUBMITTED SUCCESSFULLY SUBMITTED
Line 519: Line 663:
 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> <code>
-260:pnc1:final tally of results (260/260) +546:pnc1:final tally of results (546/546)
-*:pnc0:primereg.c performs proper argument checking [2/2] +
-*:pnc0:primereg.c no negative compiler messages [2/2] +
-*:pnc0:primereg.c implements only specified algorithm [6/6] +
-*:pnc0:primereg.c consistent indentation and comments [4/4] +
-*:pnc0:primereg.c data and output conform to specifications [6/6] +
-*:pnc0:primereg.c make check runtime tests succeed [6/6]+
 </code> </code>
 +
 +What I will be looking for (for each file):
 +
 +<code>
 +*:pnc1:primeALGO.c compiles cleanly, no compiler messages [3/3]
 +*:pnc1:primeALGO.c implements only specified algorithm [6/6]
 +*:pnc1:primeALGO.c consistent indentation throughout code [3/3]
 +*:pnc1:primeALGO.c relevant comments throughout code [3/3]
 +*:pnc1:primeALGO.c code conforms to project specifications [3/3]
 +*:pnc1:primeALGO.c runtime output conforms to specifications [4/4]
 +*:pnc1:primeALGO.c make checkqty test times within reason [2/2]
 +*:pnc1:primeALGO.c make checkrange test times within reason [2/2]
 +*:pnc1:primeALGO.c make verifyall tests succeed [13/13]
 +</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/pnc1.1499960808.txt.gz · Last modified: 2017/07/13 15:46 by wedge