Dual GPU Passthrough on Proxmox

This post explains how I managed to pass through some old NVIDIA GTX1060 cards to two Rocky Linux VMs on Proxmox 9. One of those virtual machines is even able to make use of a local monitor and keyboard/mouse while the other VM will be for remote desktop access only. This was pretty straightforward in hindsight except that tutorials on the web were often a few years old and did different things, so I was unsure at first which pieces of advice were still valid.

Skip down to “How To” if you’re in a hurry.

In VFX studios people who usually are not working on beefy workstations might still have to play back 4K video or review full-resolution files (OpenEXR in our case). While mini PCs (HP EliteDesk, Zotac, Forum Mini and what not) with often just 16GB of RAM and onboard graphics are more than enough for some spreadsheet and database work, the playing back of video once or twice a day would really benefit from more power.

Setup

We had an old HP Z820 workstation around and old GPUs that were no longer up to the task for actual VFX work in Nuke. The workstation, however, has dual 16 core CPUs, 128 GB or RAM and server-grade hardware inside (I don’t get any money from HP for saying this but I like their workstations and we’ve been using refurbished models from Z800 to Z8G4). There’s enough room to fit 2 consumer-grade graphics cards from MSI in there and the PSU can handle them easily (each one needs a single 6-pin PCIe power cable).

I installed a default no-frills Proxmox PVE 9 on a 500 GB SSD which has enough space for two VM images that need to contain a full Rocky Linux 9 installation with a graphical desktop environment. Any smarter setups in terms of storage are beyond the scope of my tutorial.

How To

First, Proxmox itself needs to be modified a bit. It must not load any graphics drivers during its boot process as this would prevent the graphics cards from being passed through to a VM. It’s probably best to install all available system updates first and reboot in case of a kernel update. Check that you have both SSH access and that the Proxmox web GUI is working fine.

Create /etc/modprobe.d/blacklist.conf and enter these lines to prevent Proxmox from using these kernel modules:

blacklist nouveau
blacklist nvidia

