serolf
2008-10-10 16:14:22 UTC
I'm working on this problem and I could use any help I can get.
I want to optimize an already parallel Sieve of Eratosthenes program
by not allocating memory for even numbers, since they're never primes
(besides 2). This Sieve program only counts the number of primes from
2...n, it doesn't actually display them, just counts.
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
I've got the code here. It should compile though you'll need a utility
class "mympi.h and mympi.c"
http://pastebin.com/m3bcc6502
http://www.soe.ucsc.edu/classes/cmpe113/Spring07/source/
There's a few printf statements to help me out. I tried making changes
to the size (dividing by 2) and then modifying the main do-while loop
with no success. I think the key might be when it's incrementing i by
prime. But it doesn't seem to work.
Thanks in advance.
I want to optimize an already parallel Sieve of Eratosthenes program
by not allocating memory for even numbers, since they're never primes
(besides 2). This Sieve program only counts the number of primes from
2...n, it doesn't actually display them, just counts.
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
I've got the code here. It should compile though you'll need a utility
class "mympi.h and mympi.c"
http://pastebin.com/m3bcc6502
http://www.soe.ucsc.edu/classes/cmpe113/Spring07/source/
There's a few printf statements to help me out. I tried making changes
to the size (dividing by 2) and then modifying the main do-while loop
with no success. I think the key might be when it's incrementing i by
prime. But it doesn't seem to work.
Thanks in advance.