NVIDIA / trt-samples-for-hackathon-cn

Simple samples for TensorRT programming
Apache License 2.0
1.5k stars 342 forks source link

cookbook/03-APIModel/MNISTExample-pyTorch的C++例程在WSL中运行时提示 ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information) #47

Open dongyang2011 opened 2 years ago

dongyang2011 commented 2 years ago

cookbook/03-APIModel/MNISTExample-pyTorch中的C++例程可以正常编译,运行结果也是正确的。但是会在运行时提示错误 ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)

执行make test

$ make test
make clean
make[1]: Entering directory '/home/dongyang/trt-samples-for-hackathon-cn/cookbook/03-APIModel/MNISTExample-pyTorch/C++'
rm -rf ./*.d ./*.o ./*.so ./*.exe ./*.plan
make[1]: Leaving directory '/home/dongyang/trt-samples-for-hackathon-cn/cookbook/03-APIModel/MNISTExample-pyTorch/C++'
make -j3
make[1]: Entering directory '/home/dongyang/trt-samples-for-hackathon-cn/cookbook/03-APIModel/MNISTExample-pyTorch/C++'
/usr/local/cuda/bin/nvcc -w -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/opt/TensorRT-8.4.3.1/include -M -MT main.o -o main.d main.cpp
/usr/local/cuda/bin/nvcc -w -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/opt/TensorRT-8.4.3.1/include -M -MT cnpy.o -o cnpy.d cnpy.cpp
/usr/local/cuda/bin/nvcc -w -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/opt/TensorRT-8.4.3.1/include -M -MT calibrator.o -o calibrator.d calibrator.cpp
/usr/local/cuda/bin/nvcc -w -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/opt/TensorRT-8.4.3.1/include -Xcompiler -fPIC -o calibrator.o -c calibrator.cpp
/usr/local/cuda/bin/nvcc -w -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/opt/TensorRT-8.4.3.1/include -Xcompiler -fPIC -o main.o -c main.cpp
/usr/local/cuda/bin/nvcc -w -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/opt/TensorRT-8.4.3.1/include -Xcompiler -fPIC -o cnpy.o -c cnpy.cpp
/usr/local/cuda/bin/nvcc -L/usr/local/cuda/lib64 -lcudart -L/opt/TensorRT-8.4.3.1/lib -lnvinfer -lz -o main.exe main.o cnpy.o calibrator.o
make[1]: Leaving directory '/home/dongyang/trt-samples-for-hackathon-cn/cookbook/03-APIModel/MNISTExample-pyTorch/C++'
python3 ./createCalibrationAndInferenceData.py
Succeeded creating data for calibration and inference!
./main.exe > result-C++.log
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)

执行./main.exe

$ ./main.exe
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
ERROR: 2: [virtualMemoryBuffer.cpp::resizePhysical::144] Error Code 2: OutOfMemory (no further information)
Succeeded building serialized engine!
Succeeded building engine!
Binding all? Yes
Bind[0]:i[0]->FLOAT (1, 1, 28, 28) inputT0
Bind[1]:o[0]->INT32 (1, 1) (Unnamed Layer* 17) [TopK]_output_2

inputT0: (1, 1, 28, 28, )
absSum=33566.0000,mean=42.8138,var=7573.8174,max=255.0000,min= 0.0000,diff=15760.0000,
 0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000, 
 0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000,  0.00000, 

(Unnamed Layer* 17) [TopK]_output_2: (1, 1, )
absSum= 8.0000,mean= 8.0000,var= 0.0000,max=      8,min=      8,diff= 0.0000,
       8, 
       8, 
     8 

环境: Windows 11(22000.856)WSL2 GPU:NVIDIA GeForce RTX 3070 Laptop 驱动版本 512.78 CUDA: 11.6.2 sh文件安装 CUDNN: 8.4.1.50 Tar文件安装 TensorRT: 8.4.3.1 Tar文件安装

conda: cuda-python 11.6 cudatoolkit 11.6 cudnn 8.4.1.50