AWS Thinkbox Discussion Forums

Override plugin executable path for specific worker

I have two GPUs on one PC and I render in Blender, but this is applicable to any software that doesn’t support GPU affinity yet.
I have setup two different Blender versions in different paths. One renders on GPU1, the other renders on GPU2.
I would like to have each worker override the plugin path so that I can point them to the right path.
But I cannot find such an option in the worker properties.

Is there any way I can get this to work?

I can’t think of a built-in feature that will do what you’re asking, but if you’re somewhat comfortable with Python you could patch the Blender plugin to serve your needs.

General concept/brainstorm:

  1. Mark your alternative Blender path for the worker(s) in question

  2. Make a copy of the entire Blender folder and place it in custom:
    ./repository/plugins/Blender./repository/custom/plugins/Blender

  3. Modify the newly created ./repository/custom/plugins/Blender/Blender.py file:

    • Locate the RenderExecutable method. This is responsible for returning the path to the Blender executable
    • Before the return statement at the end, insert your own lookup against the current worker’s SlaveExtraInfoDictionary:
      •  # Untested
         worker = self.GetSlaveName()
         settings = RepositoryUtils.GetSlaveSettings(worker, True)
        
         blender_alt_path = settings.GetSlaveExtraInfoKeyValue('blender_alt_path')
         if blender_alt_path :
             return blender_alt_path 
        

Good luck :slight_smile:

2 Likes

If there was a way to set Blender’s GPU settings from the command line we could inherit the GPU affinity from the Worker, just like we do with Redshift.

However I’m failing to find anything on this page of blender docs and the command line flags only mention flags for troubleshooting GPU rendering. :broken_heart:

Otherwise, I think @danielskovli has got a solid plan here!

Edit: I bet if you were particularly clever with the script here Forcing Blender to use GPU - #16 by karpreet you could set each Worker to use a preconfigured GPU. Maybe even read the Worker’s GPU affinity and pass that along to the script.

Hi Danielskovli,
your solution worked flawlessly without any modification, you just saved me days of wandering around the docs and the code, thank you!

@JustinB thank you for the alternative solution! I am pretty sure you can select the GPU from the command line + an embedded python script in Blender that you can select with an option, but the only script code examples I can find are too outdated and give me runtime errors in Blender, and I am not experienced enough to fix that.

2 Likes
Privacy | Site terms | Cookie preferences