uwhpsc-2016 / homework4

Homework #4
0 stars 1 forks source link

What if N is not divisible by comm.size? #9

Open boygao1992 opened 8 years ago

boygao1992 commented 8 years ago

In _example_parallelsolution, if N is not divisible by comm.size, the chunking process will fail at u.reshape. I think the last chunk should be handled separately to solve this issue.

swcarmer commented 8 years ago

I had thought about this too and if we were responsible for example_parallel_solution, I do think we would need to account for that (at least raise an error if N is not divisible by comm.size); however, since all we have to do is have our solution pass the given test, we know it is not a concern for this assignment, i.e. N is divisible by the comm.size. They are only running the given test against our code - at least that is what I understand from the README and other responses to Issues.

quantheory commented 8 years ago

@swcarmer is right. In a real application, you would want to either assert that N % comm.size == 0, or allow variable sizes (e.g. some tasks get 19 points and some get 20). But here it's just assumed that an appropriate task number is used.