Modify the GRUB_CMDLINE_LINUX_DEFAULT line /etc/default/grub (you can duplicate it and add a # in front of it to preserve the original line in case you want to undo this later):

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"

Run update-grub afterwards!

IOMMU is Intel’s name for the feature that allows passing devices to VMs. It can only work if it is supported and enabled, which was true for an old machine like my HP Z820 workstation so it’s probably supported on all modern hardware (it’s called VT-d inside the HP BIOS).

Create /etc/modules-load.d/vfio.conf and add these lines to load some more required modules.

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

Once this is done, you can reboot your Proxmox PVE and you’re done with meddling on the command-line. If you have a monitor connected it should stay blank and not show the Proxmox terminal login anymore.

Note:

The article I’ve mostly followed myself contains more information about IOMMU groups. It was not necessary to deal with this in my case, probably due to the good server-grade hardware I had.

VM Creation

Create a new Virtual Machine. The required settings for GPU passthrough are as follows:

  • Graphic Card: Default
  • Machine: q35
  • BIOS: OVMF (UEFI)
  • Add EFI Disk checked
  • Pre-Enroll keys unchecked (important if you don’t want secure boot inside the VM which forces you to do some extra things to get the nvidia driver working. See this forum post.)
  • SCSI disks, vCPUs and memory as you like. I’ve assigned half of my cores to each VM and a bit less than half the RAM each.

Once the VM is up and running you need to pass through the GPUs and optionally some peripherals. I’ve installed Rocky Linux 9 in it before doing the next steps but you can probably also continue right away. Just remember that the virtual browser-based console will stop working once you have passed the graphics card to the VM. If you are not in front of the host PC you should install Linux first.

Make sure the VM is stopped and go to the VM’s Hardware section. Click Add → PCI device. Select Raw device and pick your NVIDIA card from the list. I had 2 identical GPUs in my case and chose one for the first VM and the other for the 2nd VM. I’ve also checked the boxes for Primary GPU, All Functions, ROM-Bar and PCI Express. There’s probably also an audio device provided by the NVIDIA card. I didn’t pass it through as I didn’t need it.

To pass through a local USB keyboard and mouse connect the peripherals and click Add → USB Device. You should be able to pick the devices based on manufacturer or pipe through the raw USB port. The latter, however, was a problem for me as a reboot of Proxmox seemed to have jumbled the port IDs around. The device manufacturer’s IDs were safe but if you ever swap your keyboard it will need to be added to the VM again.

Inside the VM you should now see the NVIDIA device listed if you type “lspci”. You just need to install the drivers now which are available from the 3rd party repositories ELRepo (kmod-nvidia) and RPM Fusion (akmod-nvidia). After a reboot of the VM you can check nvidia-smi or btop to confirm that the GPU is actually working.

Mastodon

My blog hasn’t been updated for a long long time and will be on hiatus indefinitely.

You can find with me on Mastodon as @compfu@mograph.social instead (https://mograph.social/@compfu) where I post about things that are on my mind and boost motion graphics and VFX related clips I stumble upon.

Yawn In The Shell

The life-action Ghost In The Shell (GITS) movie is pretty forgettable. Sure, they mostly nailed the visuals. But it’s 2017 and movies shouldn’t get points anymore for just “looking good”. All the tentpole movies do.

VFX on par, story bland

Of course the original anime was heavy on amazing visuals. But it was the 1990s and back then this kind of stuff had never been seen before. GITS (1995) even slowed down at one point, showing scenes of futuristic city life that didn’t advance the story but were simply jaw-dropping. Somebody actually hand-animated all of this! Fast forward to 2017 and rendering shot after shot of a futuristic Tokyo really isn’t all that impressive anymore. Yeah, you can have the industry circle-jerk about how innovative their VFX were just as they do after every effects-laden movie. But come on… yawn!

The GITS movie feels like it came late to a party. The original anime, while certainly not inventing gritty cyberpunk, influenced cinema and genres for years. In a way you could call the Matrix movies the first life-action adaptations of GITS. Now, in 2017, everything in GITS seems like it has been done before. So did the story at least bring something new to the table?

Unfortunately, the story of GITS feels pretty bland. To say that it “explores” its central issues like what it means to be human in an age where people enhance their physical bodies with computer interfaces is a gross overstatement. Most people in the movie’s universe don’t care and get along well with their cyber-enhancements. We are told that a teenage hot-head once said that technology needed to be destroyed. That’s about it.

Of course the GITS anime – when viewed on its own – is also heavy on pseudo-intellectual mumbo-jumbo. Its sequel (Ghost in the Shell Innocence) even more so. But GITS has spawned a couple of spin-offs (the “Stand Alone Complex” series for example) that fills the franchise’s futuristic world with details and the special forces team called “Section 9” with life (and cute robots). The GITS movie doesn’t seem to pull anything from this.

Tropes, tropes, tropes

GITS really feels dumbed-down. In the movie’s first couple of minutes somebody explains to you that “Ghost” means mind and “Shell” means body. The boss of the shady high-tech robotics company straight-out declares the newly-built Scarlet Johansson cyborg a “weapon” in a voice that says “I’m the boss of a shady high-tech robotics company and will definitely be the antagonist later when she finds out what we did to her.”

The movie then continues to visit all the lame action-movie tropes like the bad guy switching an automatic weapon system to “manual mode” so he can miss his target more easily and ultimately get defeated. A tank does the cliché clicking/snarling sound from Predator that’s usually used for organic critters approaching a victim.

The movie then devolves into a cringe-worthy scene between Scarlet Johansson (“Major”) and a former friend and/or lover who also got turned into a cyborg that feels like a prom queen politely refusing the awkward advances of a pimple-faced nerd.

The Casting Controversy

But wait, wasn’t there some kind of controversy surrounding the movie? Something about Scarlet Johansson playing a Japanese character? (I’ve talked about this issue in a German post about Cloud Atlas). Well… the Japanese audience didn’t seem to care (the movie flopped in the US but made some bucks in Asia) so who are we to judge.

The casting is bad for a different reason. It actually harms the story as well as suspension of disbelief. At one point, “Major” is confused about living in a robot body. She visits a hooker who tells her that getting touched by her feels different. “What are you?” the hooker asks with a confused face. And rightly so. Even in the world of GITS the technology of putting somebody’s actual brain into a fully cybernetic bodies is bleeding-edge. Johansson is the first of her kind.

“Major” then finds out her past and meets her mom – an old Japanese lady. In an already unbelievable scene that woman immediately invites Johansson into her home and starts an exposition dump about her deceased daughter – Major’s former identity – because Johansson “reminds her of her daughter”. She talks English with a noticeable accent since apparently she recognises Johansson as non-Japanese. But when she realises that Johansson is in fact her former daughter she doesn’t mention a single word about that fact. No “you don’t look anything like her anymore” or “what are you” or “it feels strange hugging you”.

The whole boring movie could have been taken up a notch by simply having the mother acknowledge that her daughter now has a cybernetic, western-looking body.

But that didn’t occur to anybody who had a say in the creation of this movie. And that says everything you need to know about it: GITS 2017 is an effort at making some bucks by bringing 20-year old anime visuals to a life-action movie. Nothing more.

6 out of 10 – the “don’t spend money on this even if you are a fan” level

Die unverschämte Subjektivität der Online-Filmkritik

Die Süddeutsche Zeitung hat eine Reportage über Filmbewertungsportale mit einem kurzen Video angeteasert. Der Standpunkt der SZ ist, dass diese Portale über 1-2 Ecken großen Konzernen aus dem Film- und Medienbusiness gehören und sie deshalb insgeheim ihre eigenen Mainstreamfilme pushen.

Ich habe das ganze Feature nicht gelesen, da es sich hinter einer Paywall versteckt, aber das erwähnte Video, indem Datenjournalistin Katharina Brunner und SZ-Filmkritiker David Steinitz ihr Vorgehen beschreiben macht mich irgendwie wütend, denn es enthält meiner Meinung nach an mehreren Punkten Blödsinn, wenn auch an einem Punkt ein interessantes Detail, das aber einen Vorwurf der Journalisten quasi schon entkräften kann.

Feuilletonist deckt auf: Filmgeschmack ist subjektiv

Eingeleitet wird das Video damit, dass der Feuilletonist sich wundert, dass seine Meinung zu Filmen manchmal nicht mit der von Portalen wie IMDB oder Rotten Tomatoes übereinstimmt. Filmgeschmack könnte also SUBJEKTIV sein.

SCHOCK SCHWERE NOT! Stop the press! Holy Shit. Wer hätte das gedacht. Niemand sage ich euch. NIE – MAND! Es ist 2016 und in Deutschland entdeckt jemand das dunkle Geheimnis hinter der Filmkritik.

Ich verurteile nicht die Recherche (vermutlich dennoch für jedermann in 10 Sekunden zu ergoogeln) dass IMDB und Rotten Tomatoes nicht unabhängige Hobbyprojekte feingeistiger Filmfans sind. Sie sind letztendlich auch Teil von Amazon oder Warner Bros./Universal und sie führen somit Werbung als auch (das ist der Punkt) Bewertungen von Filmen, die ihn von der Mutterfirma produziert wurden.

Ein Interessenkonflikt ist möglich, aber das ist nicht der Hauptvorwurf von Herrn Steinitz. Sein Vorwurf ist, dass Mainstreamfilme besser bewertet werden als Nischenfilme:

SZ-Filmkritiker David Steinitz aus SZ-VideoWenn man sich das ein bisschen genauer anschaut, sieht man eigentlich, dass die Algorithmen all dieser Seiten darauf programmiert sind, dass Mainstreamfilme relativ schnell nach oben gespült werden, und das sind die Art von Mainstreamfilmen, die die Studios auch selber herstellen.

In der Tat sagt Herr Steinitz also nicht, dass er tatsächlich nachweisen konnte, dass Filme von Warner Bros. und Universal auf Rotten Tomatoes unfair gepusht werden. Es geht jetzt nur noch nebulös um “Mainstreamfilme” die von (wiederum nebulös) Filmstudios hergestellt werden.

An diesem Punkt hätte man eigentlich das Datenjournalismus-Projekt einstellen können oder an eine Schülerzeitung verschenken können. Tut die SZ aber nicht. Nach ihrer gnadenlosen Enthüllung, dass Filmgeschmack subjektiv ist enthüllt sie uns jetzt nämlich, dass Mainstreamfilme vielen Leuten gefallen!

SCHOCK SCHWERE NOT! Wer hätte das gedacht. NIE – MAND!

Ok, Spaß beiseite. Ärmel hochkrempeln und drei Dinge klarstellen:

  1. Mainstreamfilme heißen so weil sie darauf angelegt sind, dass sie vielen Menschen gefallen! Filmstudios führen Test-Screenings durch, schneiden Filme um, drehen Szenen nach, feuern Regisseure, nur damit ihre Filme einem möglichst großen Publikum gefallen.
  2. Nischenfilme haben dagegen künstlerische Ambitionen, legen es weniger auf Massengeschmack an. Folglich gibt es hier mehr Leute, denen der Film nicht taugt und das soll auch so sein. Rotten Tomatoes benutzt die Meinung von Filmkritikern aus anderen Medien und es gibt dabei nur ein “gefällt mir” und “gefällt mir nicht” pro Kritiker. Es gibt keine Grauzone, deshalb ist auch hier wahrscheinlich, dass Mainstreamfilme besser darstehen als Nischenfilme, denn ein Kritiker muss einen Film schon erkennbar Scheiße finden, damit Rotten Tomatoes diese Meinung als negativ wertet.
  3. Die großen “bösen” Studios, die laut SZ-Reporter nur Mainstreamfilme produzieren, produzieren in Wirklichkeit nicht nur Mainstreamfilme. Und sie produzieren auch andere Filme sowie Filme, die von den ach-so-manipulierten Bewertungsportalen schlecht bewertet werden (siehe Suicide Squad, der dennoch in diesem Moment die “Top Box Office”-Liste anführt.)

Alle Vorwürfe fallen also entweder in sich zusammen oder werden vom Journalisten selbst erst gar nicht als Vorwürfe dargestellt geschweige denn bewiesen sondern nur angedeutet. Aber es sind Andeutungen, bei denen sich nun jene Leser bestätigt fühlen, die bereits auf eigene Faust derartige Vorurteile gegenüber “großen Medienkonzernen” und “Mainstreamfilmen” entwickelt haben. “DIE SZ HAT’S AUCH BESTÄTIGT!” Können sie dann in ihre Gesprächsrunde werfen, wenn sie vom Thema “Böses Facebook“, “Böse selbstfahrende Autos“, “Böse Amerikaner” zum Thema “Blöde Mainstreamfilme” gelangt sind.

SZ Enthüllt: IMDB Algorithmus kann nicht enthüllt werden!

Kommen wir zu Frau Brunner. Ich möchte jetzt mal darüber hinweg sehen, dass die Daten-Reporterin beschreibt, dass sie doch glatt eine Programmiersprache benutzt hat. Im Jahr 2016 muss man sowas in Deutschland einfach sagen. Hierzulande hatte man auch noch Internetseiten im Fernsehen mit HA – TE – TE – PE – DOPPELPUNKT ausgesprochen, als man in Amerika sogar schon das www weggelassen hatte.

Was mich aufregt, ist dass das Video am Ende folgende Aussage der Journalistin zu IMDB-Bewertungen enthält:

Wie diese Gewichtung, diese Berechnung dann schlussendlich ausfällt bleibt Firmengeheimnis. Und natürlich so ein Punkt wo bestimmte Firmeninteressen womöglich dann auch mit reingemogelt werden können.

Zuvor hatte Frau Brunner die einzige interessante Information ihrer Reportage (nein, ich kenne ja nur den Videoteaser) des Videos wie folgt erklärt: Über 80% der Votes kommen auf IMDB von Männern. Das finde ich interessant und es würde in der Tat IMDB-Wertungen stark verzerren.

Aber Moment mal! Hatte Frau Brunner nicht selbst zuvor gesagt, dass IMDB nicht einfach nur einen Durchschnitt aller User-Votings bildet sondern einen geheimen Wertungsalgorithmus einsetzt?

Oh je, geheimer Algorithmus doch nicht böse?

Kann es nicht sein, dass IMDB das genau deshalb tut, um eine solche Schieflage zu korrigieren? Man weiß, dass IMDB den Nutzern mehr Gewicht gibt, die bereits viele Wertungen abgegeben haben. Das ist bestimmt nicht der einzige Faktor der einfließt.

Ich hoffe es wird in der Reportage angesprochen (im Video ist bis auf einen verdächtig darauf hinweisenden Screenshot der IMDB-Seite von Ghostbusters nichts davon zu erfahren) dass es heutzutage für viele Filme massive Kampagnen gibt, um ihm schlechte Ratings zu bescheren bevor der Film überhaupt in den Kinos landet. Beim weiblich besetzten Ghostbusters 2016 waren es natürlich Männer die geifernd auf die Barrikaden gingen weil ihnen ein Film, den sie als Kinder toll fanden, mit Frauen besudelt wurde (SZ-Artikel von der Datenjournalistin herself).

Bei den von Release zu Release schlechter werdenden DC-Comics-Verfilmungen (Batman v Superman, Suicide Squad,…) schwenkt eine weinerliche Fangemeinde bereits das “macht Rotten Tomatoes dicht, weil die gegen DC und für Marvel sind”-Banner (Artikel auf BirthMoviesDeath). Hätte Warner Bros. geheimen Einfluss auf die Wertungen seiner Tochter “Rotten Tomatoes” würden sie sicherlich ihren eigenen Film nicht so schlecht dargestellt sehen wollen, oder? Dass es trotzdem der Fall ist entkräftet nicht nur das Argument der Fangemeinde sondern auch das Argument der SZ-Reporter.

Ist es nicht gut, dass IMDB einen geheimen Algorithmus benutzt, um z.B. die tausenden Null-Punkte (und auch 10-Punkte)-Ratings abzumildern oder gar zu ignorieren die bereits vor Kinostart die Filme fluten?

tl;dr

Filmbewertungsportale bewerten Mainstreamfilme besser? Naja, Mainstreamfilme sind per Definition darauf angelegt mehr Menschen zu gefallen als Nischenfilme, oder?

Der geheime Algorithmus von IMDB und Rotten Tomatoes kann von Medienkonzernen benutzt werden um Filme zu promoten? Zumindest in diesem Teaser zum Datenprojekt nur eine in den Raum geworfene Behauptung. Die Vorteile eines Wertungsalgorithmus liegen auf der Hand, wenn man sich das Geschlechterverhältnis der User und die “Glaubenskriege” um Filmwertungen in letzter Zeit anschaut.

Data Loss

My web host experienced data loss while repairing a crashed RAID. So this means that my blog is reset to last March. I’ve grabbed a few posts from google’s cache but didn’t have the time yet to transfer them back into WordPress.

Update, one year later: I’ve finally found time to restore a couple of posts from 2015. See below.

Adding Layers and Channels in Nuke

If you need to create new layers in Nuke via Python, here’s the proper syntax:

nuke.tcl("add_layer", "newLayer newLayer.red newLayer.green newLayer.blue")

That was a bit hard to find in the docs as well as online and there’s some weird behavior (at least in Nuke 8) when this is called in a script vs typing it into the scripting console.

For example, the tcl input (“x” hotkey) requires you to enter the command as “add_layer {myLayer red green blue}” and it reminds you of the curly braces syntax in case you do it incorrectly. The .tcl method in Python, however, mustn’t contain curly braces.

Moreover, nuke.tcl requires you to spell out the rgb channels in dot format. If you just use “red green blue” Nuke will create a layer called “other” for some weird reason and probably crash sooner or later. It only does this in Python scripts though. Not in the scripting console.

You might have noticed that I’m calling a TCL command via Python. There’s also a native way: nuke.Layer(). Just like its tcl counterpart it requires you to spell out the channel names – even if the official docs say otherwise:

nuke.Layer("newLayer", ["newLayer.red", "newLayer.green", "newLayer.blue"])

Mad Max: Just Good

Mad Max Fury Road is getting rave reviews. So expecting the ultimate action movie I was “just” treated to a good action movie.

70% of the 2015 Mad Max remake feels like the constant chase that the trailer promises. At most 30% of the movie is slower paced. It’s a visual feast, the stunts (apparently overwhelmingly practical instead of CGI) are great.

The fact that the stunts are just augmented by CGI instead of completely replaced by CGI grounds the movie in reality. Cars and trucks feel like they’re actually weighing what they are weighing and the camera – while moving around constantly and extensively – feels like it’s physically there. Cracked recently had an article about CGI in movies that touches on that by the way.

Moreover the movie is a visual feast and I was constantly amazed by the whacky ideas they had for a post-apocalyptic world that craves for gasoline and water. Yet, in my opinion it lacked certain elements you might expect from this year’s highest-rated action blockbuster. I didn’t feel at the edge of my seat a lot. And there was never a moment where the whole theater erupted into laughter because of a joke or because an evildoer met his demise in a hilarious kind of way.

That shouldn’t stop you from watching the movie though. The film is a special action movie. Its characters are far from cardboard cutouts. And the world-building that Miller has done makes you want to see more of the Mad Max universe. Theron’s character, for example, is called an “Imperator” without explaining what that entails. There’s a well-developed cult of personality about evil warlord “Immortan Joe” with gestures and religious exclamations that simply feel “given” and which make the society of Mad Max incredibly believable (unlike post apocalyptic duds like Elysium).

8/10 (the “great movie – an easy recommendation” level)