ai_device.h
Go to the documentation of this file.
1// Copyright 2023 Autodesk, Inc. All rights reserved.
2//
3// Use of this software is subject to the terms of the Autodesk license
4// agreement provided at the time of installation or download, or which
5// otherwise accompanies this software in either electronic or hard copy form.
6
12#pragma once
13#include "ai_api.h"
14#include <ai_string.h>
15#include <ai_array.h>
16#include <ai_render.h>
17
29{
32};
33
38{
42};
43
48{
49 SUCCESS,
56};
57
61AI_API bool AiDeviceTypeIsSupported(AtDeviceType device_type, AtString& reason);
62
66AI_API AtDeviceSelectErrorCode AiDeviceSelect(AtRenderSession* render_session, AtDeviceType device_type, const AtArray* device_ids);
67
71AI_API AtDeviceSelectErrorCode AiDeviceAutoSelect(AtRenderSession* render_session);
72
76AI_API AtDeviceType AiDeviceGetSelectedType(const AtRenderSession* render_session);
77
81AI_API const AtArray* AiDeviceGetSelectedIds(const AtRenderSession* render_session, AtDeviceType device_type);
82
86AI_API unsigned int AiDeviceGetCount(AtDeviceType device_type);
87
91AI_API const AtArray* AiDeviceGetIds(AtDeviceType device_type);
92
96AI_API AtString AiDeviceGetName(AtDeviceType device_type, unsigned int device_id);
97
101AI_API unsigned int AiDeviceGetMemoryMB(AtDeviceType device_type, unsigned int device_id, AtDeviceMemory memory);
102
111typedef void (*AtGPUCachePopulateCallback)(void* user_ptr, AtRenderStatus status, float fraction_done, const char* msg);
112
113enum AtGPUCachePopulateMode
114{
115 AI_GPU_CACHE_POPULATE_BLOCKING,
116 AI_GPU_CACHE_POPULATE_NON_BLOCKING
117};
118
122AI_API void AiGPUCacheSetDirectory(const char* dir_path);
123
128/*\}*/
DLL export prefix for API functions (necessary for multi-platform development)
Generic array data type and methods.
API for managing rendering sessions.
AtString class for fast comparisons.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:54
AI_API AtString AiDeviceGetName(AtDeviceType device_type, unsigned int device_id)
Returns the name of a device.
Definition: ai_device.cpp:324
AI_API unsigned int AiDeviceGetMemoryMB(AtDeviceType device_type, unsigned int device_id, AtDeviceMemory memory)
Returns memory information of a device.
Definition: ai_device.cpp:356
AI_API unsigned int AiDeviceGetCount(AtDeviceType device_type)
Returns the number of available devices of a given type.
Definition: ai_device.cpp:266
AI_API const AtArray * AiDeviceGetSelectedIds(const AtRenderSession *render_session, AtDeviceType device_type)
Returns the currently selected devices ids of a device type.
Definition: ai_device.cpp:244
AI_API AtString AiGPUCacheGetDirectory()
Get the directory specified via AiGPUCacheSetDirectory (or if not specified, the default)
Definition: ai_device.cpp:418
AtDeviceSelectErrorCode
Device selection error code.
Definition: ai_device.h:48
AI_API AtDeviceSelectErrorCode AiDeviceAutoSelect(AtRenderSession *render_session)
Automatically select render device based on options.
Definition: ai_device.cpp:139
AtDeviceType
Device types.
Definition: ai_device.h:29
AI_API void AiGPUCacheSetDirectory(const char *dir_path)
Set the directory where the OptiX cache will be stored.
Definition: ai_device.cpp:407
AI_API AtDeviceType AiDeviceGetSelectedType(const AtRenderSession *render_session)
Returns the currently selected render device type.
Definition: ai_device.cpp:227
void(* AtGPUCachePopulateCallback)(void *user_ptr, AtRenderStatus status, float fraction_done, const char *msg)
GPU cache population report callback.
Definition: ai_device.h:111
AI_API bool AiDeviceTypeIsSupported(AtDeviceType device_type, AtString &reason)
Returns if a given device is supported on the current system.
Definition: ai_device.cpp:26
AtDeviceMemory
Queriable memory attributes.
Definition: ai_device.h:38
AI_API const AtArray * AiDeviceGetIds(AtDeviceType device_type)
Returns the ids of available devices of a given type.
Definition: ai_device.cpp:288
AI_API AtDeviceSelectErrorCode AiDeviceSelect(AtRenderSession *render_session, AtDeviceType device_type, const AtArray *device_ids)
Select render device.
Definition: ai_device.cpp:70
@ FAILURE_MEMORY
No matching device(s) have free memory greater than options.gpu_default_min_memory_MB threshold.
@ FAILURE_INVALID_ID
Invalid device id in selection
@ FAILURE_UNKNOWN
Generic error
@ FAILURE_UNSUPPORTED
Unsupported device in selection
@ SUCCESS
Device selection was successful
@ FAILURE_NAME
No matches found for options.gpu_default_names regexp
@ FAILURE_NO_DEVICES_FOUND
No arnold compatible devices found
@ AI_DEVICE_TYPE_GPU
Render using the GPU.
Definition: ai_device.h:31
@ AI_DEVICE_TYPE_CPU
Render using the CPU.
Definition: ai_device.h:30
@ AI_DEVICE_MEMORY_USED
Total used memory
Definition: ai_device.h:41
@ AI_DEVICE_MEMORY_TOTAL
Total memory on device
Definition: ai_device.h:39
@ AI_DEVICE_MEMORY_FREE
Total free memory available to device.
Definition: ai_device.h:40
AtRenderStatus
Status of the current render.
Definition: ai_render.h:93

© 2023 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com