add blender cycles GPU render template

This commit is contained in:
Andrew Scobie 2018-06-13 14:10:52 +12:00
Родитель d8733e3f00
Коммит 00bd935ab6
7 изменённых файлов: 326 добавлений и 39 удалений

Просмотреть файл

@ -11,7 +11,7 @@
"type": "string",
"defaultValue": "blender-render",
"metadata": {
"description": "The prefix of the name of the Azure Batch job, also used to prefix rendered outputs"
"description": "The name of the Azure Batch job, also used to prefix rendered outputs"
}
},
"inputData": {

Просмотреть файл

@ -28,45 +28,67 @@
},
"defaultValue": "Standard_D3_v2",
"allowedValues": [
"Standard_A4_v2",
"Standard_A8",
"Standard_A9",
"Standard_A10",
"Standard_A11",
"Standard_D1_v2",
"Standard_D2_v2",
"Standard_D3_v2",
"Standard_D4_v2",
"Standard_D5_v2",
"Standard_D11_v2",
"Standard_D12_v2",
"Standard_D13_v2",
"Standard_D14_v2",
"Standard_D15_v2",
"Standard_D2_v3",
"Standard_D4_v3",
"Standard_D8_v3",
"Standard_D16_v3",
"Standard_D32_v3",
"Standard_D64_v3",
"Standard_D2s_v3",
"Standard_D4s_v3",
"Standard_D8s_v3",
"Standard_D16s_v3",
"Standard_D32s_v3",
"Standard_D64s_v3",
"Standard_E2_v3",
"Standard_E4_v3",
"Standard_E8_v3",
"Standard_E16_v3",
"Standard_E32_v3",
"Standard_E64_v3",
"Standard_E2s_v3",
"Standard_E4s_v3",
"Standard_E8s_v3",
"Standard_E16s_v3",
"Standard_E32s_v3",
"Standard_E64s_v3",
"Standard_F1",
"Standard_F2",
"Standard_F4",
"Standard_F8",
"Standard_F16",
"Standard_F1s",
"Standard_F2s",
"Standard_F4s",
"Standard_F8s",
"Standard_F16s"
"Standard_G1",
"Standard_G2",
"Standard_G3",
"Standard_G4",
"Standard_G5",
"Standard_H8",
"Standard_H16",
"Standard_H8m",
"Standard_H16m",
"Standard_H16r",
"Standard_H16mr",
"Standard_L4",
"Standard_L8",
"Standard_L16",
"Standard_L32",
"Standard_M64s",
"Standard_M64ms",
"Standard_M128s",
"Standard_NC6",
"Standard_NC12",
"Standard_NC24",
"Standard_NC24r",
"Standard_NC6s_v2",
"Standard_NC12s_v2",
"Standard_NC24s_v2",
"Standard_NC24rs_v2",
"Standard_NC6s_v3",
"Standard_NC12s_v3",
"Standard_NC24s_v3",
"Standard_NC24rs_v3"
]
}
},

Просмотреть файл

