AWS Thinkbox Discussion Forums

Forcing Blender to use GPU

By the way, I was testing this, as I am searching for a way to pass my own .py script as an argument.

I have found that the attached submission scripts do not work. With or without filling in additional arguments, the error is the same.

=======================================================
Error
=======================================================
Failed after four attempts to copy "Blender.param". Please make sure that the file exists in the plugin directory.

=======================================================
Type
=======================================================
Exception

=======================================================
Stack Trace
=======================================================
   at Deadline.Plugins.PluginUtils.a(Job bfr, UserInfo bfs, SlaveSettings bft, DataController bfu)
   at Deadline.Plugins.PluginUtils.SyncFilesForJob(Job job, UserInfo jobUser, Boolean cleanup, String& message, SlaveSettings workerSettings, DataController dataController)
   at Deadline.Plugins.SandboxedPlugin.SyncFilesForJob(Job job, Boolean cleanup, String& message, CancellationToken cancellationToken)
   at Deadline.Slaves.SlaveRenderThread.e(String ajs, Job ajt, CancellationToken aju)
   at Deadline.Slaves.SlaveRenderThread.b(TaskLogWriter ajo, CancellationToken ajp)
   at Deadline.Slaves.SlaveRenderThread.a()

I tried looking into it myself, but my development knowledge is very limited, I couldn’t find anything.

Ok, after some snooping around, I found that there are 2 files in the standard plugins/Blender folder, called Blender.options and Blender.param, that also need to be copied to the custom/plugins/Blender folder in order for this to work.

Additionally, I have found that blender will only run the python script after rendering the file, because the -P argument is at the end of the command.

It should be placed instead after the .blend path argument.

If anyone else needs this, I have attached the modifier Blender.py script.

Blender.py (8.2 KB)

2 Likes

Hello @Sergiu_Hulpe

Thanks for sharing the workaround. I’ll update my internal records.

Thanks for sharing - I was able to get Deadline to render on GPU with Blender.
But now i want to force deadline to use the OPTIX instead of CUDA.
The Problem is - I don’t know where to put in the -P Flag.
I put it in the additional arguments box but i think it didn’t work.
(also put in the BlenderForceGPUScript.py OPTIX instead of CUDA)
bpy.context.preferences.addons[‘cycles’].preferences.compute_device_type = ‘OPTIX’

Screenshot 2022-04-21 215718

Thanks for helping :heart:

Hi Marcus,

I am doing something similar to you, with loading starting a script, I am submitting the job straight from python, and it looks like this:

1 Like

added a comment below, not sure if you will get notified without me replying :smiley:

for some reason GPU rendering worked for me Out of the box on 2 windows machines running 3.1 with optix, just macOS not doing what I want, they just started supporting METAL anyone got this running? got some dual vega cards doing nothing.

I’ve been searching whether it’s possible to submit Blender GPU Cycles, there are plenty of old threads then I finally found this one! Thanks for sorting this

Can confirm this works on multi-gpu boxes and without it the jobs revert to CPU, will this be rolled out as a standard?

Thanks
Ant

I can confirm that it works! the only option is to make 2 files to switch between CUDA and OPTIX ?
Also it works with multigraphics!!

Hello again, I have edited the script to automatically fill in the path \ for the user, but when I call it I get one and I don’t know how to solve it.

Hello @Sergic

Apologies for late reply here.
It’s Python escaping slashes. Try to use it like this \\192.168… and then two slashes instead of one in the whole path.

He Ant

I know this reply is super late sorry about that. I do not think this can be added to standard submission scripts because these arguments are optional. Any command line argument can be passed here.

The actually functionality should be built to add support for GPU natively in the submission script. We already have a feature request for that.

If just that, I have it on the left side I call that line of code but it comes back with a / when I run the blender submit, I would like it to appear directly with //

Hello!

