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 https://github.com/LBNL-ETA/Radiance/releases/download/9c84aa05/Radiance_9c84aa05_Linux.zip --output radiance.zip; sudo apt-get install unzip; unzip radiance.zip; 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 radiance.zip
  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.

3 Likes

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

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

And yet I have:

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

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.

Hello,

I also wanted to share my recent experience with installing Radiance on Linux and configuring the environment. Setting up the PATH and RAYPATH variables was a bit awkward due to my lack of prior experience. To run Radiance commands on Windows using WSL, I incorporated subprocess calls in Python.

I’ve been testing it with rtrace and it seems to be working out fine.

Cheers,
Alex

1 Like

By the way, I noticed that the benefits of accessing Radiance through WSL become most apparent when working with complex scenes that require tracing a large number of rays. In such cases, the ability to use multiprocessing through WSL is very advantageous.

However, for simpler scenes where only a small number of rays need to be traced, the overhead of running Radiance through WSL might outweigh the benefits. In these scenarios, running Radiance locally within Windows can be faster.

Hi Taoning,

I have installed the Radiance on WSL before, so before I test it, could you please tell me how should I update the Radiance to the current version? Is it to uninstall the old version and install the newest one?

Cheers,
Hao

Yes, Radiance is just the set of binaries. You can remove those manually, try to run a Radiance program to verify that it has been removed and reinstall again. You can also just install the new ones if you are sure there is one copy of Radiance installed and you are overwriting those files precisely.

1 Like

Hi Taoning,

Thank you for your reply and I will follow your suggestion to install the newest one.

Cheers,
Hao