Jump to content
ikoon

Render multiple OpenGL ROPs simultaneously (win10)

Recommended Posts

I use OpenGL ROP a lot, and I usually have more of them. They usually can render simultaneously without decrease of speed, usually run single threaded, hundreds of frames. I am on windows 10.

The simplest way I found so far is to manually start Command Line Tools (CLT), generate the following script from selected ROP and paste it into CLT window ... and the render starts in that CLT.

hython "Q:\bl\5 houdini\bl - v07.hiplc"
node = hou.node('/obj/rop_OGL/strict2')
node.render(verbose=True,output_progress=True)

 

Please, is there any way to automate this better?
Can I run new hython instance from Houdini UI, and pass appropriate script to it?
Ideally, I would like to edit the houdini.env for each new hython, so I could use all of the GPUs (I can do this with python)

Edited by ikoon

Share this post


Link to post
Share on other sites
I solved it by creating windows batch... I thought, that I have to run hython from Command Line Tools ... but when I run it with full $HB path, it seems to work fine. This is the contents of batch.bat:
start "just title: bat1" "C:\Program Files\Side Effects Software\Houdini 17.0.382\bin\hython.exe" C:\Users\info\Desktop\bat1.py 
start "just title: bat2" "C:\Program Files\Side Effects Software\Houdini 17.0.382\bin\hython.exe" C:\Users\info\Desktop\bat2.py

Those two "start" are there to run both hythons simultaneously. The bat1.py contains:

hou.hipFile.load("Q:/bl/5 houdini A/bl - A - v07.hiplc")
node = hou.node('/obj/rop_OGL/strict1')
node.render(verbose=True,output_progress=True)

 

Share this post


Link to post
Share on other sites

That's the correct way to do it if you want true parallelism. You can't render multiple GL ROPs within the same session simultaneously.

You could use ROP dependencies to render frame 1 of GLrop A, frame 1 of GLrop B, frame 2 of A, frame 2 of B, etc, however this just interleaves the rendering in the same session. It doesn't render the frames at the same time.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you very much for a confirmation, Mark.

So I did a script, which creates .py file for each selected ROP and also creates .bat file, which launches hython for each created .py to run them simultaneously.

I will investigate the possibility to assign different GPUs to each hython (HOUDINI_OCL_DEVICENUMBER variable is not taken into account here).

 

# create .py script for each selected ROP, to render it
# create .bat file, which renders all the created .py with hython simultaneously
def batch_script_rop () :

    import os

    path_hip     = hou.expandString('$HIP')
    path_hipfile = hou.expandString('$HIPFILE')
    path_hython  = hou.expandString('$HB') + '/hython.exe'
    path_scripts = path_hip + '/scripts/'

    if not os.path.exists(path_scripts):
        os.makedirs(path_scripts)

    script_bat = 'REM This batch file runs multiple .py scripts at once \n'

    for rop in hou.selectedNodes() :
        # .py script
        script_rop  = '# This .py script opens a file and renders single rop\n'
        script_rop += 'hou.hipFile.load("' + path_hipfile + '")\n'
        script_rop += 'node = hou.node("' + rop.path() + '")\n'
        script_rop += 'node.render(verbose=True,output_progress=True)'
        
        # write .py to disk
        path_py = path_scripts + rop.name() + '.py'
        file_py = open( path_py, "w")
        file_py.write(script_rop)

        # .bat script
        script_bat += 'start "Render: ' + rop.name() + '" "'
        script_bat += path_hython + '" "'
        script_bat += path_py + '"\n'


    # write .bat to disk
    path_bat = path_hip + '/_render.bat'
    file_rop = open( path_bat, "w")
    file_rop.write(script_bat)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×