1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

CUDA 12.9 support: build NppStreamContext manually

This commit is contained in:
ruisv
2025-05-06 23:47:12 +08:00
committed by GitHub
parent 16a3d37dc1
commit 8a2903c190
@@ -147,7 +147,23 @@ namespace cv { namespace cuda
inline explicit NppStreamHandler(cudaStream_t newStream)
{
nppStreamContext = {};
nppSafeCall(nppGetStreamContext(&nppStreamContext));
#if CUDA_VERSION < 12090
nppSafeCall(nppGetStreamContext(&nppStreamContext));
#else
int device = 0;
cudaSafeCall(cudaGetDevice(&device));
cudaDeviceProp prop{};
cudaSafeCall(cudaGetDeviceProperties(&prop, device));
nppStreamContext.nCudaDeviceId = device;
nppStreamContext.nMultiProcessorCount = prop.multiProcessorCount;
nppStreamContext.nMaxThreadsPerMultiProcessor = prop.maxThreadsPerMultiProcessor;
nppStreamContext.nMaxThreadsPerBlock = prop.maxThreadsPerBlock;
nppStreamContext.nSharedMemPerBlock = prop.sharedMemPerBlock;
nppStreamContext.nCudaDevAttrComputeCapabilityMajor = prop.major;
nppStreamContext.nCudaDevAttrComputeCapabilityMinor = prop.minor;
#endif
nppStreamContext.hStream = newStream;
cudaSafeCall(cudaStreamGetFlags(nppStreamContext.hStream, &nppStreamContext.nStreamFlags));
}