Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

HOWTO: Setup provider: Google Cloud Platform (GCP)

Rabit edited this page Apr 3, 2021 · 12 revisions

This document describes how to setup your GCP account to use it in BlendNet. Overall the steps are quite the same as in Google documentation, but this document is more specific for BlendNet.

Video reference

Performance

Useful info to compare with the other providers:

  • Configs:
    • Manager: 1CPU (n1-standard-1 $0.095/H)
    • Agents: 3x, 2CPU (n1-highcpu-2 $0.142/H)
    • Cheap agents disabled
  • Upload blendnet to storage: 7s
  • Manager run: 99s
  • Manager rerun (already existing instance): 38s
  • Render frame blendnet-test-project (upload, run agents, render, get compose): 447s
  • Rerender frame blendnet-test-project (same but agents active and cache here): 343s

1. Login to GCP Console

You will need to have a registered GCP email to activate Console https://console.cloud.google.com/ - login with the existing account or create a new one. If you don't have GCP activated - Google will ask you to enroll to Free tier. It's free $300 to check the GCP with some limitations (for example cheap CPU's will not be available).

2. Create new GCP project

It's a good idea to create the new project and use it for your rendering. Just click on the project name in Cloud Console and use NEW PROJECT button to do that.

3. Download & setup gcloud sdk

BlendNet reuses logic from the Google provided gcloud SDK to interface with GCP API - so you need to install it on your computer (just follow https://cloud.google.com/sdk/docs/downloads-versioned-archives documentation). After that you will need to initialize it (and make sure your system PATH env variable is changed to point to sdk bin dir, without it BlendNet can't find the gcloud utility and properly connect the provider), choose the default project & region/zone. Execute those commands in your terminal:

  1. Connect your GCP account and choose the project to use (not needed for those users who enabled "Run gcloud init..." flag during installation)
    $ gcloud init
    
  2. List the available regions and zones - you can choose the right ones for you - just read about that in google cloud documentation:
    $ gcloud compute regions list
    $ gcloud compute zones list
    
  3. Setup your region and zone - both will be used to run the BlendNet Manager and Agents.
    $ gcloud config set compute/region us-central1
    $ gcloud config set compute/zone us-central1-f
    

MacOS notice

By default tools installs their binary path in .bashrc config, but this is working only for terminal. In case of launcher (UI one) - BlendNet will not be able to find the tool binary, but you can help it with changing the lauchctl configuration: https://apple.stackexchange.com/questions/106355/setting-the-system-wide-path-environment-variable-in-mavericks (or just run Blender from terminal to save some hair till v0.4 of BlendNet will come out).

4. Enable Compute API

You will need to enable the Compute API in Cloud Console - just go into Navigation Menu --> Compute Engine --> VM Instances and wait until the page will notify you that the operation is completed (should take ~2 mins).

5. Setup Addon and the Manager

Now gcloud is ok and BlendNet should be able to perform the first render with GCP provider. Default parameters allows to run 1 Manager (1CPU) and 3 Agents (2CPU each) - just about the limit Google gives you by default.

In case you need more - you can go to BlendNet addon settings, check the quotas info and maybe some warnings if the quotas is not good. And you can go to quotas page and request the quotas to be increased (and probably had a conversation with sales about that).

  1. Let's go and check what you should see in the BlendNet addon preferences now:

    Preferences - BlendNet Addon GCP Provider

  2. The settings by default should be good enough for the first run.

  3. Close the preferences and switch to your Scene Render Properties tab. Make sure Cycles is choosen as the Render Engine. If everything is setup properly - you will see the next pic:

    Scene - BlendNet Addon Scene UI GCP

  4. First of all you will need to start the Manager by pressing + button on the Manager panel, that will allocate the instance in GCP cloud (status Started - it takes time to setup & run the service) and when the Addon will be able to connect to the Manager - it will change status to Active, so you can see it's its info:

    Scene - BlendNet Addon Scene UI Manager Active

  5. If you see that - it's time to open your project and click Run Image Task to get the results of your hard work (please check the general practices on the First steps page to get how to do that).

    Scene - BlendNet Addon GCP Provider render

Addon: useful gcloud commands

  • Command gcloud init will allow to initialize the configuration the first time
  • Command gcloud compute regions list will show the available regions
  • Command gcloud config set compute/region us-central1 will set the region to "us-central1"
  • Command gcloud compute zones list will show the available regions
  • Command gcloud config set compute/zone us-central1-f will set the zone to "us-central1-f"
  • Command gcloud info should print out where SDK is installed
  • Command gcloud auth list should show the currently selected account
  • Command gcloud compute instances create test-instance should actually create a new instance (you can check that using google cloud web console at https://console.cloud.google.com/compute/instances)
  • Command gcloud compute instances delete test-instance should actually delete the instance
  • Command gsutil mb gs://test-bucket-jsfkhbqfhbqw should create a test bucket
  • Command gsutil rm -r gs://test-bucket-jsfkhbqfhbqw should clean and delete the test bucket