Assignment 1: Benchmarks

Due: 5:00pm, Thu 24 Jan. Value: 30 pts. Submit to Moodle.

Write a report comparing the performance of three computers: A Linux lab computer (they're all identical), grendel, and ozark. Your report should be submitted as an ASCII text file (created with a program such the lab computers' text editor, gedit). Your report should have three sections:

  1. Start with your numerical results. In particular, you should include ten numbers:

    • Tprime,lab: The raw time for a Linux lab computer to execute the prime-testing program described below.
    • Tgauss,lab: The raw time for a Linux lab computer to execute the Gaussian integral program described below.
    • Tprime,grendel: The raw time for grendel to execute the prime-testing program described below.
    • Tgauss,grendel: The raw time for grendel to execute the Gaussian integral program described below.
    • Tprime,ozark: The raw time for ozark to execute the prime-testing program described below.
    • Tgauss,ozark: The raw time for ozark to execute the Gaussian integral program described below.
    • Tprime,grendel / Tprime,lab
    • Tprime,ozark / Tprime,lab
    • Tgauss,grendel / Tgauss,lab
    • Tgauss,ozark / Tgauss,lab
  2. This should be followed by a precise description of your procedure for obtaining these measurements. Include the exact terminal commands you executed to obtain each.

  3. Finally, in an appendix, include the actual code you used for implementing the prime-testing and Gaussian integral benchmarks.

Except for the appendix, the report should be written in a professional, coherent style. Your grade will be based primarily on the professionalism and style of your writing and coding, and only secondarily on the accuracy of your conclusions. The assignment intentionally leaves unspecified exactly which technique to use for your measurements, as part of our goal is to compare different measurement techniques.

Assume that your classmates will read your completed report. Following completion, we'll compare the results and techniques by students.

Prime testing

For a value of n (it is up to you to choose how to select n), we determine whether n is prime using the following technique:

d ← 2
while d² < n:
   if n mod d = 0:
      return false
   d ← d + 1
return true

Gaussian integral

For a value of n, (it is up to you to choose how to select n), we approximate the integral of f(x) = ex² / 2 for between −2 and 2 using the following adaptation of Simpson's rule. (When n is large, the answer is close to 2.392576.)

sum ← f(−2) + f(2)
delta ← 4 / n
for i from 1 to n − 1, inclusive:
   sum ← sum + 3 ⋅ f(−2 + i ⋅ delta)
return delta ⋅ sum / 3

To compute ey, you'll want to use the built-in exp function, which will be included in the same library including sin and log.

(The reason behind the selection of these two benchmark programs is that the first concentrates on integer arithmetic heavily while the second uses floating-point arithmetic, so in fact the two programs are testing different parts of the processor. You'll likely arrive at similar speed ratios for each benchmark, though.)

Accessing grendel and ozark

You cannot physically access grendel and ozark, since they are locked in the server closet. (Our file server is grendel, while ozark serves as the Web server.)

However, you can use ssh to execute terminal commands on them: From a Linux lab terminal, you can execute “ssh grendel” and type your password when prompted; any subsequent commands you execute in that terminal will be sent for grendel to execute.

You can do similarly with ozark, but your home directory won't have the same files as on the lab computers or grendel. However, you may copy any file from the lab computer into your home directory's www subdirectory, and it will be visible in the www subdirectory on ozark.