Orin VPI2.0 ERROR

I run the rescale sample on CPU.

I run 5 processes at the same time on CPU backend and got an error:
VPI_ERROR_INVALID_OPERATION: PVA is not available and may be oversubscribed in the system: PvaError_DeviceUnavailable,
but I didn’t use PVA backend.
this is my code.
main.cpp (7.1 KB)

Hi,

May I know how you run the sample?
We test your source and it can work correctly without any errors.

$ cmake .
$ make
$ ./vpi_sample_04_rescale cpu /opt/nvidia/vpi2/samples/assets/kodim08.png

Not sure if this is related to the testing image.
Would you mind trying if the same error occurs with the kodim08.png image?

Thanks.

I wrote a shell script to run multiple processes. I got an error : VPI_ERROR_INVALID_OPERATION: PVA is not available and may be oversubscribed in the system: PvaError_DeviceUnavailable When I set the following parameters. I wonder why the PVA error is reported when the backend is set to CPU. You can try to set the number of process_num to 5 or greater than 5 to view the results.

backend=cpu
process_num=5
for((i=0;i<process_num;i++))
do
{
./vpi_sample_04_rescale $backend scaled_input.png > ./upsample/scale_$backend_process$process_num_$i.log 2>&1 &
}
done

Thanks for the sharing.

Confirmed the PVA error can be reproduced when launching 5 processes at the same time.
We are checking this issue with our internal team. Will share more information with you later.

Thanks.

Hi,

Thanks for your patience. Here is some information for you.

When creating the VPIImage:

 CHECK_STATUS(vpiImageCreate(cvImage.cols, cvImage.rows, VPI_IMAGE_FORMAT_NV12_ER, 0, &imageNV12));

The flags = 0 indicates the PVA could be mapped. So the PVA-related context is created.
If you create the image without the PVA backend, the app can run successfully.

Below is the change we made for your reference:

diff --git a/main.cpp b/main.cpp
index 67b66c1..7741449 100644
--- a/main.cpp
+++ b/main.cpp
@@ -122,16 +122,16 @@ int main(int argc, char *argv[])
         // We now wrap the loaded image into a VPIImage object to be used by VPI.
         // VPI won't make a copy of it, so the original
         // image must be in scope at all times.
-        CHECK_STATUS(vpiImageCreateWrapperOpenCVMat(cvImage, 0, &image));
+        CHECK_STATUS(vpiImageCreateWrapperOpenCVMat(cvImage, backend|VPI_BACKEND_CUDA, &image));

         // Create a temporary image to hold the input converted to NV12.
-        CHECK_STATUS(vpiImageCreate(cvImage.cols, cvImage.rows, VPI_IMAGE_FORMAT_NV12_ER, 0, &imageNV12));
+        CHECK_STATUS(vpiImageCreate(cvImage.cols, cvImage.rows, VPI_IMAGE_FORMAT_NV12_ER, backend|VPI_BACKEND_CUDA, &imageNV12));

         // Now create the output image.
-        CHECK_STATUS(vpiImageCreate(cvImage.cols / 2, cvImage.rows / 3, VPI_IMAGE_FORMAT_NV12_ER, 0, &outputNV12));
+        CHECK_STATUS(vpiImageCreate(cvImage.cols / 2, cvImage.rows / 3, VPI_IMAGE_FORMAT_NV12_ER, backend|VPI_BACKEND_CUDA, &outputNV12));

         // And the output image converted back to BGR8
-        CHECK_STATUS(vpiImageCreate(cvImage.cols / 2, cvImage.rows / 3, VPI_IMAGE_FORMAT_BGR8, 0, &output));
+        CHECK_STATUS(vpiImageCreate(cvImage.cols / 2, cvImage.rows / 3, VPI_IMAGE_FORMAT_BGR8, backend|VPI_BACKEND_CUDA, &output));

         // 2. Computation phase ---------------------------------------

Thanks.

1 Like

OK! Thank for you reply.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.