User Tools

Site Tools


haas:fall2020: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:fall2020:discrete:projects:pnc0 [2020/08/22 22:09] – [Displaying the runtime] wedgehaas:fall2020:discrete:projects:pnc0 [2020/09/15 14:13] (current) – [Program Specifications] wedge
Line 263: Line 263:
     * 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!
-  * display identified primes (space-separated) to a file pointer called **primelist** +  * display identified primes (space-separated) to a file pointer called **stdout** 
-  * 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 **stdout**). Calculate the time that has transpired (ending time minus starting time). 
-  * output the processing run-time to the file pointer called **timing**+  * output the processing run-time to the file pointer called **stderr**
   * your output **MUST** conform to the example output in the **execution** section below. This is also a test to see how well you can implement to specifications. Basically:   * your output **MUST** conform 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.     * 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 below (see the **timing** section).+    * the timing information will be displayed in accordance to code I will provide below (see the **Timing** section)
 + 
 +=====Implementation Restrictions===== 
 + 
 +As our goal is not only to explore the more subtle concepts of computing but to promote different methods of thinking (and arriving at solutions seemingly in different ways), one of the themes I have been harping on is the stricter adherence to the structured programming philosophy. It isn't just good enough to be able to crank out a solution if you remain blind to the many nuances of the tools we are using, so we will at times be going out of our way to emphasize focus on certain areas that may see less exposure (or avoidance due to it being less familiar). 
 + 
 +As such, the following implementation restrictions are also in place: 
 + 
 +  * use any **break** or **continue**, or other flow redirection statements sparingly. I am not forbidding their use, but I also don't want this to turn into a lazy solution free-for-all. I am letting you use them, but with **justification**. 
 +    * **justification** implies some thoughtful why/how style comments explaining how a particular use of one of these statements is effective and efficient (not: "I couldn't think of any other way to do it"). 
 +  * absolutely **NO** infinite loops (**while(1)** or the like). 
 +  * no forced redirection of the flow of the process (no seeking to the end of the file to grab a max size only to zip back somewhere else: deal with the data in as you are naturally encountering it; no telling; no "ungetting" data back into the file). 
 +  * All "arrays" must be declared and referenced using ONLY pointer notation, NO square brackets. 
 +  * **NO** logic shunts (ie having an if statement nested inside a loop to bypass an undesirable iteration)- this should be handled by the loop condition! 
 +  * at most, only **one** return() statement per function. Error terminations should use **exit()** 
 + 
 +Write clean, well-indented, well-commented, effective code... show me that you have learned something from your programming experience.
  
 =====Grabit Integration===== =====Grabit Integration=====
Line 469: Line 485:
  
 ====Displaying the runtime==== ====Displaying the runtime====
-Once we have the starting and ending times, we can display this to the **timing** file pointer. You'll want this line:+Once we have the starting and ending times, we can display this to the **stderr** file pointer. You'll want this line:
  
 <code c> <code c>
Line 650: Line 666:
 ... ...
    262144  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------    262144  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------
-========================================================================================= 
- verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK 
 ========================================================================================= =========================================================================================
 lab46:~/src/discrete/pnc0$  lab46:~/src/discrete/pnc0$ 
Line 675: Line 689:
 ... ...
   2097152  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------   2097152  ------  ------  ------  ------  ------  ------  ------  ------  ------  ------
-========================================================================================= 
- verify:     OK      OK      OK      OK      OK      OK      OK      OK      OK      OK 
 ========================================================================================= =========================================================================================
 lab46:~/src/discrete/pnc0$  lab46:~/src/discrete/pnc0$ 
Line 686: Line 698:
  
 ====Verification==== ====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"+You will want to verify your program output'validity to ensure maximum correctness.
- +
-====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'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**+In the **data/** directory you will find a **primelist.gz** file which contains the first 295947 primes for your verification needs.
  
-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==== ====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 757: Line 710:
   * Code must compile cleanly (no warnings or errors)   * Code must compile cleanly (no warnings or errors)
   * 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.
   * Code must utilize the algorithm(s) presented above:   * Code must utilize the algorithm(s) presented above:
     * **primereg.c** must do the raw, unoptimized brute force method     * **primereg.c** must do the raw, unoptimized brute force method
Line 824: Line 777:
 *:pnc0:primeALGO.c relevant comments throughout code [1/1] *:pnc0:primeALGO.c relevant comments throughout code [1/1]
 *:pnc0:primeALGO.c code conforms to project specifications [2/2] *:pnc0:primeALGO.c code conforms to project specifications [2/2]
-*:pnc0:primeALGO.c runtime output conforms to specifications [1/1]+*:pnc0:primeALGO.c runtime output conforms to specifications [4/4]
 *:pnc0:primeALGO.c make checkqty test times within reason [1/1] *:pnc0:primeALGO.c make checkqty test times within reason [1/1]
 *:pnc0:primeALGO.c make checkrange test times within reason [1/1] *:pnc0:primeALGO.c make checkrange test times within reason [1/1]
-*:pnc0:primeALGO.c make verifyall tests succeed [3/3] 
 </code> </code>
  
haas/fall2020/discrete/projects/pnc0.1598134199.txt.gz · Last modified: 2020/08/22 22:09 by wedge