Mrview CPU-Based instead of GPU-based?

Hi everyone from MRtrix3 community ! :wave: :grinning:

I would like to ask just this simple question that I could not find the answer to in the different topics of this community nor the issues in the GitHub :
-Is mrview running only on the GPU ?
-If yes , is there any way to have the CPU run mrview entirely rather than the GPU ?

I am asking as I have a working station with an intel core i7 with 8 cores but mrview mostly ask resources from my small GPU which is a caicos pro radeon HD7450 :sweat_smile: . And from what I could see in ressources my 8 cores don’t go above 20% use while using mrview but mrview still crashes several times in a row for tractography data above 200 MB.

I would gladly appreciate any help or suggestion on the topic !

Hi mrview delegates most of its rendering tasks to OpenGL, a graphics APIs primarily oriented towards GPUs, which are purpose-built for computationally intensive tasks like 3D rendering. Your GPU is quite old and the crashes are likely due to running out of memory. Upgrading your GPU to something with more memory would be the ideal solution.

If you want to try it though, it’s possible to run mrview to run entirely on the CPU via software rendering, although it’s very likely that performance would be subpar. If you’re on a Linux machine, you can do this by setting the environment variable LIBGL_ALWAYS_SOFTWARE=1 before running mrview.
On Windows, things are slightly more complicated. It should be possible in theory to use the Mesa llvmpipe drivers for OpenGL (e.g. by downloading them from here) and then place the opengl32.dll inside the directory containing the binary executable for mrview.

1 Like

Thank you very much for your reply !

I tested it on my computer but turns out running mrview on CPU only makes it worse somehow, from what computer monitoring seems to show my computer only use one CPU at a time at 100% and then switches to another and as you said the mrview experience was “subpar” indeed. If there is any way for several CPU to work collectively on mrview I don’t know it yet.

I found a way to use in a better way mrview with less crashes : by hiding my tractography and the volume render when I need to change the view or apply some changes like axial/coronal/sagittal clip planes and then showing again the 3D objects.
This allows me to inspect my tractography slowly but surely.

Otherwise I guess the solution here would be for me to get a more powerful station at disposal ^^.

If there is any way for several CPU to work collectively on mrview I don’t know it yet.

It’s possible that you may get an improvement by explicitly setting the OpenGL Mesa driver to use llvmpipe instead of softpipe (which might be the default on your system).
To do this (assuming you’re on Linux), you can run: LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe mrview.

Otherwise I guess the solution here would be for me to get a more powerful station at disposal ^^.

Yes, this would be highly recommended.

After trying this :

I got something worse than with default GPU so I’ll stay on default settings and wait for a better station.
Thank you very much however for the time you spent with me ! :smile: