Jump to content

Render multiple OpenGL ROPs simultaneously (win10)


ikoon

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
Link to comment
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)

 

Link to comment
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
Link to comment
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)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...