CSE-746 2024 Home Assignment #1
Your task is to write an OpenACC version of the serial code ~syam/CSE746/Assignment1/primes_count.c (available on both graham
and cedar clusters; you'll also need the header file ~syam/CSE746/Assignment1/part2.h). This is a code to count the number of prime numbers within a given interval. All prime numbers can be
expressed as 6*k-1 or 6*k+1, k being an integer. The code defines the range of k via the macro parameters KMIN and KMAX. Check
the parallel code correctness - it should produce the same result as the serial version, for the same range KMIN...KMAX. Try
to make the parallel code as efficient as possible.
You should get a well performing code using only the following OpenACC elements:
- parallel directive - loop directives - reduction clause - collapse clause Compiling instructions
are given in the header of the file primes_count.c.
On P100 GPU, you are expected to
achieve a speedup of 50x or more.
You should put
comments inside your code explaining what you are doing.
Marks will be taken off for
code bugs (some or all the results are wrong), for insufficient
commenting in the code, for poor performance. It must be your own
work and you are responsible for adhering to the Senate Policy
Statement on Academic Ethics.
Due date: Monday February 26 before midnight , send me
the solution through email, to syam@physics.mcmaster.ca
. Late submissions will
have their mark reduced by 10% every day. This assignment is worth 10
percent of the course grade.