Windows user needed! Test workflow and multiprocessing using WSL

We’d like to invite Windows users to test out the workflow using WSL (Windows subsystems linux), and identify any pitfalls. If you’re already using Windows WSL for Radiance, we’d also like to hear from you whether it’s a sufficient alternative for *nix based system. Mainly if your workflow involves other Windows-based software such as CAD tools to create geometry and models. We’d like to know whether this is a viable option to enable parallel processing on Windows. The advantage of WSL over virtual machine seems to the convenience of not having to move files between systems.

If you would like to try Radiance with WSL for the first time, here is the step by step instruction. You need to have Windows 10:2004 or newer or Windows 11.

  1. Install WSL: run wsl --install from window command line or powershell. This will install a default ubuntu distro. You will be promoted to create an user and password.
  2. Restart computer.
  3. Open command prompt or powershell, go into wsl by running wsl
  4. From inside the wsl, install Radiance by running this command ( you can copy and paste and run the whole thing at once). Type in password as prompted. curl -fsSL --output; sudo apt-get install unzip; unzip; tar -xvf radiance-5.4.9c84aa055a-Linux.tar.gz; sudo mv radiance-5.4.9c84aa055a-Linux/usr/local/radiance /usr/local/; rm -rf radiance-5.4.9c84aa055a-Linux.tar.gz radiance-5.4.9 c84aa055a-Linux
  5. Run Radiance program from Windows command prompt or Powershell (notice the idea is that you can run Radiance from Windows locally with local files and etc): wsl export PATH=/usr/local/radiance/bin:$PATH; export RAYPATH=/usr/local/radiance/lib:.; rtrace -version

Optional: to simplify the command, you can create a function in powershell, typing:
function wslrad {wsl export PATH=/usr/local/radiance/bin:$PATH`; export RAYPATH=/usr/local/radiance/lib:.`; @args}

Then you can just do something like this:
wslrad oconv mat.rad room.rad > test.oct
wslrad rtrace < ./grid.txt -n 8 test.oct > res.dat

Notice the grid.txt is in *nix convention with / rather than windows \ even though files are local in Windows.


Trying it. So far I get as far as running rpict, and then I see:

rpict: system - cannot find function file "": No such file or directory`

And yet I have:

rmfritz@Helmholtz:rend06$ echo $RAYPATH
rmfritz@Helmholtz:rend06$ ls /usr/local/radiance/lib/

I think I’m missing something, but I’m not sure what.

Thanks Randolph for trying it out. Did you run command like this? setting $RAYPATH in WSL doesn’t work when calling from Windows side as far as I can tell.

I wasn’t calling it from the Windows side at all; I was instead trying it from a shell in the Windows Terminal and I completely don’t understand what’s happening.

I’ll try that next.

That command doesn’t seem to work, at least with my Debian install. This is what I get:

PS C:\Users\User> wsl export PATH=/usr/local/radiance/bin:$PATH; export RAYPATH=/usr/local/radiance/lib:.; rtrace -version
export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:48
+ wsl export PATH=/usr/local/radiance/bin:$PATH; export RAYPATH=/usr/lo ...
+                                                ~~~~~~
    + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

RADIANCE 5.4a 2023-02-26 LBNL (5.4.e0d019e22f)

When I give a command via “wsl” it doesn’t seem to invoke a login shell; I think environment variables have to go in “.bashrc” (or whatever shell is in use) or in the Windows environment.

I think on powershell you need to escape the semicolon like so:
wsl export PATH=/usr/local/radiance/bin:$PATH`; export RAYPATH=/usr/local/radiance/lib:.`; rtrace -version

That command should work in Command Prompt without escaping.

Calling wsl directly from Windows side invokes a non-interactive non-login shell I think. And that’s why all .bashrc and .profile setting inside linux doesn’t gets called. I also tried to set PATH and RAYPATH in /etc/environment to no pervail. Maybe others have better ideas.

I’ll try that when I get back to this (not today!) Wsl invokes bash; I’m not sure if what options it uses. Setting “BASH_ENV” might get it to read a startup file.

Did get it going, in a Debian terminal window. But there were problems:

  1. For some reason, RAYPATH was not properly searched. I copied .cal and .fnt files into the project directory, and that worked, but that’s not a long-term solution. [This was a problem with my build script, which didn’t expect RAYPATH to change, not Radiance or the WSL environment.]

  2. ximage does not work, though other X-windows apps (xman, xcalc, xeyes, etc.) do. [To fix this, do sudo apt install xfonts-base]

One other possible issue: there may be performance problems with the Radiance apps that use very large files; it’s not clear to me how filesystem access works. Some files are mounted via virtual network connections and this may create performance issues.

So, progress. May need some tinkering with the build scripts and environment to make it a full solution.

It works. Remember to install the xfonts-base package, if you want ximage to work.

On a related subject, is there any reason we don’t just support the Debian and Red Hat package managers? That would make many Linux installs simple.