{"action":"created","comment":{"url":"https://api.github.com/repos/open-mpi/ompi/pulls/comments/62281638","id":62281638,"diff_hunk":"@@ -0,0 +1,66 @@\n+#include \"opal_config.h\"\n+\n+#include <string.h>\n+#include <limits.h>\n+\n+#ifdef HAVE_UNISTD_H\n+#include <unistd.h>\n+#endif\n+#ifdef HAVE_NET_IF_H\n+#include <net/if.h>\n+#endif\n+#ifdef HAVE_LINUX_ETHTOOL_H\n+#include <linux/ethtool.h>\n+#endif\n+#ifdef HAVE_SYS_IOCTL_H\n+#include <sys/ioctl.h>\n+#endif\n+#ifdef HAVE_LINUX_SOCKIOS_H\n+#include <linux/sockios.h>\n+#endif\n+\n+#include \"opal/util/ethtool.h\"\n+#include \"opal/util/if.h\"\n+\n+/*\n+ * Set an appropriate bandwidth for the btl instance. On Linux, we obtain this\n+ * via an ioctl(). Elsewhere or in the error case, we return the speed as 0.","path":"opal/util/ethtool.c","position":27,"original_position":27,"commit_id":"29bc8ffc30fd1612ecf426188c61a55c297ca5e4","original_commit_id":"29bc8ffc30fd1612ecf426188c61a55c297ca5e4","user":{"login":"kmroz","id":1338891,"avatar_url":"https://avatars.githubusercontent.com/u/1338891?v=3","gravatar_id":"","url":"https://api.github.com/users/kmroz","html_url":"https://github.com/kmroz","followers_url":"https://api.github.com/users/kmroz/followers","following_url":"https://api.github.com/users/kmroz/following{/other_user}","gists_url":"https://api.github.com/users/kmroz/gists{/gist_id}","starred_url":"https://api.github.com/users/kmroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmroz/subscriptions","organizations_url":"https://api.github.com/users/kmroz/orgs","repos_url":"https://api.github.com/users/kmroz/repos","events_url":"https://api.github.com/users/kmroz/events{/privacy}","received_events_url":"https://api.github.com/users/kmroz/received_events","type":"User","site_admin":false},"body":"Will remove.","created_at":"2016-05-06T02:09:33Z","updated_at":"2016-05-06T02:09:33Z","html_url":"https://github.com/open-mpi/ompi/pull/1628#discussion_r62281638","pull_request_url":"https://api.github.com/repos/open-mpi/ompi/pulls/1628","_links":{"self":{"href":"https://api.github.com/repos/open-mpi/ompi/pulls/comments/62281638"},"html":{"href":"https://github.com/open-mpi/ompi/pull/1628#discussion_r62281638"},"pull_request":{"href":"https://api.github.com/repos/open-mpi/ompi/pulls/1628"}}},"pull_request":{"url":"https://api.github.com/repos/open-mpi/ompi/pulls/1628","id":68816122,"html_url":"https://github.com/open-mpi/ompi/pull/1628","diff_url":"https://github.com/open-mpi/ompi/pull/1628.diff","patch_url":"https://github.com/open-mpi/ompi/pull/1628.patch","issue_url":"https://api.github.com/repos/open-mpi/ompi/issues/1628","number":1628,"state":"open","locked":false,"title":"btl/tcp: autodetect bandwidth and latency if unset by the user","user":{"login":"kmroz","id":1338891,"avatar_url":"https://avatars.githubusercontent.com/u/1338891?v=3","gravatar_id":"","url":"https://api.github.com/users/kmroz","html_url":"https://github.com/kmroz","followers_url":"https://api.github.com/users/kmroz/followers","following_url":"https://api.github.com/users/kmroz/following{/other_user}","gists_url":"https://api.github.com/users/kmroz/gists{/gist_id}","starred_url":"https://api.github.com/users/kmroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmroz/subscriptions","organizations_url":"https://api.github.com/users/kmroz/orgs","repos_url":"https://api.github.com/users/kmroz/repos","events_url":"https://api.github.com/users/kmroz/events{/privacy}","received_events_url":"https://api.github.com/users/kmroz/received_events","type":"User","site_admin":false},"body":"A first pass at putting something together for open-mpi/ompi#120.\r\n\r\nSmall tests:\r\n---------------\r\n#### Check component default bandwidth value\r\n```\r\n% ompi_info --param btl tcp --level 5\r\n[...]\r\n             MCA btl tcp: parameter \"btl_tcp_bandwidth\" (current value:\r\n                          \"100\", data source: default, level: 5 tuner/detail,\r\n                          type: unsigned_int)\r\n                          Approximate maximum bandwidth of interconnect (0 =\r\n                          auto-detect value at run-time [not supported in all\r\n                          BTL modules], >= 1 = bandwidth in Mbps)\r\n[...]\r\n```\r\nNote that the default of 100 is used during component register. On btl creation (for each interface/link), this is refined.\r\n\r\n#### Obtain bandwidth values for each BTL instance via ioctl(SIOCETHTOOL)\r\n```\r\n% mpirun -d --debug-daemons --mca btl self,tcp  --mca btl_tcp_if_include wlan0,tun0 -np 2 ./hello_c\r\n[...]\r\n[elm][[32725,1],0][btl_tcp_component.c:259:mca_btl_tcp_component_register] \r\n[elm][[32725,1],0][btl_tcp_component.c:1207:mca_btl_tcp_component_init] \r\n[elm][[32725,1],1][btl_tcp_component.c:259:mca_btl_tcp_component_register] \r\n[elm][[32725,1],1][btl_tcp_component.c:1207:mca_btl_tcp_component_init] \r\n[elm][[32725,1],0][btl_tcp_component.c:714:mca_btl_tcp_component_create_instances] \r\n[elm][[32725,1],0][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:wlan0\r\n[elm][[32725,1],0][btl_tcp_component.c:580:mca_btl_tcp_create] wlan0: btl_bandwidth: 0\r\n[elm][[32725,1],0][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:tun0\r\n[elm][[32725,1],0][btl_tcp_component.c:580:mca_btl_tcp_create] tun0: btl_bandwidth: 10\r\n[elm][[32725,1],1][btl_tcp_component.c:714:mca_btl_tcp_component_create_instances] \r\n[elm][[32725,1],1][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:wlan0\r\n[elm][[32725,1],1][btl_tcp_component.c:580:mca_btl_tcp_create] wlan0: btl_bandwidth: 0\r\n[elm][[32725,1],1][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:tun0\r\n[elm][[32725,1],1][btl_tcp_component.c:580:mca_btl_tcp_create] tun0: btl_bandwidth: 10\r\n[...]\r\n```\r\n\r\n#### Allow user to override ioctl() obtained bandwidth values\r\n```\r\n% mpirun -d --debug-daemons --mca btl self,tcp --mca btl_tcp_bandwidth_tun0 200 --mca btl_tcp_if_include wlan0,tun0 -np 2 ./hello_c\r\n[...]\r\n[elm][[32513,1],0][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:wlan0\r\n[elm][[32513,1],0][btl_tcp_component.c:580:mca_btl_tcp_create] wlan0: btl_bandwidth: 0\r\n[elm][[32513,1],0][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:tun0\r\n[elm][[32513,1],0][btl_tcp_component.c:580:mca_btl_tcp_create] tun0: btl_bandwidth: 200\r\n[...]\r\n[elm][[32513,1],1][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:wlan0\r\n[elm][[32513,1],1][btl_tcp_component.c:580:mca_btl_tcp_create] wlan0: btl_bandwidth: 0\r\n[elm][[32513,1],1][btl_tcp_component.c:540:mca_btl_tcp_create] if_name:tun0\r\n[elm][[32513,1],1][btl_tcp_component.c:580:mca_btl_tcp_create] tun0: btl_bandwidth: 200\r\n[...]\r\n```","created_at":"2016-05-04T06:31:43Z","updated_at":"2016-05-06T02:09:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bac785263f66f8e9c4c615aada357dc49b41cdec","assignee":{"login":"kmroz","id":1338891,"avatar_url":"https://avatars.githubusercontent.com/u/1338891?v=3","gravatar_id":"","url":"https://api.github.com/users/kmroz","html_url":"https://github.com/kmroz","followers_url":"https://api.github.com/users/kmroz/followers","following_url":"https://api.github.com/users/kmroz/following{/other_user}","gists_url":"https://api.github.com/users/kmroz/gists{/gist_id}","starred_url":"https://api.github.com/users/kmroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmroz/subscriptions","organizations_url":"https://api.github.com/users/kmroz/orgs","repos_url":"https://api.github.com/users/kmroz/repos","events_url":"https://api.github.com/users/kmroz/events{/privacy}","received_events_url":"https://api.github.com/users/kmroz/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/open-mpi/ompi/pulls/1628/commits","review_comments_url":"https://api.github.com/repos/open-mpi/ompi/pulls/1628/comments","review_comment_url":"https://api.github.com/repos/open-mpi/ompi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/open-mpi/ompi/issues/1628/comments","statuses_url":"https://api.github.com/repos/open-mpi/ompi/statuses/29bc8ffc30fd1612ecf426188c61a55c297ca5e4","head":{"label":"kmroz:wip-btl-tcp-ethtool-speed","ref":"wip-btl-tcp-ethtool-speed","sha":"29bc8ffc30fd1612ecf426188c61a55c297ca5e4","user":{"login":"kmroz","id":1338891,"avatar_url":"https://avatars.githubusercontent.com/u/1338891?v=3","gravatar_id":"","url":"https://api.github.com/users/kmroz","html_url":"https://github.com/kmroz","followers_url":"https://api.github.com/users/kmroz/followers","following_url":"https://api.github.com/users/kmroz/following{/other_user}","gists_url":"https://api.github.com/users/kmroz/gists{/gist_id}","starred_url":"https://api.github.com/users/kmroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmroz/subscriptions","organizations_url":"https://api.github.com/users/kmroz/orgs","repos_url":"https://api.github.com/users/kmroz/repos","events_url":"https://api.github.com/users/kmroz/events{/privacy}","received_events_url":"https://api.github.com/users/kmroz/received_events","type":"User","site_admin":false},"repo":{"id":55249599,"name":"ompi","full_name":"kmroz/ompi","owner":{"login":"kmroz","id":1338891,"avatar_url":"https://avatars.githubusercontent.com/u/1338891?v=3","gravatar_id":"","url":"https://api.github.com/users/kmroz","html_url":"https://github.com/kmroz","followers_url":"https://api.github.com/users/kmroz/followers","following_url":"https://api.github.com/users/kmroz/following{/other_user}","gists_url":"https://api.github.com/users/kmroz/gists{/gist_id}","starred_url":"https://api.github.com/users/kmroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmroz/subscriptions","organizations_url":"https://api.github.com/users/kmroz/orgs","repos_url":"https://api.github.com/users/kmroz/repos","events_url":"https://api.github.com/users/kmroz/events{/privacy}","received_events_url":"https://api.github.com/users/kmroz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kmroz/ompi","description":"Open MPI main development repository","fork":true,"url":"https://api.github.com/repos/kmroz/ompi","forks_url":"https://api.github.com/repos/kmroz/ompi/forks","keys_url":"https://api.github.com/repos/kmroz/ompi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kmroz/ompi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kmroz/ompi/teams","hooks_url":"https://api.github.com/repos/kmroz/ompi/hooks","issue_events_url":"https://api.github.com/repos/kmroz/ompi/issues/events{/number}","events_url":"https://api.github.com/repos/kmroz/ompi/events","assignees_url":"https://api.github.com/repos/kmroz/ompi/assignees{/user}","branches_url":"https://api.github.com/repos/kmroz/ompi/branches{/branch}","tags_url":"https://api.github.com/repos/kmroz/ompi/tags","blobs_url":"https://api.github.com/repos/kmroz/ompi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kmroz/ompi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kmroz/ompi/git/refs{/sha}","trees_url":"https://api.github.com/repos/kmroz/ompi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kmroz/ompi/statuses/{sha}","languages_url":"https://api.github.com/repos/kmroz/ompi/languages","stargazers_url":"https://api.github.com/repos/kmroz/ompi/stargazers","contributors_url":"https://api.github.com/repos/kmroz/ompi/contributors","subscribers_url":"https://api.github.com/repos/kmroz/ompi/subscribers","subscription_url":"https://api.github.com/repos/kmroz/ompi/subscription","commits_url":"https://api.github.com/repos/kmroz/ompi/commits{/sha}","git_commits_url":"https://api.github.com/repos/kmroz/ompi/git/commits{/sha}","comments_url":"https://api.github.com/repos/kmroz/ompi/comments{/number}","issue_comment_url":"https://api.github.com/repos/kmroz/ompi/issues/comments{/number}","contents_url":"https://api.github.com/repos/kmroz/ompi/contents/{+path}","compare_url":"https://api.github.com/repos/kmroz/ompi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kmroz/ompi/merges","archive_url":"https://api.github.com/repos/kmroz/ompi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kmroz/ompi/downloads","issues_url":"https://api.github.com/repos/kmroz/ompi/issues{/number}","pulls_url":"https://api.github.com/repos/kmroz/ompi/pulls{/number}","milestones_url":"https://api.github.com/repos/kmroz/ompi/milestones{/number}","notifications_url":"https://api.github.com/repos/kmroz/ompi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kmroz/ompi/labels{/name}","releases_url":"https://api.github.com/repos/kmroz/ompi/releases{/id}","deployments_url":"https://api.github.com/repos/kmroz/ompi/deployments","created_at":"2016-04-01T17:19:47Z","updated_at":"2016-04-01T17:20:04Z","pushed_at":"2016-05-05T10:15:23Z","git_url":"git://github.com/kmroz/ompi.git","ssh_url":"git@github.com:kmroz/ompi.git","clone_url":"https://github.com/kmroz/ompi.git","svn_url":"https://github.com/kmroz/ompi","homepage":null,"size":87337,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"open-mpi:master","ref":"master","sha":"80f45925bc0dcb4362a03ea37e8ecbd2a53cdc46","user":{"login":"open-mpi","id":2165682,"avatar_url":"https://avatars.githubusercontent.com/u/2165682?v=3","gravatar_id":"","url":"https://api.github.com/users/open-mpi","html_url":"https://github.com/open-mpi","followers_url":"https://api.github.com/users/open-mpi/followers","following_url":"https://api.github.com/users/open-mpi/following{/other_user}","gists_url":"https://api.github.com/users/open-mpi/gists{/gist_id}","starred_url":"https://api.github.com/users/open-mpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-mpi/subscriptions","organizations_url":"https://api.github.com/users/open-mpi/orgs","repos_url":"https://api.github.com/users/open-mpi/repos","events_url":"https://api.github.com/users/open-mpi/events{/privacy}","received_events_url":"https://api.github.com/users/open-mpi/received_events","type":"Organization","site_admin":false},"repo":{"id":24107001,"name":"ompi","full_name":"open-mpi/ompi","owner":{"login":"open-mpi","id":2165682,"avatar_url":"https://avatars.githubusercontent.com/u/2165682?v=3","gravatar_id":"","url":"https://api.github.com/users/open-mpi","html_url":"https://github.com/open-mpi","followers_url":"https://api.github.com/users/open-mpi/followers","following_url":"https://api.github.com/users/open-mpi/following{/other_user}","gists_url":"https://api.github.com/users/open-mpi/gists{/gist_id}","starred_url":"https://api.github.com/users/open-mpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-mpi/subscriptions","organizations_url":"https://api.github.com/users/open-mpi/orgs","repos_url":"https://api.github.com/users/open-mpi/repos","events_url":"https://api.github.com/users/open-mpi/events{/privacy}","received_events_url":"https://api.github.com/users/open-mpi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-mpi/ompi","description":"Open MPI main development repository","fork":false,"url":"https://api.github.com/repos/open-mpi/ompi","forks_url":"https://api.github.com/repos/open-mpi/ompi/forks","keys_url":"https://api.github.com/repos/open-mpi/ompi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-mpi/ompi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-mpi/ompi/teams","hooks_url":"https://api.github.com/repos/open-mpi/ompi/hooks","issue_events_url":"https://api.github.com/repos/open-mpi/ompi/issues/events{/number}","events_url":"https://api.github.com/repos/open-mpi/ompi/events","assignees_url":"https://api.github.com/repos/open-mpi/ompi/assignees{/user}","branches_url":"https://api.github.com/repos/open-mpi/ompi/branches{/branch}","tags_url":"https://api.github.com/repos/open-mpi/ompi/tags","blobs_url":"https://api.github.com/repos/open-mpi/ompi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-mpi/ompi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-mpi/ompi/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-mpi/ompi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-mpi/ompi/statuses/{sha}","languages_url":"https://api.github.com/repos/open-mpi/ompi/languages","stargazers_url":"https://api.github.com/repos/open-mpi/ompi/stargazers","contributors_url":"https://api.github.com/repos/open-mpi/ompi/contributors","subscribers_url":"https://api.github.com/repos/open-mpi/ompi/subscribers","subscription_url":"https://api.github.com/repos/open-mpi/ompi/subscription","commits_url":"https://api.github.com/repos/open-mpi/ompi/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-mpi/ompi/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-mpi/ompi/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-mpi/ompi/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-mpi/ompi/contents/{+path}","compare_url":"https://api.github.com/repos/open-mpi/ompi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-mpi/ompi/merges","archive_url":"https://api.github.com/repos/open-mpi/ompi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-mpi/ompi/downloads","issues_url":"https://api.github.com/repos/open-mpi/ompi/issues{/number}","pulls_url":"https://api.github.com/repos/open-mpi/ompi/pulls{/number}","milestones_url":"https://api.github.com/repos/open-mpi/ompi/milestones{/number}","notifications_url":"https://api.github.com/repos/open-mpi/ompi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-mpi/ompi/labels{/name}","releases_url":"https://api.github.com/repos/open-mpi/ompi/releases{/id}","deployments_url":"https://api.github.com/repos/open-mpi/ompi/deployments","created_at":"2014-09-16T16:08:30Z","updated_at":"2016-05-05T15:06:37Z","pushed_at":"2016-05-06T01:23:31Z","git_url":"git://github.com/open-mpi/ompi.git","ssh_url":"git@github.com:open-mpi/ompi.git","clone_url":"https://github.com/open-mpi/ompi.git","svn_url":"https://github.com/open-mpi/ompi","homepage":null,"size":107315,"stargazers_count":175,"watchers_count":175,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":134,"mirror_url":null,"open_issues_count":273,"forks":134,"open_issues":273,"watchers":175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/open-mpi/ompi/pulls/1628"},"html":{"href":"https://github.com/open-mpi/ompi/pull/1628"},"issue":{"href":"https://api.github.com/repos/open-mpi/ompi/issues/1628"},"comments":{"href":"https://api.github.com/repos/open-mpi/ompi/issues/1628/comments"},"review_comments":{"href":"https://api.github.com/repos/open-mpi/ompi/pulls/1628/comments"},"review_comment":{"href":"https://api.github.com/repos/open-mpi/ompi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/open-mpi/ompi/pulls/1628/commits"},"statuses":{"href":"https://api.github.com/repos/open-mpi/ompi/statuses/29bc8ffc30fd1612ecf426188c61a55c297ca5e4"}}}}