{"id":5064,"date":"2014-03-30T18:31:21","date_gmt":"2014-03-30T18:31:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/cuda-texture-memory-to-bind-a-sub-portion-of-global-memory-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:31:21","modified_gmt":"2014-03-30T18:31:21","slug":"cuda-texture-memory-to-bind-a-sub-portion-of-global-memory-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/cuda-texture-memory-to-bind-a-sub-portion-of-global-memory-collection-of-common-programming-errors\/","title":{"rendered":"CUDA texture memory to bind a sub-portion of global memory-Collection of common programming errors"},"content":{"rendered":"<p>I am having problem binding to texture memory a sub-portion of global device memory.<\/p>\n<p>I have a large global device array filled with memory as follows:<\/p>\n<blockquote>\n<p>double * device_global;<\/p>\n<p>cudaMalloc((void **)&amp;device_global, sizeof(double)*N));<\/p>\n<p>cudaMemcpy(device_global, host, sizeof(double)*N, cudaMemcpyHostToDevice) );<\/p>\n<\/blockquote>\n<p>I am running numerous kernels in a for loop.<\/p>\n<p>Each kernel required a small portion (int offset = 100) of <code>device_global<\/code> which I am binding to a texture through:<\/p>\n<blockquote>\n<p>cudaBindTexture(0, texRef, device_global, channelDesc, sizeof(double)*10);<\/p>\n<\/blockquote>\n<p>However the problem I am facing is that I am unable to use pointer arithmetic to only bind a looping section of <code>device_global<\/code> via an offset that loops.<\/p>\n<p>I would like to do something like:<\/p>\n<blockquote>\n<p>cudaBindTexture(0, texRef, device_global+ offsett * i , channelDesc, sizeof(double)*10);<\/p>\n<\/blockquote>\n<p>it should be noted that the above approach does work if the offset is set to 0, somehow the pointer arithmetic does not work.<\/p>\n<p>Any help or other guidelines would be much appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am having problem binding to texture memory a sub-portion of global device memory. I have a large global device array filled with memory as follows: double * device_global; cudaMalloc((void **)&amp;device_global, sizeof(double)*N)); cudaMemcpy(device_global, host, sizeof(double)*N, cudaMemcpyHostToDevice) ); I am running numerous kernels in a for loop. Each kernel required a small portion (int offset = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5064","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5064"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5064\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}