LeDon
LeDon

Reputation: 549

Blender Google Colab

Up until few days ago I was able to run Blender(or sheep it) headless on Google Colab with an GPU(yes I checked trice that I selected a GPU Instance). Now running keras/tensorflow does work fine but blender can't detect the GPU at all and Sheepit tells me that

"cuInit Failed ret: 100"

nvidia-smi results with:

Sat Aug 24 19:48:06 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.40       Driver Version: 418.67       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla K80           Off  | 00000000:00:04.0 Off |                    0 |
| N/A   33C    P8    25W / 149W |      0MiB / 11441MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

The following script did work fine for few months and detected the GPU properly and setup blender to use the available GPU. https://gist.github.com/donmahallem/a05100077ec1327268f28f0b2bd8da60

I tried a lot but my nvidia/unix foo is pretty limited. I tried to find out if the CUDA Version changed and tried to downgrade the cuda version to 9.2 but couldn't get it to work again.

Upvotes: 1

Views: 2693

Answers (2)

Emir
Emir

Reputation: 1586

Since today thomas-schiex/blender cannot be installed on Google Colab due to dependency issues.

There is alternative way how to install blender on Google Colab. I've tested it today on Google Colab and it seems to be working fine.

Guide is available at: https://gist.github.com/agmmnn/c457286aef0e271a68234d4c59c85d46

Upvotes: 0

Gourav K
Gourav K

Reputation: 11

I'm also facing the same problem. I think colab is not allowing GPU to use for any commands that include "sudo" in it.

Solution I found was to install blender and then run the command to render without "sudo".

I installed blender from PPA ppa:thomas-schiex/blender

commands to execute:

!sudo add-apt-repository ppa:thomas-schiex/blender
!sudo apt-get install blender
!blender -b -P script.py filename.blend -o fileoutput -F PNG -f 1

script.py contains code to select gpu, I generally upload to colab. Save following code as script.py

import bpy, _cycles

bpy.context.scene.cycles.device = 'GPU'

avail_devices = _cycles.available_devices('CUDA')
print(avail_devices)

prop = bpy.context.preferences.addons['cycles'].preferences

prop.get_devices(prop.compute_device_type)
prop.compute_device_type = 'CUDA'

for device in prop.devices:
    if device.type == 'CUDA':
        print('device: ', device)
        device.use = True

This worked for me.

Upvotes: 1

Related Questions