{"action":"created","issue":{"url":"https://api.github.com/repos/brian-team/brian2/issues/553","labels_url":"https://api.github.com/repos/brian-team/brian2/issues/553/labels{/name}","comments_url":"https://api.github.com/repos/brian-team/brian2/issues/553/comments","events_url":"https://api.github.com/repos/brian-team/brian2/issues/553/events","html_url":"https://github.com/brian-team/brian2/pull/553","id":104079651,"number":553,"title":"[MRG] Fix scalar writes with OpenMP","user":{"login":"mstimberg","id":1381982,"avatar_url":"https://avatars.githubusercontent.com/u/1381982?v=3","gravatar_id":"","url":"https://api.github.com/users/mstimberg","html_url":"https://github.com/mstimberg","followers_url":"https://api.github.com/users/mstimberg/followers","following_url":"https://api.github.com/users/mstimberg/following{/other_user}","gists_url":"https://api.github.com/users/mstimberg/gists{/gist_id}","starred_url":"https://api.github.com/users/mstimberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstimberg/subscriptions","organizations_url":"https://api.github.com/users/mstimberg/orgs","repos_url":"https://api.github.com/users/mstimberg/repos","events_url":"https://api.github.com/users/mstimberg/events{/privacy}","received_events_url":"https://api.github.com/users/mstimberg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brian-team/brian2/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-31T15:50:34Z","updated_at":"2015-09-02T09:57:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/brian-team/brian2/pulls/553","html_url":"https://github.com/brian-team/brian2/pull/553","diff_url":"https://github.com/brian-team/brian2/pull/553.diff","patch_url":"https://github.com/brian-team/brian2/pull/553.patch"},"body":"See discussion in #551, this puts the `parallel` pragma in individual templates instead of around the main run loop. This also means that by default everything will be executed serially, therefore there's no longer a need for the `IS_OPENMP_COMPATIBLE` flag in the templates (and much less `single` pragmas are necessary). I also updated the developer docs, mostly deleting things that are no longer applicable. I remember when @yger started implementing OpenMP support, we decided against doing it like this because it seemed to slow things down. However, I can't see any negative effect, possibly other things were responsible for the slow down.\r\n\r\nSome quick-and-dirty benchmarks (median of three runs, everything normalized to a run without OpenMP (0.5 means 2x as fast), taking the output from the progress report, i.e. only runtime without synapse creation, compilation, etc.).\r\n\r\n | Before | after\r\n-----------|----------|-------\r\nIF_curve_Hodgkin_Huxley||\r\n1 thread | 1.031 | 0.988\r\n2 threads | 0.543 | 0.531\r\n4 threads | 0.407 | 0.403\r\nCUBA ||\r\n1 thread | 1.000 | 1.000\r\n2 threads | 0.607 | 0.629\r\n4 threads | 0.652 | 0.652\r\nSTDP_standalone ||\r\n1 thread | 1.524 | 1.439\r\n2 threads | 1.788 | 1.814\r\n4 threads | 2.140 | 2.137\r\n\r\nSo overall, OpenMP scaling is not great and is abyssimal for the STDP example where everything gets much slower instead of faster, but I don't see any significant differences before and after the changes from this pull request. Improving all of this is #539 \r\n\r\nIn the long run, we have even more flexibility with the new approach because you can use additional arguments to the `parallel` block to make variables thread-local, use reductions, etc.\r\n"},"comment":{"url":"https://api.github.com/repos/brian-team/brian2/issues/comments/137009613","html_url":"https://github.com/brian-team/brian2/pull/553#issuecomment-137009613","issue_url":"https://api.github.com/repos/brian-team/brian2/issues/553","id":137009613,"user":{"login":"thesamovar","id":2903870,"avatar_url":"https://avatars.githubusercontent.com/u/2903870?v=3","gravatar_id":"","url":"https://api.github.com/users/thesamovar","html_url":"https://github.com/thesamovar","followers_url":"https://api.github.com/users/thesamovar/followers","following_url":"https://api.github.com/users/thesamovar/following{/other_user}","gists_url":"https://api.github.com/users/thesamovar/gists{/gist_id}","starred_url":"https://api.github.com/users/thesamovar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesamovar/subscriptions","organizations_url":"https://api.github.com/users/thesamovar/orgs","repos_url":"https://api.github.com/users/thesamovar/repos","events_url":"https://api.github.com/users/thesamovar/events{/privacy}","received_events_url":"https://api.github.com/users/thesamovar/received_events","type":"User","site_admin":false},"created_at":"2015-09-02T09:57:39Z","updated_at":"2015-09-02T09:57:39Z","body":"Great! Merging now."}}