{"id":4583,"date":"2013-05-17T09:00:14","date_gmt":"2013-05-17T13:00:14","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=4583"},"modified":"2019-06-02T10:05:31","modified_gmt":"2019-06-02T14:05:31","slug":"benchmarking-your-gpu","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2013\/05\/17\/benchmarking-your-gpu\/","title":{"rendered":"Benchmarking your GPU"},"content":{"rendered":"\r\n<div class=\"content\"><p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/15007\">Jiro<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/34080\">GPUBench<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/80363\">Ben Tordoff<\/a>.<\/p><p>Some of you may know of the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/bench.html\"><tt>bench<\/tt><\/a> function. It allows you to benchmark your MATLAB on your machine and compare it against other machines. It performs some mathematical computation tests, as well as graphics tests. <i>Note, as mentioned in the documentation, that <tt>bench<\/tt> is for comparing a particular version of MATLAB on different machines, not comparing different versions of MATLAB on a single machine.<\/i><\/p><p><tt>GPUBench<\/tt> is <a href=\"http:\/\/en.wikipedia.org\/wiki\/Graphics_Processing_Unit\">GPU<\/a> version of <tt>bench<\/tt>. With <a href=\"https:\/\/www.mathworks.com\/products\/parallel-computing\/\">Parallel Computing Toolbox<\/a>, you can perform MATLAB computations on NVIDIA CUDA GPUs with <a href=\"https:\/\/developer.nvidia.com\/cuda-gpus\">Compute Capability<\/a> of 1.3 or greater. But your mileage may vary depending on the hardware you have. Sometimes, looking at just the Compute Capability may not be enough to see if one card is better than another for MATLAB computations. <tt>GPUBench<\/tt> will test your card and compare with other common GPU cards. Here's a sample table that gets generated from the benchmark. It reports in <a href=\"http:\/\/en.wikipedia.org\/wiki\/FLOPS\">gigaFLOPS<\/a>, so higher the number, the better the performance.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_gpubench\/potw_gpubench_chart.png\" alt=\"\"> <\/p><p>When I bought a MacBookPro last year and noticed that it had a supported GPU card, I ran the benchmark on it and got the following result. <i>Note that this was done with an older version, so the list of cards is a bit old.<\/i><\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_gpubench\/potw_gpubench_mac_chart.png\" alt=\"\"> <\/p><p>The \"Host PC\" refers to the CPU on my Mac, and \"GeForce GT 650M\" is the GPU that's equipped. We can see that the GPU seems to outperform the CPU on single-precision computations but not so much on double-precision computations.<\/p><p>Ben periodically updates the data files to include the newer GPU models that have come out. As of the writing of this post, the version includes benchmark data for K20.<\/p><p><b>Comments<\/b><\/p><p>Do you use GPUs, or are you interested in using GPUs for your work? Let us know about it <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=4583#respond\">here<\/a>. If you do GPU computing in MATLAB, give this App a try and leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/34080#comments\">comment<\/a> for Ben.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_8cdb5f2a63b84f52822c3764b182fc31() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='8cdb5f2a63b84f52822c3764b182fc31 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 8cdb5f2a63b84f52822c3764b182fc31';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2013 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_8cdb5f2a63b84f52822c3764b182fc31()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2013a<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2013a<br><\/p><\/div><!--\r\n8cdb5f2a63b84f52822c3764b182fc31 ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/15007\r\n% Jiro>'s pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/34080 GPUBench> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/80363 Ben\r\n% Tordoff>.\r\n%\r\n% Some of you may know of the\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/bench.html |bench|> function.\r\n% It allows you to benchmark your MATLAB on your machine and compare it\r\n% against other machines. It performs some mathematical computation tests,\r\n% as well as graphics tests. _Note, as mentioned in the documentation, that\r\n% |bench| is for comparing a particular version of MATLAB on different\r\n% machines, not comparing different versions of MATLAB on a single\r\n% machine._\r\n%\r\n% |GPUBench| is <http:\/\/en.wikipedia.org\/wiki\/Graphics_Processing_Unit GPU>\r\n% version of |bench|. With\r\n% <https:\/\/www.mathworks.com\/products\/parallel-computing\/ Parallel Computing\r\n% Toolbox>, you can perform MATLAB computations on NVIDIA CUDA GPUs with\r\n% <https:\/\/developer.nvidia.com\/cuda-gpus Compute Capability> of 1.3 or\r\n% greater. But your mileage may vary depending on the hardware you have.\r\n% Sometimes, looking at just the Compute Capability may not be enough to\r\n% see if one card is better than another for MATLAB computations.\r\n% |GPUBench| will test your card and compare with other common GPU cards.\r\n% Here's a sample table that gets generated from the benchmark. It reports\r\n% in <http:\/\/en.wikipedia.org\/wiki\/FLOPS gigaFLOPS>, so higher the number,\r\n% the better the performance.\r\n%\r\n% <<potw_gpubench_chart.png>>\r\n%\r\n% When I bought a MacBookPro last year and noticed that it had a supported\r\n% GPU card, I ran the benchmark on it and got the following result. _Note\r\n% that this was done with an older version, so the list of cards is a bit\r\n% old._\r\n%\r\n% <<potw_gpubench_mac_chart.png>>\r\n%\r\n% The \"Host PC\" refers to the CPU on my Mac, and \"GeForce GT 650M\" is the\r\n% GPU that's equipped. We can see that the GPU seems to outperform the CPU\r\n% on single-precision computations but not so much on double-precision\r\n% computations.\r\n%\r\n% Ben periodically updates the data files to include the newer GPU models\r\n% that have come out. As of the writing of this post, the version includes\r\n% benchmark data for K20.\r\n% \r\n% *Comments*\r\n%\r\n% Do you use GPUs, or are you interested in using GPUs for your work? Let\r\n% us know about it <https:\/\/blogs.mathworks.com\/pick\/?p=4583#respond here>.\r\n% If you do GPU computing in MATLAB, give this App a try and leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/34080#comments\r\n% comment> for Ben.\r\n\r\n##### SOURCE END ##### 8cdb5f2a63b84f52822c3764b182fc31\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_gpubench\/potw_gpubench_chart.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nJiro's pick this week is GPUBench by Ben Tordoff.Some of you may know of the bench function. It allows you to benchmark your MATLAB on your machine and compare it against other machines. It... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2013\/05\/17\/benchmarking-your-gpu\/\">read more >><\/a><\/p>","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4583"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=4583"}],"version-history":[{"count":7,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4583\/revisions"}],"predecessor-version":[{"id":10787,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4583\/revisions\/10787"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=4583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=4583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=4583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}