This question is a bit vague - mainly because I’m not entirely sure what I’m looking for.
However, I’ve written a Rhino plugin that interacts with Cuda. It does this through a third party functionality (i.e. I use a third party library to create a class that sets up Cuda, GPU Dispatching, etc…). All this actually works fine when the plugin is double clicked from the file system, i.e. when it is “first” loaded. Once Rhino opens, and the “Plugin loaded successfully” text appears, I can create and destroy the Cuda interaction stuff just fine. Same with running it in debug mode through VS.
Now, my problem is that if I close Rhino and then reopen it, my plugin can’t create the Cuda interaction class. So, my question is, what is the difference (if any) between loading up the plugin via double clicking it vs. simply opening Rhino? Is it possible to get the first behaviour programmatically? Any related info is also welcome.
Plug-ins can load at start-up or when needed. The latter is default, that means that Rhino knows the command names after the plug-in has loaded at least once and will load the plug-in when the first command is executed.
The loading behavior can be changed, but the method depends on whether you make a C++ or C# plugin.
Yes, I’ve played around with changing the load time, but it didn’t help. Any idea what exactly happens when, say, I load the plugin after a new build? Like when you hit debug in VS?
My problem goes away when the plugin is “first” loaded (i.e. before Rhino creates a registry entry for it, I think?), so I’m trying to emulate that sort of thing. What about a unloading the plugin on shutdown? This post seems to say it is not possible, but I think GH has that functionality.
It is entirely possible that this not a Rhino issue, I’m just looking around for more info.
As you probably know there are also functions to override for when the plug-in is shutting down (i.e. Rhino shutdown).
Solving the problem depends, I think, on the specifics of the CUDA interface. Do you have more info on the use of the interface?
Just FYI I’m working on a plugin that integrates the Blender Cycles render engine. I can start Rhino and render with Cycles on the GPU with CUDA just fine between runs, without having to double-click the plugin.
Are you sure that the releasing the CUDA resources is done properly in your plugin?
Interesting (both about using Cycles and the fact that your plugin works)… I’ll do some more tests on releasing the CUDA resource.