{"id":1776,"date":"2023-05-29T18:33:54","date_gmt":"2023-05-29T22:33:54","guid":{"rendered":"https:\/\/www.wellformedness.com\/blog\/?p=1776"},"modified":"2023-05-29T18:33:54","modified_gmt":"2023-05-29T22:33:54","slug":"debugging-cuda-indexing-errors","status":"publish","type":"post","link":"https:\/\/www.wellformedness.com\/blog\/debugging-cuda-indexing-errors\/","title":{"rendered":"Debugging CUDA indexing errors"},"content":{"rendered":"<p>Perhaps you&#8217;ve seen pages of the following scary error:<\/p>\n<pre>..\/aten\/src\/ATen\/native\/cuda\/IndexKernel.cu:92: operator(): block: [99,0,0], thread: [115,0,0] Assertion `index &gt;= -sizes[i] &amp;&amp; index &lt; sizes[i] &amp;&amp; \"index out of bounds\"` failed.<\/pre>\n<p>It turns out there is a relatively simple way to figure out what the indexing issue is. The internet suggests prepending<\/p>\n<pre>CUDA_LAUNCH_BLOCKING=1<\/pre>\n<p>to your command, but this doesn&#8217;t seem to help much either. There is a simpler solution: run whatever you&#8217;re doing on CPU. It&#8217;ll give you much nicer errors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perhaps you&#8217;ve seen pages of the following scary error: ..\/aten\/src\/ATen\/native\/cuda\/IndexKernel.cu:92: operator(): block: [99,0,0], thread: [115,0,0] Assertion `index &gt;= -sizes[i] &amp;&amp; index &lt; sizes[i] &amp;&amp; &#8220;index out of bounds&#8221;` failed. It turns out there is a relatively simple way to figure out what the indexing issue is. The internet suggests prepending CUDA_LAUNCH_BLOCKING=1 to your command, but &hellip; <a href=\"https:\/\/www.wellformedness.com\/blog\/debugging-cuda-indexing-errors\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Debugging CUDA indexing errors&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[3,5,8],"tags":[],"class_list":["post-1776","post","type-post","status-publish","format-standard","hentry","category-dev","category-nlp","category-python"],"_links":{"self":[{"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/posts\/1776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/comments?post=1776"}],"version-history":[{"count":1,"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/posts\/1776\/revisions"}],"predecessor-version":[{"id":1777,"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/posts\/1776\/revisions\/1777"}],"wp:attachment":[{"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/media?parent=1776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/categories?post=1776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellformedness.com\/blog\/wp-json\/wp\/v2\/tags?post=1776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}