Blender 2.8 + CUDA

I’ve been using Blender 2.8 for a while, mostly to produce individual pictures and it works quite well in Fedora. However, lately I’ve been wanting to do animation in Blender and while rendering times for individual pictures was acceptable to me, render times for whole animations are not.

To help with this, a good friend donated a Zotac GEForce GTX 1060 graphics card. My intent is to use its GPU and CUDA to get faster render times. Although I am not fond of NVIDIA’s relatively uncooperative approach to the open source community and would probably have preferred an AMD card for that reason, I have the 1060 card installed at the moment and would like to use it. I have installed the proprietary NVIDIA drivers via rpmfusion and have then attempted to follow the instructions here to install CUDA. That all seemed to go well and Blender was able to “see” my card at that point, but then it reported (using blender --debug-cycles) that CUDA said “#error -- unsupported GNU version! gcc versions later than 8 are not supported!

On the bet that it might still work but hadn’t yet been tested, I modified /usr/local/cuda-10-2/targets/x86_c4/include/crt/host_config.h so that this:

#if __GNUC__ > 8
#error -- unsupported GNU version! gcc versions later than 8 are not supported!
#endif /* __GNUC__ > 8 */

checked for > 9 instead (I’m using the latest packaged gcc which is 9.3.1 when I write this). That got quite a bit farther, but now when I try a render blender seems to hang and I have to kill the process.

Now what? Troubleshooting and/or repair advice gratefully accepted!

I don’t know much about Blender and CUDA, but I think of CUDA as to allows to do some kind of calculus (other than rendering). I believe you don’t need CUDA for doing faster animations.

I found https://stackoverflow.com/questions/58859081/how-to-install-an-older-version-of-gcc-on-fedora but I feel a bit bad for suggesting it, hope you will build it yourself.

First, I had to recover from modifying the include file. Reverting the include file is one step, but the other is to remove the pre-compiled kernel. They are located in ~/.cache/cycles/kernels/ and I simply deleted them.

Next was to fetch gcc, build it and install it. I’m generally not comfortable with installing binaries from an untrusted repo, so I prefer to install from source. As of 2020, the gcc project has converted to using git so this is simple:

git clone git://gcc.gnu.org/git/gcc.git gcc

Since we want the latest version that is supported (in this case, according to the gcc web site, it’s 8.4) we check out that particular version.

cd gcc    
git checkout releases/gcc-8.4.0

After checking the installation instructions, I made sure that all prerequisites are installed (in my case, I was missing only libmpc-devel), I created a separate build directory that is not in the source tree that was just checked out, per the advice of the gcc maintainers. Then I went into that directory and configured the build:

cd ..
mkdir gcc-8.4
cd gcc-8.4
../gcc/configure --prefix=/usr/local/gcc-8.4 --disable-multilib --enable-languages=c,c++

From there it was just a matter of doing make && make install-strip because I had already set up the installation directory in the configure step.

Because Blender needs to know the location of that compiler, running Blender is done like this:

CYCLES_CUDA_EXTRA_CFLAGS="-ccbin /usr/local/gcc-8.4/bin/gcc" blender --debug-cycles

The --debug-cycles is just used to debug Blender’s cycles renderer but is not necessary if everything works.

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