pocl: [CUDA] pocl on Jetson Tx2 / Segfault
Hi! I tried to run pocl with CUDA support on my TX2 but I got a segfault, any idea ? Anything I can test to figure out why?
-
Summary: I compiled pocl on the Nvidia Jetson TX2 without errors, the host C API works (to get the platforms, devices,…) but executing a Kernel on the GPU (not on the CPU) generates a segmentation fault
-
Hardware:
- Jetson TX2
- Running Ubuntu 18.04 (Linux nvidia 4.9.140-tegra #1 SMP PREEMPT Thu Jun 25 21:22:12 PDT 2020 aarch64 aarch64 aarch64 GNU/Linux)
-
Details:
To compile pocl with CUDA support I used:
sudo apt-get install -y ocl-icd-dev opencl-headers clinfo ocl-icd-opencl-dev
sudo apt-get install -y build-essential cmake git pkg-config
sudo apt-get install -y libtinfo-dev libltdl-dev zlib1g-dev
sudo apt-get install -y libhwloc-dev libglew-dev libedit-dev
sudo apt-get install -y libclang-dev clang clang-format clang-tidy
sudo apt-get install -y ocl-icd-libopencl1
git clone https://github.com/pocl/pocl.git
cd pocl
mkdir build
cd build
cmake -DENABLE_CUDA=ON -DCMAKE_BUILD_TYPE=Release -DLLC_HOST_CPU=cortex-a57 -DHOST_CPU_CACHELINE_SIZE=64 -DWITH_LLVM_CONFIG=/usr/bin/llvm-config-6.0 -DSINGLE_LLVM_LIB=1 -DENABLE_ICD=1 ..
make
sudo make install
sudo cp /usr/local/etc/OpenCL/vendors/pocl.icd /etc/OpenCL/vendors
- Host API C example:
1. Device: pthread-cortex-a57
1.1 Hardware version: OpenCL 1.2 pocl HSTR: pthread-aarch64-unknown-linux-gnu-cortex-a57
1.2 Software version: 1.6-pre master-0-ga54ec90f
1.3 OpenCL C version: OpenCL C 1.2 pocl
1.4 Parallel compute units: 4
2. Device: NVIDIA Tegra X2
2.1 Hardware version: OpenCL 1.2 pocl HSTR: CUDA-sm_62
2.2 Software version: 1.6-pre master-0-ga54ec90f
2.3 OpenCL C version: OpenCL C 1.2 pocl
2.4 Parallel compute units: 2
- Hello world on CPU then GPU:
nvidia@nvidia:~/openCL/pyOpenCL$ python3 demo_float32.py
Generate 1000000 random numbers of type <class 'numpy.float32'>
Buffer types: float32 float32 float32
Create OpenCL context and queue
Choose platform:
[0] <pyopencl.Platform 'Portable Computing Language' at 0x7fa1c1a898>
Choice [0]:
Choose device(s):
[0] <pyopencl.Device 'pthread-cortex-a57' on 'Portable Computing Language' at 0x2e1660c0>
[1] <pyopencl.Device 'NVIDIA Tegra X2' on 'Portable Computing Language' at 0x2e166400>
Choice, comma-separated [0]:
Set the environment variable PYOPENCL_CTX=':' to avoid being asked again.
Create buffers
Reading kernel file
Compiling kernel
Executing computation
Transferring result to host
Computing on the host using numpy
local type: float32
Comparing results
Difference :[0. 0. 0. ... 0. 0. 0.]
[0.64723694 0.23839813 0.8510261 0.28540653 0.8327386 ]
[0.5568099 0.7033611 0.6514212 0.29588565 0.01154003]
[1.2040468 0.9417592 1.5024474 0.58129215 0.84427863]
[1.2040468 0.9417592 1.5024474 0.58129215 0.84427863]
Checking the norm between both: 0.0
Checking results are mostly the same: True
comparing execution times
openCL: 8.956480000000045 ms
openCL copy from device to host: 1.3774719999999352 ms
numpy: 5.307775999999986 ms
nvidia@nvidia:~/openCL/pyOpenCL$ python3 demo_float32.py
Generate 1000000 random numbers of type <class 'numpy.float32'>
Buffer types: float32 float32 float32
Create OpenCL context and queue
Choose platform:
[0] <pyopencl.Platform 'Portable Computing Language' at 0x7fa7a38898>
Choice [0]:
Choose device(s):
[0] <pyopencl.Device 'pthread-cortex-a57' on 'Portable Computing Language' at 0xf13a0c0>
[1] <pyopencl.Device 'NVIDIA Tegra X2' on 'Portable Computing Language' at 0xf13a400>
Choice, comma-separated [0]:1
Set the environment variable PYOPENCL_CTX=':1' to avoid being asked again.
Create buffers
Reading kernel file
Compiling kernel
Executing computation
Transferring result to host
Segmentation fault (core dumped)
- clinfo:
Number of platforms 1
Platform Name Portable Computing Language
Platform Vendor The pocl project
Platform Version OpenCL 1.2 pocl 1.6-pre master-0-ga54ec90f, Release, LLVM 6.0.0, RELOC, SLEEF, FP16, CUDA, POCL_DEBUG
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix POCL
Platform Name Portable Computing Language
Number of devices 2
Device Name pthread-cortex-a57
Device Vendor ARM
Device Vendor ID 0x13b5
Device Version OpenCL 1.2 pocl HSTR: pthread-aarch64-unknown-linux-gnu-cortex-a57
Driver Version 1.6-pre master-0-ga54ec90f
Device OpenCL C Version OpenCL C 1.2 pocl
Device Type CPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 4
Max clock frequency 2035MHz
Device Partition (core)
Max number of sub-devices 4
Supported partition types equally, by counts
Max work item dimensions 3
Max work item sizes 4096x4096x4096
Max work group size 4096
Preferred work group size multiple 8
Preferred / native vector sizes
char 16 / 16
short 8 / 8
int 4 / 4
long 2 / 2
half 8 / 8 (cl_khr_fp16)
float 4 / 4
double 2 / 2 (cl_khr_fp64)
Half-precision Floating-point support (cl_khr_fp16)
Denormals No
Infinity and NANs No
Round to nearest No
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Address bits 64, Little-Endian
Global memory size 6085697536 (5.668GiB)
Error Correction support No
Max memory allocation 2147483648 (2GiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 2097152 (2MiB)
Global Memory cache line size 64 bytes
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 134217728 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 8192x8192 pixels
Max 3D image size 2048x2048x2048 pixels
Max number of read image args 128
Max number of write image args 128
Local memory type Global
Local memory size 1048576 (1024KiB)
Max number of constant args 8
Max constant buffer size 1048576 (1024KiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution Yes
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 1ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels Yes
printf() buffer size 16777216 (16MiB)
Built-in kernels
Device Extensions cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_fp16 cl_khr_fp64
Device Name NVIDIA Tegra X2
Device Vendor NVIDIA Corporation
Device Vendor ID 0x10de
Device Version OpenCL 1.2 pocl HSTR: CUDA-sm_62
Driver Version 1.6-pre master-0-ga54ec90f
Device OpenCL C Version OpenCL C 1.2 pocl
Device Type GPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 2
Max clock frequency 1300MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types None
Max work item dimensions 3
Max work item sizes 1024x1024x64
Max work group size 1024
Preferred work group size multiple 32
Preferred / native vector sizes
char 1 / 1
short 1 / 1
int 1 / 1
long 1 / 1
half 0 / 0 (n/a)
float 1 / 1
double 1 / 1 (cl_khr_fp64)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Address bits 64, Little-Endian
Global memory size 8233181184 (7.668GiB)
Error Correction support No
Max memory allocation 2058295296 (1.917GiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 4096 bits (512 bytes)
Global Memory cache type None
Image support No
Local memory type Local
Local memory size 49152 (48KiB)
Max number of constant args 8
Max constant buffer size 65536 (64KiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 1ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
printf() buffer size 16777216 (16MiB)
Built-in kernels
Device Extensions cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Portable Computing Language
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [POCL]
clCreateContext(NULL, ...) [default] Success [POCL]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name Portable Computing Language
Device Name pthread-cortex-a57
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) Success (1)
Platform Name Portable Computing Language
Device Name pthread-cortex-a57
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Portable Computing Language
Device Name NVIDIA Tegra X2
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (2)
Platform Name Portable Computing Language
Device Name pthread-cortex-a57
Device Name NVIDIA Tegra X2
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.11
ICD loader Profile OpenCL 2.1
- CUDA Tests:
../tools/scripts/run_cuda_tests
Using OCL_ICD_VENDORS: /home/nvidia/openCL/pocl/build/ocl-vendors
...
58% tests passed, 29 tests failed out of 69
Label Time Summary:
cuda = 155.97 sec*proc (69 tests)
hsa = 6.62 sec*proc (4 tests)
hsa-native = 138.55 sec*proc (56 tests)
internal = 155.97 sec*proc (69 tests)
kernel = 89.46 sec*proc (20 tests)
regression = 46.02 sec*proc (28 tests)
runtime = 10.50 sec*proc (14 tests)
tce = 14.77 sec*proc (9 tests)
Total Test time (real) = 156.06 sec
The following tests FAILED:
26 - kernel/test_shuffle_char (Failed)
27 - kernel/test_shuffle_short (Failed)
28 - kernel/test_shuffle_ushort (Failed)
30 - kernel/test_shuffle_int (Failed)
31 - kernel/test_shuffle_uint (Failed)
32 - kernel/test_shuffle_float (Failed)
33 - kernel/test_shuffle_long (Failed)
34 - kernel/test_shuffle_ulong (Failed)
37 - kernel/test_shuffle_double (Failed)
44 - regression/phi_nodes_not_replicated_REPL (Failed)
46 - regression/barrier_between_two_for_loops_REPL (Failed)
47 - regression/simple_for-loop_with_a_barrier_inside_REPL (Failed)
48 - regression/for-loop_with_computation_after_the_brexit_REPL (Failed)
49 - regression/for-loop_with_a_variable_iteration_count_REPL (Failed)
50 - regression/early_return_before_a_barrier_region_REPL (Failed)
51 - regression/id-dependent_computation_before_kernel_exit_REPL (Failed)
52 - regression/barrier_just_before_return_REPL (Failed)
54 - regression/undominated_variable_from_conditional_barrier_handling_REPL (Failed)
68 - regression/phi_nodes_not_replicated_LOOPS (Failed)
70 - regression/barrier_between_two_for_loops_LOOPS (Failed)
71 - regression/simple_for-loop_with_a_barrier_inside_LOOPS (Failed)
72 - regression/for-loop_with_computation_after_the_brexit_LOOPS (Failed)
73 - regression/for-loop_with_a_variable_iteration_count_LOOPS (Failed)
74 - regression/early_return_before_a_barrier_region_LOOPS (Failed)
76 - regression/barrier_just_before_return_LOOPS (Failed)
78 - regression/undominated_variable_from_conditional_barrier_handling_LOOPS (Failed)
82 - regression/setting_a_buffer_argument_to_NULL_causes_a_segfault (Failed)
83 - regression/clSetKernelArg_overwriting_the_previous_kernel's_args (Failed)
85 - regression/case_with_multiple_variable_length_loops_and_a_barrier_in_one (Failed)
Errors while running CTest
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (9 by maintainers)
hi isuruf, I can share you the access to my device.
I’ll set up a remote access tomorrow and let you know when I did it.