{"action":"created","comment":{"url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments/180341560","pull_request_review_id":110744382,"id":180341560,"diff_hunk":"@@ -125,23 +125,24 @@ SGVector<float64_t> CLogDetEstimator::sample(index_t num_estimates)\n \tindex_t num_trace_samples=m_trace_sampler->get_num_samples();\n \tSGVector<float64_t> samples(num_estimates);\n \tsamples.zero();\n+\tfloat64_t result=0.0;\n \n+#pragma omp parallel for reduction(+:result)\n \tfor (index_t i = 0; i < num_estimates; ++i)\n \t{\n+\t\tresult=0.0;\n \t\tfor (index_t j = 0; j < num_trace_samples; ++j)\n \t\t{\n \t\t\tSG_INFO(\n \t\t\t\t\"Computing log-determinant trace sample %d/%d\\n\", j,\n \t\t\t\tnum_trace_samples);\n \t\t\t// get the trace sampler vector\n \t\t\tSGVector<float64_t> s = m_trace_sampler->sample(j);\n-\t\t\t// calculate the result for sample s\n-\t\t\tfloat64_t result = m_operator_log->compute(s);\n-\t\t\t{\n-\t\t\t\tsamples[i] += result;\n-\t\t\t}\n-\t\t}\n+\t\t\t// calculate the result for sample s and add it to previous\n+\t\t\tresult += m_operator_log->compute(s);","path":"src/shogun/mathematics/linalg/ratapprox/logdet/LogDetEstimator.cpp","position":24,"original_position":24,"commit_id":"95a9d9799d389838e11458f8ae6e4db940f103c8","original_commit_id":"95a9d9799d389838e11458f8ae6e4db940f103c8","user":{"login":"karlnapf","id":699071,"avatar_url":"https://avatars0.githubusercontent.com/u/699071?v=4","gravatar_id":"","url":"https://api.github.com/users/karlnapf","html_url":"https://github.com/karlnapf","followers_url":"https://api.github.com/users/karlnapf/followers","following_url":"https://api.github.com/users/karlnapf/following{/other_user}","gists_url":"https://api.github.com/users/karlnapf/gists{/gist_id}","starred_url":"https://api.github.com/users/karlnapf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlnapf/subscriptions","organizations_url":"https://api.github.com/users/karlnapf/orgs","repos_url":"https://api.github.com/users/karlnapf/repos","events_url":"https://api.github.com/users/karlnapf/events{/privacy}","received_events_url":"https://api.github.com/users/karlnapf/received_events","type":"User","site_admin":false},"body":"just another question.\r\nIs this `compute` method threadsafe, i.e. `const`\r\nIf not, we need to make it so to avoid the race condition analyser moaning","created_at":"2018-04-10T08:52:13Z","updated_at":"2018-04-10T08:52:13Z","html_url":"https://github.com/shogun-toolbox/shogun/pull/4235#discussion_r180341560","pull_request_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments/180341560"},"html":{"href":"https://github.com/shogun-toolbox/shogun/pull/4235#discussion_r180341560"},"pull_request":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235"}}},"pull_request":{"url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235","id":179866037,"html_url":"https://github.com/shogun-toolbox/shogun/pull/4235","diff_url":"https://github.com/shogun-toolbox/shogun/pull/4235.diff","patch_url":"https://github.com/shogun-toolbox/shogun/pull/4235.patch","issue_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/4235","number":4235,"state":"open","locked":false,"title":"parrallel computation of sample in LogDetEstimator","user":{"login":"shubham808","id":20493212,"avatar_url":"https://avatars1.githubusercontent.com/u/20493212?v=4","gravatar_id":"","url":"https://api.github.com/users/shubham808","html_url":"https://github.com/shubham808","followers_url":"https://api.github.com/users/shubham808/followers","following_url":"https://api.github.com/users/shubham808/following{/other_user}","gists_url":"https://api.github.com/users/shubham808/gists{/gist_id}","starred_url":"https://api.github.com/users/shubham808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shubham808/subscriptions","organizations_url":"https://api.github.com/users/shubham808/orgs","repos_url":"https://api.github.com/users/shubham808/repos","events_url":"https://api.github.com/users/shubham808/events{/privacy}","received_events_url":"https://api.github.com/users/shubham808/received_events","type":"User","site_admin":false},"body":"This is [WIP]\r\nIn #4103 we decided to use something like \r\n```#pragma omp parallel for reduction(+:samples[:num_estimates])``` \r\nbut this is not working because openmp does not support vector reduction in this manner.\r\nI declared a custom reduction for vector type which did the trick. However, I found this similar problem solved [here](https://github.com/shogun-toolbox/shogun/blob/c8c66e61ebc8b6e90cbe726df7557c7291310cab/src/shogun/kernel/Kernel.cpp#L1139) using a critical section.  ","created_at":"2018-04-06T06:43:36Z","updated_at":"2018-04-10T08:52:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb374bbc43626421be79b9a75fa0e45da496e36d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235/commits","review_comments_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235/comments","review_comment_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/4235/comments","statuses_url":"https://api.github.com/repos/shogun-toolbox/shogun/statuses/95a9d9799d389838e11458f8ae6e4db940f103c8","head":{"label":"shubham808:feature/refactoring_logdet_3","ref":"feature/refactoring_logdet_3","sha":"95a9d9799d389838e11458f8ae6e4db940f103c8","user":{"login":"shubham808","id":20493212,"avatar_url":"https://avatars1.githubusercontent.com/u/20493212?v=4","gravatar_id":"","url":"https://api.github.com/users/shubham808","html_url":"https://github.com/shubham808","followers_url":"https://api.github.com/users/shubham808/followers","following_url":"https://api.github.com/users/shubham808/following{/other_user}","gists_url":"https://api.github.com/users/shubham808/gists{/gist_id}","starred_url":"https://api.github.com/users/shubham808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shubham808/subscriptions","organizations_url":"https://api.github.com/users/shubham808/orgs","repos_url":"https://api.github.com/users/shubham808/repos","events_url":"https://api.github.com/users/shubham808/events{/privacy}","received_events_url":"https://api.github.com/users/shubham808/received_events","type":"User","site_admin":false},"repo":{"id":118227306,"name":"shogun","full_name":"shubham808/shogun","owner":{"login":"shubham808","id":20493212,"avatar_url":"https://avatars1.githubusercontent.com/u/20493212?v=4","gravatar_id":"","url":"https://api.github.com/users/shubham808","html_url":"https://github.com/shubham808","followers_url":"https://api.github.com/users/shubham808/followers","following_url":"https://api.github.com/users/shubham808/following{/other_user}","gists_url":"https://api.github.com/users/shubham808/gists{/gist_id}","starred_url":"https://api.github.com/users/shubham808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shubham808/subscriptions","organizations_url":"https://api.github.com/users/shubham808/orgs","repos_url":"https://api.github.com/users/shubham808/repos","events_url":"https://api.github.com/users/shubham808/events{/privacy}","received_events_url":"https://api.github.com/users/shubham808/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shubham808/shogun","description":"Shōgun","fork":true,"url":"https://api.github.com/repos/shubham808/shogun","forks_url":"https://api.github.com/repos/shubham808/shogun/forks","keys_url":"https://api.github.com/repos/shubham808/shogun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shubham808/shogun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shubham808/shogun/teams","hooks_url":"https://api.github.com/repos/shubham808/shogun/hooks","issue_events_url":"https://api.github.com/repos/shubham808/shogun/issues/events{/number}","events_url":"https://api.github.com/repos/shubham808/shogun/events","assignees_url":"https://api.github.com/repos/shubham808/shogun/assignees{/user}","branches_url":"https://api.github.com/repos/shubham808/shogun/branches{/branch}","tags_url":"https://api.github.com/repos/shubham808/shogun/tags","blobs_url":"https://api.github.com/repos/shubham808/shogun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shubham808/shogun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shubham808/shogun/git/refs{/sha}","trees_url":"https://api.github.com/repos/shubham808/shogun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shubham808/shogun/statuses/{sha}","languages_url":"https://api.github.com/repos/shubham808/shogun/languages","stargazers_url":"https://api.github.com/repos/shubham808/shogun/stargazers","contributors_url":"https://api.github.com/repos/shubham808/shogun/contributors","subscribers_url":"https://api.github.com/repos/shubham808/shogun/subscribers","subscription_url":"https://api.github.com/repos/shubham808/shogun/subscription","commits_url":"https://api.github.com/repos/shubham808/shogun/commits{/sha}","git_commits_url":"https://api.github.com/repos/shubham808/shogun/git/commits{/sha}","comments_url":"https://api.github.com/repos/shubham808/shogun/comments{/number}","issue_comment_url":"https://api.github.com/repos/shubham808/shogun/issues/comments{/number}","contents_url":"https://api.github.com/repos/shubham808/shogun/contents/{+path}","compare_url":"https://api.github.com/repos/shubham808/shogun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shubham808/shogun/merges","archive_url":"https://api.github.com/repos/shubham808/shogun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shubham808/shogun/downloads","issues_url":"https://api.github.com/repos/shubham808/shogun/issues{/number}","pulls_url":"https://api.github.com/repos/shubham808/shogun/pulls{/number}","milestones_url":"https://api.github.com/repos/shubham808/shogun/milestones{/number}","notifications_url":"https://api.github.com/repos/shubham808/shogun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shubham808/shogun/labels{/name}","releases_url":"https://api.github.com/repos/shubham808/shogun/releases{/id}","deployments_url":"https://api.github.com/repos/shubham808/shogun/deployments","created_at":"2018-01-20T09:08:59Z","updated_at":"2018-01-20T09:09:07Z","pushed_at":"2018-04-10T05:02:37Z","git_url":"git://github.com/shubham808/shogun.git","ssh_url":"git@github.com:shubham808/shogun.git","clone_url":"https://github.com/shubham808/shogun.git","svn_url":"https://github.com/shubham808/shogun","homepage":"http://shogun.ml","size":64419,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"shogun-toolbox:develop","ref":"develop","sha":"32a6746251e4864269feb08702786ed1214be0b6","user":{"login":"shogun-toolbox","id":690673,"avatar_url":"https://avatars1.githubusercontent.com/u/690673?v=4","gravatar_id":"","url":"https://api.github.com/users/shogun-toolbox","html_url":"https://github.com/shogun-toolbox","followers_url":"https://api.github.com/users/shogun-toolbox/followers","following_url":"https://api.github.com/users/shogun-toolbox/following{/other_user}","gists_url":"https://api.github.com/users/shogun-toolbox/gists{/gist_id}","starred_url":"https://api.github.com/users/shogun-toolbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shogun-toolbox/subscriptions","organizations_url":"https://api.github.com/users/shogun-toolbox/orgs","repos_url":"https://api.github.com/users/shogun-toolbox/repos","events_url":"https://api.github.com/users/shogun-toolbox/events{/privacy}","received_events_url":"https://api.github.com/users/shogun-toolbox/received_events","type":"Organization","site_admin":false},"repo":{"id":1555094,"name":"shogun","full_name":"shogun-toolbox/shogun","owner":{"login":"shogun-toolbox","id":690673,"avatar_url":"https://avatars1.githubusercontent.com/u/690673?v=4","gravatar_id":"","url":"https://api.github.com/users/shogun-toolbox","html_url":"https://github.com/shogun-toolbox","followers_url":"https://api.github.com/users/shogun-toolbox/followers","following_url":"https://api.github.com/users/shogun-toolbox/following{/other_user}","gists_url":"https://api.github.com/users/shogun-toolbox/gists{/gist_id}","starred_url":"https://api.github.com/users/shogun-toolbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shogun-toolbox/subscriptions","organizations_url":"https://api.github.com/users/shogun-toolbox/orgs","repos_url":"https://api.github.com/users/shogun-toolbox/repos","events_url":"https://api.github.com/users/shogun-toolbox/events{/privacy}","received_events_url":"https://api.github.com/users/shogun-toolbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shogun-toolbox/shogun","description":"Shōgun","fork":false,"url":"https://api.github.com/repos/shogun-toolbox/shogun","forks_url":"https://api.github.com/repos/shogun-toolbox/shogun/forks","keys_url":"https://api.github.com/repos/shogun-toolbox/shogun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shogun-toolbox/shogun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shogun-toolbox/shogun/teams","hooks_url":"https://api.github.com/repos/shogun-toolbox/shogun/hooks","issue_events_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/events{/number}","events_url":"https://api.github.com/repos/shogun-toolbox/shogun/events","assignees_url":"https://api.github.com/repos/shogun-toolbox/shogun/assignees{/user}","branches_url":"https://api.github.com/repos/shogun-toolbox/shogun/branches{/branch}","tags_url":"https://api.github.com/repos/shogun-toolbox/shogun/tags","blobs_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/refs{/sha}","trees_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shogun-toolbox/shogun/statuses/{sha}","languages_url":"https://api.github.com/repos/shogun-toolbox/shogun/languages","stargazers_url":"https://api.github.com/repos/shogun-toolbox/shogun/stargazers","contributors_url":"https://api.github.com/repos/shogun-toolbox/shogun/contributors","subscribers_url":"https://api.github.com/repos/shogun-toolbox/shogun/subscribers","subscription_url":"https://api.github.com/repos/shogun-toolbox/shogun/subscription","commits_url":"https://api.github.com/repos/shogun-toolbox/shogun/commits{/sha}","git_commits_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/commits{/sha}","comments_url":"https://api.github.com/repos/shogun-toolbox/shogun/comments{/number}","issue_comment_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/comments{/number}","contents_url":"https://api.github.com/repos/shogun-toolbox/shogun/contents/{+path}","compare_url":"https://api.github.com/repos/shogun-toolbox/shogun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shogun-toolbox/shogun/merges","archive_url":"https://api.github.com/repos/shogun-toolbox/shogun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shogun-toolbox/shogun/downloads","issues_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues{/number}","pulls_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls{/number}","milestones_url":"https://api.github.com/repos/shogun-toolbox/shogun/milestones{/number}","notifications_url":"https://api.github.com/repos/shogun-toolbox/shogun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shogun-toolbox/shogun/labels{/name}","releases_url":"https://api.github.com/repos/shogun-toolbox/shogun/releases{/id}","deployments_url":"https://api.github.com/repos/shogun-toolbox/shogun/deployments","created_at":"2011-04-01T10:44:32Z","updated_at":"2018-04-10T03:05:43Z","pushed_at":"2018-04-10T05:02:41Z","git_url":"git://github.com/shogun-toolbox/shogun.git","ssh_url":"git@github.com:shogun-toolbox/shogun.git","clone_url":"https://github.com/shogun-toolbox/shogun.git","svn_url":"https://github.com/shogun-toolbox/shogun","homepage":"http://shogun.ml","size":64447,"stargazers_count":2059,"watchers_count":2059,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":853,"mirror_url":null,"archived":false,"open_issues_count":507,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":853,"open_issues":507,"watchers":2059,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235"},"html":{"href":"https://github.com/shogun-toolbox/shogun/pull/4235"},"issue":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/issues/4235"},"comments":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/issues/4235/comments"},"review_comments":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235/comments"},"review_comment":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/4235/commits"},"statuses":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/statuses/95a9d9799d389838e11458f8ae6e4db940f103c8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"karlnapf"}}