I have cleaned up the patch we had posted above, it was not working for me as well. The patch still has the same BlenderForceGPUScript.py file, but not is hardcoded to add the “-P” while rendering.
Attaching the zip file here, and the steps used to force GPU rendering with Blender:

  1. Replace your Blender application plugin files.
    Copy the Blender folder from the Step 1 folder into DeadlineRepository10\custom\plugins

  2. Replace the Blender submitter in the Monitor
    Copy the BlenderSubmission.py file from the Step 2 folder into DeadlineRepository10\custom\scripts\Submission

  3. When you’re submitting your job that needs to have GPU rendering enforced, add path to the “BlenderForceGPUScript.py” at the bottom of the submitter “Path to BlenderForceGPU Script” option.

Just make sure the Worker will be able to run BlenderForceGPUScript.py (included in the Step 3 folder) from wherever you’ve chosen to store it.

Updated Blender plugin files and it works fine with Deadline 10.3.0.x.
BlenderGPU Steps.zip (9.9 KB)

2 Likes

Hello, I had some questions about the installation of the scripts
When we move the step 1 and step 2 files, how does deadline know that it will look for the blender custom plug-in ? I had a last question to automate the addition of the force script BlenderForceGPUScript.py
thank you in advance for your answer

thank you very much for sharing the resources

For me it seems to work straight away, or am I missing anything?

Setup: Sending from Mac (Metal) to a PC with dual 3090 Tis using OptiX, both using Blender 3.4.

Does your code make it so we can’t add any other additional arguments anymore?

@Orage_studio, the custom folder gets the priority over the actual plugin/scripts folder in the Repository. So any customization stored under the custom folder would be pulled first and also survive the upgrade.

@sirhaffy, did you spend sometime on setting up the Blender as explained in the above threads? Share the logs or the error you ran into while setting up Blender GPU rendering.

@erlan_nephilim, you can add more arguments to Blender command-line using the submitter Additional Arguments. It will append those arguments to the Blender.

Hi,

I’ve followed the steps here but I’m getting the following error. I believe it’s something to do with the python version but I’m not a programmer. Does anyone know now to resolve this?

(for context, I’m trying to render with Blender 3.6 using GPU on Deadline)

Here’s the error:

2023-10-09 21:36:06: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2023-10-09 21:36:06: Exception Details

2023-10-09 21:36:06: RenderPluginException – The Deadline Plugin was not properly initialized. Application plugins must explicitly call super().__init__() in the Python constructor: def __init__().

2023-10-09 21:36:06: RenderPluginException.Cause: JobError (2)

2023-10-09 21:36:06: RenderPluginException.Level: Major (1)

2023-10-09 21:36:06: RenderPluginException.HasSlaveLog: True

2023-10-09 21:36:06: RenderPluginException.SlaveLogFileName: C:\ProgramData\Thinkbox\Deadline10\logs\deadlineslave_renderthread_0-DA-0000.log

2023-10-09 21:36:06: Exception.TargetSite: Deadline.Slaves.Messaging.PluginResponseMemento d(Deadline.Net.DeadlineMessage, System.Threading.CancellationToken)

2023-10-09 21:36:06: Exception.Data: ( )

2023-10-09 21:36:06: Exception.Source: deadline

2023-10-09 21:36:06: Exception.HResult: -2146233088

2023-10-09 21:36:06: Exception.StackTrace:

2023-10-09 21:36:06: at Deadline.Plugins.SandboxedPlugin.d(DeadlineMessage bgq, CancellationToken bgr)

2023-10-09 21:36:06: at Deadline.Plugins.SandboxedPlugin.Initialize(Job job, CancellationToken cancellationToken)

2023-10-09 21:36:06: at Deadline.Slaves.SlaveRenderThread.e(String ajx, Job ajy, CancellationToken ajz)

2023-10-09 21:36:06: at Deadline.Slaves.SlaveRenderThread.b(TaskLogWriter ajt, CancellationToken aju)

2023-10-09 21:36:06: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

By the look of it you’ve got a 10.2 Blender.py running on a 10.3 Worker. If you’re running the steps and files you downloaded from Karpreet’s post here, grab it again. 3 days ago he fixed it up to be 10.3 compatible, so you may just have an out of date file.

And be sure to either restart the Worker or submit a new job after getting the files in place, or else the old application plugin files will get used, and you’ll get the same error.

To be sure you’ve got files in the right spot, once you’re done there should be a DeadlineRepository10\custom\plugins\Blender\Blender.py that looks like this:

Privacy | Site terms | Cookie preferences