CommandLine plugin gpu affinity

Hello :slight_smile:

I’m trying to add gpu affinity on to the CommandLine plugin.

I got it working, but not sure if it’s the correct way :confused: End goal is to make a Houdini Solaris Husk plugin.

What i have done so far is to steal a python modules from the Redshift.py plugin.

This is the module “def getGPUList”. Seems to work fine, it prints the correct gpu affinity.

But this code i can’t get to work and i don’t know why :confused:

    gpus = self.getGPUList()
    if len(gpus) > 0:
        self.SetEnvironmentVariable('REDSHIFT_GPUDEVICES', ','.join(gpus))

The rendernodes will not pickup the environment variable that sets active GPUs.

What i ended up doing is to use the regular python environment setup i have used before, like this.

    gpus = self.getGPUList()
    if len(gpus) > 0:
        os.environ["REDSHIFT_GPUDEVICES"] = ','.join(gpus)

But i’m not sure if this can create issues? Husk.py (12.3 KB)

If you look at the Scripting Documentation,

void SetEnvironmentVariable (string key, string value)
Sets extra environment variables for the rendering process only. This will take precedence over a variable in the current environment with the same name.

So that function only affects a process started by an advanced Deadline plugin (one that launches a managed process). It does not affect the actual environment, which you solved by using the regular Python env. function.

Thank you for the super quick reply!

So all is good then? Suppose i don’t need to use a advanced Deadline plugin? Husk only uses super simple commands, and the stdout appears in monitor :slight_smile:

Reason i ask is because i get some errors when rendering at random times, and when the machine have startet with the errors, i have to restart the rendernode for it to work again. Here is the log job_with_error.zip (11.3 KB) if you want to take a look, but i suppose this is a Husk or Redshift issue?

The only thing left on the plugin side to get working is the progress bar(Redshift) in Monitor, but i will try on my own first, plan is to steal more code from the Redshift.py plugin :stuck_out_tongue:

And thanks again for the quick reply :slight_smile: