UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CudaModule.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Containers/Map.h"
5#include "CoreMinimal.h"
6#include "CudaWrapper.h"
8#include "HAL/Platform.h"
9#include "HAL/PlatformCrt.h"
10#include "Logging/LogMacros.h"
14
17{
18public:
20 {
21 return FModuleManager::GetModuleChecked<FCUDAModule>("CUDA").DriverApiPtrs;
22 }
23
24 CUDA_API virtual void StartupModule() override;
25 CUDA_API virtual void ShutdownModule() override;
26
27 // Determines if the CUDA Driver API is available for use
28 CUDA_API bool IsAvailable();
29
30 // Retrieves the function pointer list for the CUDA Driver API
31 CUDA_API const CUDA_DRIVER_API_FUNCTION_LIST* DriverAPI();
32
33 // Retrieves the CUDA context for the GPU device currently in use by the Vulkan RHI
34 CUDA_API CUcontext GetCudaContext();
35
36 // Retrieves the device index for the current context
37 CUDA_API uint32 GetCudaDeviceIndex() const;
38
39 // Retrieves or creates the CUDA context for the specified GPU device
40 CUDA_API CUcontext GetCudaContextForDevice(int DeviceIndex);
41
42 // Called after CUDA is loaded successfully
44
45 CUDA_API bool IsDeviceIndexRHISelected(int DeviceIndex);
46
47private:
48 CUDA_API bool LoadCuda();
49 CUDA_API void UnloadCuda();
50
51 CUDA_API void InitCuda();
52 CUDA_API bool IsRHISelectedDevice(CUdevice cuDevice);
53
54 void* DriverLibrary;
56
57 uint32 rhiDeviceIndex;
58 TMap<uint32, CUcontext> contextMap;
59};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:23
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition CudaModule.h:17
FOnPostCUDAInit OnPostCUDAInit
Definition CudaModule.h:43
static CUDA_DRIVER_API_FUNCTION_LIST CUDA()
Definition CudaModule.h:19
Definition ModuleInterface.h:14
Definition UnrealString.h.inl:34
Definition CudaWrapper.h:663