René's URL Explorer Experiment


Title: array.device is sometimes returning raw pointers · Issue #1450 · arrayfire/arrayfire · GitHub

Open Graph Title: array.device is sometimes returning raw pointers · Issue #1450 · arrayfire/arrayfire

X Title: array.device is sometimes returning raw pointers · Issue #1450 · arrayfire/arrayfire

Description: I am mixing CUDA and arrayfire code extensively. I am using CUDA surface objects, so I need to do a copy from the arrayfire device memory to the cuda array memory. Currently, I'm using cudaMemcpy3D(), and I am assuming that the arrayfire...

Open Graph Description: I am mixing CUDA and arrayfire code extensively. I am using CUDA surface objects, so I need to do a copy from the arrayfire device memory to the cuda array memory. Currently, I'm using cudaMemcpy3D...

X Description: I am mixing CUDA and arrayfire code extensively. I am using CUDA surface objects, so I need to do a copy from the arrayfire device memory to the cuda array memory. Currently, I'm using cudaMemc...

Opengraph URL: https://github.com/arrayfire/arrayfire/issues/1450

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"array.device is sometimes returning raw pointers","articleBody":"I am mixing CUDA and arrayfire code extensively. I am using CUDA surface objects, so I need to do a copy from the arrayfire device memory to the cuda array memory. Currently, I'm using cudaMemcpy3D(), and I am assuming that the arrayfire data is in packed form, in H x W x C order (height varies first.) I'm using float32 elements here.\n\nHere's the code I use:\n\n```\n// release any previous content, make a cuda array, copy from arrayfire array\nvoid CudaArray::to_surface(const af::array \u0026in) \n{\n    if (in.dims()[3] != 1)\n        throw \"CudaArray: attempt to allocate a 4D CUDA surface\";\n\n    // free up old CUDA array and allocate new one\n    free();\n    dims_ = in.dims();\n    allocate();\n\n    void *d_srcptr = in.device\u003cfloat\u003e();    // does an implicit eval()\n    af::sync();     // ensure all arrayfire work is complete before we trigger CUDA code\n\n    cudaMemcpy3DParms params = { 0 };\n    params.srcPtr = make_cudaPitchedPtr(d_srcptr, dims_[0] * sizeof(float), dims_[0], dims_[1]);    // dims[0] is what varies fastest\n    params.dstArray = cuda_array;\n    params.kind = cudaMemcpyDeviceToDevice;\n    params.extent = make_cudaExtent(dims_[0], dims_[1], dims_[2]);\n\n    checkCuda(cudaMemcpy3D(\u0026params));\n    in.unlock();                        // done with d_srcptr\n}\n```\n\nI use the following to get the data out of the surface back to an array:\n\n```\n// make a new arrayfire array, copy data from surface to the array\naf::array CudaArray::to_array() \n{\n    // ensure CUDA is done before we start copying\n    checkCuda(cudaDeviceSynchronize());\n    checkCuda(cudaGetLastError());\n\n    af::array out(dims_);\n\n    void *d_dstptr = out.device\u003cfloat\u003e();\n\n    cudaMemcpy3DParms params = { 0 };\n    params.srcArray = cuda_array;\n    params.dstPtr = make_cudaPitchedPtr(d_dstptr, dims_[0] * sizeof(float), dims_[0], dims_[1]);\n    params.kind = cudaMemcpyDeviceToDevice;\n    params.extent = make_cudaExtent(dims_[0], dims_[1], dims_[2]);\n\n    checkCuda(cudaMemcpy3D(\u0026params));\n    out.unlock();                       // done with d_dstptr\n\n    return out;\n}\n```\n\nEverything works fine as long as to_surface() is invoked only on a fresh array, i.e., an array created by `array foo = loadImage(\"file.png\", true); CudaArray baz(foo);   // this works just fine`\n\nHowever, if I do any kind of arrayfire processing on the array, e.g.,\n\n```\narray subwindow(const array \u0026in)\n{\n    int h = in.dims()[0], w = in.dims()[1];\n    array out = in(seq(h/4, h/4+h/2-1), seq(w/4, w/4+w/2-1), span);\n    return out;\n}\n\nint main()\n{\n    af::setDevice(0); .. make a window ..\n\n    array in = loadImage(\"baz.jpg\", true);\n    in = subwindow(in);          // remove this line and the code works\n    CudaArray baz(in);\n    win.image(in.to_array());  // shows what appears to be result of a bad stride \n}\n```\n\nSo the question is, after the call to subwindow, is the memory layout of the array in still tightly packed with floats with no padding and a pitch in bytes equal to the height \\* 4?\n","author":{"url":"https://github.com/AEHousman","@type":"Person","name":"AEHousman"},"datePublished":"2016-06-06T00:07:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/1450/arrayfire/issues/1450"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7b882db4-a014-5f8b-f427-03b25f6e1cf7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCB9A:96AF8:A6489:DEB68:6969C434
html-safe-nonce3d8dc42ae54cf08b0bc86d23fbc31997757f998633d0cd0a23811b2026e77161
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjlBOjk2QUY4OkE2NDg5OkRFQjY4OjY5NjlDNDM0IiwidmlzaXRvcl9pZCI6IjkyMDgyNjk0MDQ2MDIyMjE2MjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac74b427e191433e57f1e90411da8bc2b65a581c0ec28a911e6ffc501bb1b5ed84
hovercard-subject-tagissue:158582503
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/arrayfire/arrayfire/1450/issue_layout
twitter:imagehttps://opengraph.githubassets.com/43a7d826906e173df8095c49776165c94e0ae30232d1c09492baf02dc623e127/arrayfire/arrayfire/issues/1450
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/43a7d826906e173df8095c49776165c94e0ae30232d1c09492baf02dc623e127/arrayfire/arrayfire/issues/1450
og:image:altI am mixing CUDA and arrayfire code extensively. I am using CUDA surface objects, so I need to do a copy from the arrayfire device memory to the cuda array memory. Currently, I'm using cudaMemcpy3D...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAEHousman
hostnamegithub.com
expected-hostnamegithub.com
Noneacedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056
turbo-cache-controlno-preview
go-importgithub.com/arrayfire/arrayfire git https://github.com/arrayfire/arrayfire.git
octolytics-dimension-user_id5395442
octolytics-dimension-user_loginarrayfire
octolytics-dimension-repository_id25889802
octolytics-dimension-repository_nwoarrayfire/arrayfire
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id25889802
octolytics-dimension-repository_network_root_nwoarrayfire/arrayfire
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release83c08c21cdda978090dc44364b71aa5bc6dcea79
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/arrayfire/arrayfire/issues/1450#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Farrayfire%2Farrayfire%2Fissues%2F1450
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Farrayfire%2Farrayfire%2Fissues%2F1450
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=arrayfire%2Farrayfire
Reloadhttps://github.com/arrayfire/arrayfire/issues/1450
Reloadhttps://github.com/arrayfire/arrayfire/issues/1450
Reloadhttps://github.com/arrayfire/arrayfire/issues/1450
arrayfire https://github.com/arrayfire
arrayfirehttps://github.com/arrayfire/arrayfire
Notifications https://github.com/login?return_to=%2Farrayfire%2Farrayfire
Fork 549 https://github.com/login?return_to=%2Farrayfire%2Farrayfire
Star 4.8k https://github.com/login?return_to=%2Farrayfire%2Farrayfire
Code https://github.com/arrayfire/arrayfire
Issues 285 https://github.com/arrayfire/arrayfire/issues
Pull requests 18 https://github.com/arrayfire/arrayfire/pulls
Actions https://github.com/arrayfire/arrayfire/actions
Projects 0 https://github.com/arrayfire/arrayfire/projects
Wiki https://github.com/arrayfire/arrayfire/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/arrayfire/arrayfire/security
Please reload this pagehttps://github.com/arrayfire/arrayfire/issues/1450
Insights https://github.com/arrayfire/arrayfire/pulse
Code https://github.com/arrayfire/arrayfire
Issues https://github.com/arrayfire/arrayfire/issues
Pull requests https://github.com/arrayfire/arrayfire/pulls
Actions https://github.com/arrayfire/arrayfire/actions
Projects https://github.com/arrayfire/arrayfire/projects
Wiki https://github.com/arrayfire/arrayfire/wiki
Security https://github.com/arrayfire/arrayfire/security
Insights https://github.com/arrayfire/arrayfire/pulse
New issuehttps://github.com/login?return_to=https://github.com/arrayfire/arrayfire/issues/1450
New issuehttps://github.com/login?return_to=https://github.com/arrayfire/arrayfire/issues/1450
array.device is sometimes returning raw pointershttps://github.com/arrayfire/arrayfire/issues/1450#top
bughttps://github.com/arrayfire/arrayfire/issues?q=state%3Aopen%20label%3A%22bug%22
3.4.0https://github.com/arrayfire/arrayfire/milestone/14
https://github.com/AEHousman
https://github.com/AEHousman
AEHousmanhttps://github.com/AEHousman
on Jun 6, 2016https://github.com/arrayfire/arrayfire/issues/1450#issue-158582503
bughttps://github.com/arrayfire/arrayfire/issues?q=state%3Aopen%20label%3A%22bug%22
3.4.0https://github.com/arrayfire/arrayfire/milestone/14
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.