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
47AI_API bool AiDeviceTypeIsSupported(AtDeviceType device_type, AtString& reason);
48
52AI_API int AiDeviceSelect(AtRenderSession* render_session, AtDeviceType device_type, const AtArray* device_ids);
53
57AI_API int AiDeviceAutoSelect(AtRenderSession* render_session);
58
62AI_API AtDeviceType AiDeviceGetSelectedType(const AtRenderSession* render_session);
63
67AI_API const AtArray* AiDeviceGetSelectedIds(const AtRenderSession* render_session, AtDeviceType device_type);
68
72AI_API unsigned int AiDeviceGetCount(AtDeviceType device_type);
73
77AI_API const AtArray* AiDeviceGetIds(AtDeviceType device_type);
78
82AI_API AtString AiDeviceGetName(AtDeviceType device_type, unsigned int device_id);
83
87AI_API unsigned int AiDeviceGetMemoryMB(AtDeviceType device_type, unsigned int device_id, AtDeviceMemory memory);
88
97typedef void (*AtGPUCachePopulateCallback)(void* user_ptr, AtRenderStatus status, float fraction_done, const char* msg);
98
99enum AtGPUCachePopulateMode
100{
101 AI_GPU_CACHE_POPULATE_BLOCKING,
102 AI_GPU_CACHE_POPULATE_NON_BLOCKING
103};
104
108AI_API AtRenderErrorCode AiGPUCachePopulate(AtGPUCachePopulateMode mode=AI_GPU_CACHE_POPULATE_NON_BLOCKING,
109 unsigned int num_proc=0,
110 AtGPUCachePopulateCallback report_callback=NULL,
111 void* user_ptr=NULL);
112
116AI_API AtRenderStatus AiGPUCachePopulateStatus(float* fraction_done);
117
122
126AI_API void AiGPUCachePopulateTerminate();
127
131AI_API void AiGPUCacheSetDirectory(const char* dir_path);
132
137/*\}*/
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:46
AI_API AtRenderStatus AiGPUCachePopulateStatus(float *fraction_done)
Poll for the current status of the GPU cache population.
Definition: ai_device.cpp:435
AI_API AtString AiDeviceGetName(AtDeviceType device_type, unsigned int device_id)
Returns the name of a device.
Definition: ai_device.cpp:312
AI_API AtRenderErrorCode AiGPUCachePopulate(AtGPUCachePopulateMode mode=AI_GPU_CACHE_POPULATE_NON_BLOCKING, unsigned int num_proc=0, AtGPUCachePopulateCallback report_callback=NULL, void *user_ptr=NULL)
Pre-populates the GPU program cache.
Definition: ai_device.cpp:409
AI_API unsigned int AiDeviceGetMemoryMB(AtDeviceType device_type, unsigned int device_id, AtDeviceMemory memory)
Returns memory information of a device.
Definition: ai_device.cpp:344
AI_API void AiGPUCachePopulateTerminate()
Request immediate termination of the GPU cache population.
Definition: ai_device.cpp:463
AI_API unsigned int AiDeviceGetCount(AtDeviceType device_type)
Returns the number of available devices of a given type.
Definition: ai_device.cpp:254
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:232
AI_API AtString AiGPUCacheGetDirectory()
Get the directory specified via AiGPUCacheSetDirectory (or if not specified, the default)
Definition: ai_device.cpp:491
AI_API int AiDeviceSelect(AtRenderSession *render_session, AtDeviceType device_type, const AtArray *device_ids)
Select render device.
Definition: ai_device.cpp:77
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:479
AI_API AtDeviceType AiDeviceGetSelectedType(const AtRenderSession *render_session)
Returns the currently selected render device type.
Definition: ai_device.cpp:215
void(* AtGPUCachePopulateCallback)(void *user_ptr, AtRenderStatus status, float fraction_done, const char *msg)
GPU cache population report callback.
Definition: ai_device.h:97
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 int AiDeviceAutoSelect(AtRenderSession *render_session)
Automatically select render device based on options.
Definition: ai_device.cpp:138
AI_API const AtArray * AiDeviceGetIds(AtDeviceType device_type)
Returns the ids of available devices of a given type.
Definition: ai_device.cpp:276
AI_API float AiGPUCachePopulateRemainingSeconds()
Estimate for how many more seconds remain for the GPU cache population.
Definition: ai_device.cpp:449
@ 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
AtRenderErrorCode
Render error codes.
Definition: ai_render.h:44
AtRenderStatus
Status of the current render.
Definition: ai_render.h:94

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