KarlSplatz wrote:I tried the ejolson's benchmark and my PC runs from just under 0.009s to 0.025. I guess a longer problem would be more stable.

You are right that the original problem size is not large enough for meaningful timings. If you change the program to find the primes up to 10000000 as

Code: Select all

```
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#define N 10000000
typedef uint32_t Integer;
//typedef uint64_t Integer;
static Integer prime[1000000];
static int count=0;
static int isprime(Integer n){
int sqrtn=sqrt((double)n)+0.5;
int k;
for(k=0;k<count;k++){
if(prime[k]>sqrtn) return 1;
if(n%prime[k]==0) return 0;
}
return 1;
}
int main(){
Integer n;
for(n=2;n<=N;n++){
if(isprime(n)) prime[count++]=n;
}
printf("Found a total of %d primes (%d-bit)\n",
count,(int)sizeof(n)*8);
return 0;
}
```

and rerun with

Code: Select all

```
$ gcc -O3 prime.c -lm
$ time ./a.out; time ./a.out; time ./a.out
```

and report the best real elapsed time among the three runs, I would be happy to have another data point for the table I posted above.

At our university it is possible to boot a CD on any of the classroom computers. A few years ago I set up an NFS server which contained a read-only Debian-live image and then passed out CDs with Linux kernels that had been configured to automatically mount root from that NFS server. It was not necessary to install any software on the Windows PCs and it worked amazingly well.

Last year IT support installed Linux virtual machines on Windows in our lab and then offered to install the same virtual machine on each student's personal laptop as needed. All the individual images were difficult to update and maintain. I think the Raspberry Pi2B could make a good platform for teaching numerical methods; however, lots of little computers might also be difficult to maintain.

To make maintenance easier, a thin-client solution called PiNET is sometimes employed, but that negates the advantage of students using the same Pi computers at home. At the same time, it seems entirely reasonable for university students to setup and maintain their own Linux computers. The Pi also includes a free copy of Mathematica, if that makes any difference. Assuming your students write their code using C or Fortran and the problems are not research sized, I would not expect CPU speed to be a significant problem.

Note: Code for prime.c has been updated to explicitly specify the size of the integers used for the computation.