@ -0,0 +1,149 @@
{
"parameters": {
"poolId": {
"type": "string",
"defaultValue": "blender-windows-gpu",
"metadata": {
"description": "The ID of the pool on which to run the job."
}
},
"jobName": {
"type": "string",
"defaultValue": "blender-gpu-render",
"metadata": {
"description": "The name of the Azure Batch job, also used to prefix rendered outputs"
}
},
"inputData": {
"type": "string",
"metadata": {
"description": "The file group where the input data is stored",
"advancedType": "file-group"
}
},
"inputDataSas": {
"type": "string",
"metadata": {
"description": "SAS token for reading the data from the selected file group",
"advancedType": "file-group-sas",
"dependsOn": "inputData"
}
},
"blendFile": {
"type": "string",
"metadata": {
"description": "The Blender scene file to be rendered",
"advancedType": "file-in-file-group",
"dependsOn": "inputData",
"wildcards": "*.blend"
}
},
"optionalParameters": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Optional parameters to pass to blender, e.g. --scene <name>"
}
},
"frameStart": {
"type": "int",
"defaultValue": 1,
"metadata": {
"description": "The first frame to render"
}
},
"frameEnd": {
"type": "int",
"defaultValue": 1,
"metadata": {
"description": "The last frame to render"
}
},
"outputs": {
"type": "string",
"metadata": {
"description": "The file group where outputs will be stored",
"advancedType": "file-group"
}
}
},
"job": {
"type": "Microsoft.Batch/batchAccounts/jobs",
"properties": {
"id": "[parameters('jobName')]",
"poolInfo": {
"poolId": "[parameters('poolId')]"
},
"displayName": "[parameters('blendFile')]",
"onAllTasksComplete": "terminateJob",
"jobPreparationTask":{
"userIdentity":{
"autoUser": {
"scope": "pool"
}
},
"commandLine":"azcopy /source:\"[parameters('inputDataSas')]\" /dest:\"%AZ_BATCH_JOB_PREP_WORKING_DIR%\" /S & exit /b 0"
},
"jobReleaseTask":{
"userIdentity":{
"autoUser": {
"scope": "pool"
}
},
"commandLine":"DEL /S /Q \"%AZ_BATCH_JOB_PREP_WORKING_DIR%\" & exit /b 0"
},
"taskFactory": {
"type": "parametricSweep",
"parameterSets": [
{
"start": "[parameters('frameStart')]",
"end": "[parameters('frameEnd')]",
"step": 1
}
],
"repeatTask": {
"displayName": "Rendered Frame {0}",
"commandLine": "\"%BLENDER_2018_EXEC%\" -b -P \"%AZ_BATCH_JOB_PREP_WORKING_DIR%/blender_cycles_use_gpu.py\" -y \"%AZ_BATCH_JOB_PREP_WORKING_DIR%/[parameters('blendFile')]\" -o \"%AZ_BATCH_TASK_WORKING_DIR%/[parameters('jobName')]_####\" -f {0} -t 0 -E CYCLES [parameters('optionalParameters')]",
"outputFiles": [
{
"filePattern": "../stdout.txt",
"destination": {
"autoStorage": {
"fileGroup": "[parameters('outputs')]",
"path": "[parameters('jobName')]/logs/frame_{0}.log"
}
},
"uploadOptions": {
"uploadCondition": "taskCompletion"
}
},
{
"filePattern": "../stderr.txt",
"destination": {
"autoStorage": {
"fileGroup": "[parameters('outputs')]",
"path": "[parameters('jobName')]/logs/frame_{0}_error.log"
}
},
"uploadOptions": {
"uploadCondition": "taskCompletion"
}
},
{
"filePattern": "[parameters('jobName')]_*",
"destination": {
"autoStorage": {
"fileGroup": "[parameters('outputs')]",
"path": "[parameters('jobName')]/outputs"
}
},
"uploadOptions": {
"uploadCondition": "TaskSuccess"
}
}
]
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,83 @@
{
"parameters": {
"poolId": {
"type": "string",
"defaultValue": "blender-windows-gpu",
"metadata": {
"description": "Id of the pool"
}
},
"dedicatedVmCount": {
"type": "int",
"defaultValue": 1,
"metadata": {
"description": "The number of dedicated nodes in the Azure Batch pool"
}
},
"lowPriorityVmCount": {
"type": "int",
"defaultValue": 0,
"metadata": {
"description": "The number of low priority nodes in the Azure Batch pool"
}
},
"nodeSize": {
"type": "string",
"metadata": {
"description": "The size of the virtual machines that run the application. Note GPU options only."
},
"defaultValue": "Standard_NC6",
"allowedValues": [
"Standard_NC6",
"Standard_NC12",
"Standard_NC24",
"Standard_NC24r",
"Standard_NC6s_v2",
"Standard_NC12s_v2",
"Standard_NC24s_v2",
"Standard_NC24rs_v2",
"Standard_NC6s_v3",
"Standard_NC12s_v3",
"Standard_NC24s_v3",
"Standard_NC24rs_v3"
]
}
},
"variables": {
"osType": {
"imageReference": {
"publisher": "batch",
"offer": "rendering-windows2016",
"sku": "rendering",
"version": "1.2.3"
},
"nodeAgentSKUId": "batch.node.windows amd64"
}
},
"pool": {
"id": "[parameters('poolId')]",
"displayName": "3ds Max pool running: [parameters('poolId')]",
"vmSize": "[parameters('nodeSize')]",
"virtualMachineConfiguration": "[variables('osType')]",
"targetDedicatedNodes": "[parameters('dedicatedVmCount')]",
"targetLowPriorityNodes": "[parameters('lowPriorityVmCount')]",
"enableAutoScale": false,
"enableInterNodeCommunication": false,
"startTask": {
"commandLine": "cmd.exe /c install-azure-nc-drivers.cmd [parameters('nodeSize')]",
"waitForSuccess": true,
"maxTaskRetryCount": 0,
"userIdentity": {
"autoUser": {
"elevationLevel": "admin"
}
},
"resourceFiles": [
{
"blobSource": "https://raw.githubusercontent.com/Azure/BatchLabs-data/master/ncj/3dsmax/scripts/install-azure-nc-drivers.cmd",
"filePath": "install-azure-nc-drivers.cmd"
}
]
}
}
}

Просмотреть файл

@ -2,7 +2,7 @@
"parameters": {
"poolId": {
"type": "string",
"defaultValue": "blender-pool-ubuntu",
"defaultValue": "blender-windows",
"metadata": {
"description": "The ID of the pool on which to run the job."
}
@ -11,7 +11,7 @@
"type": "string",
"defaultValue": "blender-render",
"metadata": {
"description": "The prefix of the name of the Azure Batch job, also used to prefix rendered outputs"
"description": "The name of the Azure Batch job, also used to prefix rendered outputs"
}
},
"inputData": {

Просмотреть файл

@ -28,45 +28,67 @@
},
"defaultValue": "Standard_D3_v2",
"allowedValues": [
"Standard_A4_v2",
"Standard_A8",
"Standard_A9",
"Standard_A10",
"Standard_A11",
"Standard_D1_v2",
"Standard_D2_v2",
"Standard_D3_v2",
"Standard_D4_v2",
"Standard_D5_v2",
"Standard_D11_v2",
"Standard_D12_v2",
"Standard_D13_v2",
"Standard_D14_v2",
"Standard_D15_v2",
"Standard_D2_v3",
"Standard_D4_v3",
"Standard_D8_v3",
"Standard_D16_v3",
"Standard_D32_v3",
"Standard_D64_v3",
"Standard_D2s_v3",
"Standard_D4s_v3",
"Standard_D8s_v3",
"Standard_D16s_v3",
"Standard_D32s_v3",
"Standard_D64s_v3",
"Standard_E2_v3",
"Standard_E4_v3",
"Standard_E8_v3",
"Standard_E16_v3",
"Standard_E32_v3",
"Standard_E64_v3",
"Standard_E2s_v3",
"Standard_E4s_v3",
"Standard_E8s_v3",
"Standard_E16s_v3",
"Standard_E32s_v3",
"Standard_E64s_v3",
"Standard_F1",
"Standard_F2",
"Standard_F4",
"Standard_F8",
"Standard_F16",
"Standard_F1s",
"Standard_F2s",
"Standard_F4s",
"Standard_F8s",
"Standard_F16s"
"Standard_G1",
"Standard_G2",
"Standard_G3",
"Standard_G4",
"Standard_G5",
"Standard_H8",
"Standard_H16",
"Standard_H8m",
"Standard_H16m",
"Standard_H16r",
"Standard_H16mr",
"Standard_L4",
"Standard_L8",
"Standard_L16",
"Standard_L32",
"Standard_M64s",
"Standard_M64ms",
"Standard_M128s",
"Standard_NC6",
"Standard_NC12",
"Standard_NC24",
"Standard_NC24r",
"Standard_NC6s_v2",
"Standard_NC12s_v2",
"Standard_NC24s_v2",
"Standard_NC24rs_v2",
"Standard_NC6s_v3",
"Standard_NC12s_v3",
"Standard_NC24s_v3",
"Standard_NC24rs_v3"
]
}
},

Просмотреть файл

@ -0,0 +1,11 @@
import bpy
for scene in bpy.data.scenes:
scene.cycles.device = 'GPU'
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
for d in bpy.context.user_preferences.addons['cycles'].preferences.devices:
if d.type == 'CPU':
d.use = False
print("Device '{}' type {} : {}" . format(d.name, d.type, d.use))