Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by M_Shihab · Jul 05, 2016 at 04:09 PM · parallel

CUDA programming

Hi All

I would like to ask if it is possible to run CUDA with Unity ?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image doublemax · Sep 13, 2016 at 03:44 PM 0
Share

As alternative to CUDA check out Unity's compute shaders:
https://docs.unity3d.com/$$anonymous$$anual/ComputeShaders.html

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by ermal · Aug 12, 2016 at 01:48 AM

Yes, it is, but you have to develop a DLL native plugin to do this.

I'm currently successfully doing OpenGL (GLCore) and D3D11 interop with CUDA from Unity textures.

All CUDA mapping, unmapping and registering/unregistering of textures and OpenGL/Direct3D objects has to be done from the render thread.

It took me a while to figure this out, but essentially you have to get the native texture pointers from your Unity code into your native CUDA DLL.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hyqneuron · Sep 13, 2016 at 03:31 PM 0
Share

Would you $$anonymous$$d sharing some sample code to help us get started quicker? Thanks!

avatar image klivert80 · Nov 17, 2018 at 08:51 PM 0
Share

Do you have a sample code showing how to update the texture because I am mapping the texture with cuda using nativeplugin dll but the texture is´not updating its data though cuda$$anonymous$$emcpy is returning no error ..would you $$anonymous$$d share a sample. Thanks anyway

avatar image EyePD · Dec 02, 2019 at 08:25 PM 0
Share

Thanks, this has really helped me. I'm freeing my CUDA resources via GL.IssuePluginEvent and now things are much more stable. Were there any resources you came across that helped you figure this out or was it your own discovery?

I'm able to free resources as needed at runtime but I'm still trying to figure out the best way to get everything cleaned up when the application is shutting down. It seems that somehow I need to know which GL.IssuePluginEvent is going to be the last one and then on that call I could set the eventId parameter to some special value like -1. Perhaps if there's still one more render call after OnApplicationQuit I could set some flag from there.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

64 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Jobs not running in working threads 0 Answers

Passing local variables to struct 1 Answer

How to remove as intersections on parallel lines? 0 Answers

Forcing NavMeshAgent to follow Parallel to the player 0 Answers

Paralel Scene Loading for Adventure Game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges