GPU-Enabled VirtualGL session for interactive desktops

Hello,

We have a compute node with Nvidia GPU installed. We want the user to be able to request an interactive desktop session to that node with or without gpu acceleration.

Now, we’ve been able get the VNC session working outside of ood using the steps roughly in this webpage:
https://www.mn.uio.no/geo/english/services/it/help/using-linux/vnc.html
the steps in the link don’t directly run a vnc session that has gpu-enabled. In order to use gpu for any application within that session, we had to use vglrun <app>. Having to do this for each application is annoying.

To have a VNC session that has gpu enabled, we had to use /opt/TurboVNC/bin/vncserver -xstartup "vglrun startxfce4" instead of /opt/TurboVNC/bin/vncserver command mentioned on that webpage. In this way, all applications within this vnc session can utilize gpu without having to use vglrun.

Now within OOD, when I request a desktop session, I want to be able to have a similar gpu-enabled interactive desktop session once a user requests gpu, but I’m not sure how to enable that. I suspect it requires some meddling with the xfce desktop startup script? But I doubt if it’s at all possible to put the logic inside the startup script that checks if the user has requested gpu or not. Please let me know of any possible solutions and if I’m missing something here.

Thanks,

Hello and thanks for the question.

It might be possible using ERB to use some logic to use gpu or not.

Within the script you could have logic to check if the user has selected a gpu within a shell.sh.erb file like so:

<%- if condition %>
  # place this code in the file
  echo "condition was true"
<%- end %>

This then will then execut the code in the script file if the condition is true, otherwise it passes on and it’s as though that block of code was never in the script.sh.erb file.

Is this the type of functionality you are hoping for?

With this you could maybe do something like the following in the script.sh.erb:

<%- if gpu_enabled -%>
  /opt/TurboVNC/bin/vncserver -xstartup "vglrun startxfce4"
<%- else -%>
  echo "Launching desktop '<%= context.desktop %>'..."
  source "<%= session.staged_root.join("desktops", "#{context.desktop}.sh") %>"
  echo "Desktop '<%= context.desktop %>' ended..."
<%- end -%>

Thank you for this suggestion. It looks like it’s going to work. I suspect I’ll have to modify /var/www/ood//apps/sys/bc_desktop/template/script.sh.erb file. One issue that we find with modifying the file here is that it’s prone to being overwritten by ood updates. Is there a way for templating this file that would be safe across updates?

For example, if I create a template directory at /etc/ood/config/apps/bc_desktop/template, copy the script.sh.erb file to it and make the changes that you described above. Would ood start using /etc/ood/config/apps/bc_desktop/template/script.sh.erb instead for each new session? Please let me know if that works or if there’s a better solution.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.