{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/680","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/680/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/680/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/680/events","html_url":"https://github.com/commercialhaskell/stack/issues/680","id":97425507,"number":680,"title":"`--with-rtsopts=-N` is probably a bad default","user":{"login":"rrnewton","id":274582,"avatar_url":"https://avatars.githubusercontent.com/u/274582?v=3","gravatar_id":"","url":"https://api.github.com/users/rrnewton","html_url":"https://github.com/rrnewton","followers_url":"https://api.github.com/users/rrnewton/followers","following_url":"https://api.github.com/users/rrnewton/following{/other_user}","gists_url":"https://api.github.com/users/rrnewton/gists{/gist_id}","starred_url":"https://api.github.com/users/rrnewton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrnewton/subscriptions","organizations_url":"https://api.github.com/users/rrnewton/orgs","repos_url":"https://api.github.com/users/rrnewton/repos","events_url":"https://api.github.com/users/rrnewton/events{/privacy}","received_events_url":"https://api.github.com/users/rrnewton/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/commercialhaskell/stack/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"open","locked":false,"assignee":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/commercialhaskell/stack/milestones/5","html_url":"https://github.com/commercialhaskell/stack/milestones/0.2.0.0","labels_url":"https://api.github.com/repos/commercialhaskell/stack/milestones/5/labels","id":1166824,"number":5,"title":"0.2.0.0","description":"Arbitrary date chosen, just to get the milestones to order nicely","creator":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":117,"state":"open","created_at":"2015-06-16T14:23:31Z","updated_at":"2015-08-01T06:23:32Z","due_on":"2015-08-31T07:00:00Z","closed_at":null},"comments":9,"created_at":"2015-07-27T09:45:51Z","updated_at":"2015-08-01T17:22:42Z","closed_at":null,"body":"This is currently set for the `stack` executable in `stack.cabal`.\r\n\r\nIt would be nice if `-N` *were* a good default, but it still isn't.  There are problems such as [GHC issue 8224](https://ghc.haskell.org/trac/ghc/ticket/8224), that cause some rather bad behavior on, e.g., 32, 40, or 64 cores, which are not too uncommon now on x86, especially in the HPC case.\r\n\r\nThis is especially problematic for `stack bench`, where the stack process itself can pollute the machine and interfere with the measurements being performed.\r\n\r\nFirst, my question would be what heavy lifting does the stack process itself do which speeds up from multiple HECs?  I thought sub-processes were always responsible for the heavy lifting?\r\n\r\nSecond, if there is parallel work to be done, it seems like GHC really needs a setting which provides the following behavior:\r\n\r\n * Set a max number of HECs (`-N<5`)\r\n * Don't use more HECs than `getNumProcessors`\r\n * Possibly discount hyper threading if requested\r\n\r\nThe problem right now is that if we change `-N` to `-N4`, then we use 4 threads even when running on single or dual core platforms.  And yet that's the only current way to prevent >=32 HECs in the other extreme.\r\n\r\nIn the short term the above policy could be implemented using `setNumCapabilities`.  Care is warranted though because in the past I've managed to crash GHC that way, and I still think it doesn't get heavy use/testing.\r\n\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/126938617","html_url":"https://github.com/commercialhaskell/stack/issues/680#issuecomment-126938617","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/680","id":126938617,"user":{"login":"phadej","id":51087,"avatar_url":"https://avatars.githubusercontent.com/u/51087?v=3","gravatar_id":"","url":"https://api.github.com/users/phadej","html_url":"https://github.com/phadej","followers_url":"https://api.github.com/users/phadej/followers","following_url":"https://api.github.com/users/phadej/following{/other_user}","gists_url":"https://api.github.com/users/phadej/gists{/gist_id}","starred_url":"https://api.github.com/users/phadej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phadej/subscriptions","organizations_url":"https://api.github.com/users/phadej/orgs","repos_url":"https://api.github.com/users/phadej/repos","events_url":"https://api.github.com/users/phadej/events{/privacy}","received_events_url":"https://api.github.com/users/phadej/received_events","type":"User","site_admin":false},"created_at":"2015-08-01T17:22:42Z","updated_at":"2015-08-01T17:22:42Z","body":"I did a quick test on travis:\r\n- no `RTS` flags: **4min 12sec** https://travis-ci.org/futurice/fum2github/builds/73670708\r\n- `+RTS -N2 -RTS` **2min 35sec** https://travis-ci.org/futurice/fum2github/builds/73701330\r\n- `+RTS -N1 -RTS` **2min 36sec** https://travis-ci.org/futurice/fum2github/builds/73701834\r\n\r\nI'd really like to know why this happens!"}}