Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible mistake in lecture 5 code #3

Closed
giacomoran opened this issue Sep 30, 2019 · 1 comment
Closed

Possible mistake in lecture 5 code #3

giacomoran opened this issue Sep 30, 2019 · 1 comment

Comments

@giacomoran
Copy link

Hi,

I think there is a mistake in lecture 5 notes, in the "Multithreaded Parameter Searches" section, in the following code:

const _u_cache_threads = [Vector{typeof(@SVector([1.0,0.0,0.0]))}(undef,1000) for i in 1:Threads.nthreads()]
function compute_trajectory_mean5(u0,p)
  # u is automatically captured
  solve_system_save!(_u_cache_threads[Threads.threadid()],lorenz,u0,p,1000);
  mean(_u_cache)
end
@btime compute_trajectory_mean5(@SVector([1.0,0.0,0.0]),p)

After solving the system, the iteration are stored in _u_cache_threads[Threads.threadid()], but then the mean is computed on _u_cache, which, in my understanding, is not used anymore at this point of the notes.
It can be deceiving since serial_out - threaded_out it's still all 0s, but if you check the output of any of serial_out or threaded_out, the means for different ps have all the same value.

I think it should be mean(_u_cache_threads[Threads.threadid()]), is that correct?

(I'm not actually taking the course, I'm not a MIT student, I studying from the lecture notes in this repo)

Giacomo Randazzo

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Oct 4, 2019

I think it should be mean(_u_cache_threads[Threads.threadid()]), is that correct?

Yes, it should be. Thanks for catching this. I'll have to find time to update this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants