{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/math/issues/897","repository_url":"https://api.github.com/repos/stan-dev/math","labels_url":"https://api.github.com/repos/stan-dev/math/issues/897/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/math/issues/897/comments","events_url":"https://api.github.com/repos/stan-dev/math/issues/897/events","html_url":"https://github.com/stan-dev/math/pull/897","id":330961179,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzODIxNTQw","number":897,"title":"Bugfix/issue 895 mpi tests","user":{"login":"wds15","id":12070126,"node_id":"MDQ6VXNlcjEyMDcwMTI2","avatar_url":"https://avatars0.githubusercontent.com/u/12070126?v=4","gravatar_id":"","url":"https://api.github.com/users/wds15","html_url":"https://github.com/wds15","followers_url":"https://api.github.com/users/wds15/followers","following_url":"https://api.github.com/users/wds15/following{/other_user}","gists_url":"https://api.github.com/users/wds15/gists{/gist_id}","starred_url":"https://api.github.com/users/wds15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wds15/subscriptions","organizations_url":"https://api.github.com/users/wds15/orgs","repos_url":"https://api.github.com/users/wds15/repos","events_url":"https://api.github.com/users/wds15/events{/privacy}","received_events_url":"https://api.github.com/users/wds15/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-10T11:33:28Z","updated_at":"2018-06-11T17:01:03Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/stan-dev/math/pulls/897","html_url":"https://github.com/stan-dev/math/pull/897","diff_url":"https://github.com/stan-dev/math/pull/897.diff","patch_url":"https://github.com/stan-dev/math/pull/897.patch"},"body":"#### Submission Checklist\r\n\r\n- [X] Run unit tests: `./runTests.py test/unit` (for the MPI tests)\r\n- [X] Run cpplint: `make cpplint`\r\n- [X] Declare copyright holder and open-source license: see below\r\n\r\n#### Summary:\r\nMPI tests have been seen to be brittle due to corrupted xml files created by google test. This PR changes the MPI tests to avoid the use of a global variable and instead modifies google-tests main to setup the MPI environment directly as needed for the tests.\r\n\r\n#### Intended Effect:\r\nMake MPI tests reliable.\r\n\r\n#### How to Verify:\r\nSetup & run the MPI tests. Put in `make/local`\r\n```\r\nSTAN_MPI=true\r\nCC=mpicxx\r\n```\r\nand run the tests\r\n```\r\ntest/unit/math/rev/mat/functor/map_rect_mpi_test.cpp\r\ntest/unit/math/prim/mat/functor/map_rect_mpi_test.cpp\r\ntest/unit/math/prim/mat/functor/mpi_parallel_call_test.cpp\r\ntest/unit/math/prim/arr/functor/mpi_cluster_test.cpp\r\n```\r\n\r\n#### Side Effects:\r\nUnfortunately, a few:\r\n- Requiring inside googles gtest main the MPI forces all tests to depend on MPI things (which is only done whenever STAN_MPI=true)\r\n- This required to change the makefile logic slightly which has been aligned to follow what we have done for the GPU code\r\n- To avoid linker problems due to duplicate symbols being defined, the code had to be rearranged slightly (globals were moved to members of static functions and `mpi_cluster.cpp` needs to be setup und a new folder `src`).\r\n\r\n#### Documentation:\r\nIn the code.\r\n\r\n#### Copyright and Licensing\r\n\r\nPlease list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Sebastian Weber\r\n\r\nBy submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:\r\n- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)\r\n- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)"},"comment":{"url":"https://api.github.com/repos/stan-dev/math/issues/comments/396313315","html_url":"https://github.com/stan-dev/math/pull/897#issuecomment-396313315","issue_url":"https://api.github.com/repos/stan-dev/math/issues/897","id":396313315,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjMxMzMxNQ==","user":{"login":"wds15","id":12070126,"node_id":"MDQ6VXNlcjEyMDcwMTI2","avatar_url":"https://avatars0.githubusercontent.com/u/12070126?v=4","gravatar_id":"","url":"https://api.github.com/users/wds15","html_url":"https://github.com/wds15","followers_url":"https://api.github.com/users/wds15/followers","following_url":"https://api.github.com/users/wds15/following{/other_user}","gists_url":"https://api.github.com/users/wds15/gists{/gist_id}","starred_url":"https://api.github.com/users/wds15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wds15/subscriptions","organizations_url":"https://api.github.com/users/wds15/orgs","repos_url":"https://api.github.com/users/wds15/repos","events_url":"https://api.github.com/users/wds15/events{/privacy}","received_events_url":"https://api.github.com/users/wds15/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T17:01:03Z","updated_at":"2018-06-11T17:01:03Z","author_association":"CONTRIBUTOR","body":"@bob-carpenter would you be able to dive into this one? This PR intends to make MPI tests more reliable as there were side-effects in the former way of handling MPI specifics via globals. Now I am modifying the google test main directly which I hesitated to do initially (but I think this is the cleanest solution).\r\n\r\nThis PR is not required to get MPI, but certainly it's preferable to have a rock solid test pipeline. So we address this now or later (cmdstan will need modifications based on what is in stan-math)."}}
{"actor":{"display_login":"wds15"}}