sowson/darknet

opencl_load: could not link. error: CL_INVALID_LINKER_OPTIONS

Grench6 opened this issue · 2 comments

OS: Ubuntu 20.04.1 LTS

I have a RTX580, so I am using rocm and the opencl it comes with. I have successfully built darknet, but whenever I try to run it I get the following output:

user@user-pc:~/darknet-1.2$ ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights
Device IDs: 1
Device ID: 0
Device name: gfx803
Device vendor: Advanced Micro Devices, Inc.
Device opencl availability: OpenCL 1.2 
Device opencl used: 3137.0 (HSA1.1,LC)
Device double precision: YES
Device max group size: 256
Device address bits: 64
opencl_load: could not link. error: CL_INVALID_LINKER_OPTIONS
CL_PROGRAM_BUILD_LOG:

user@user-pc:~/darknet-1.2$

What am I doing wrong?
Does opencl_load: could not link. error: CL_INVALID_LINKER_OPTIONS mean something is wrong with my opencl? or is it the way I built darknet?
My google-fu was useless.

Hello @Grench6
Please try the: git apply rocm.patch.txt in the darknet directory
From this one file: rocm.patch.txt
Thx! Let me know if that works?

Hello @sowson, thanks for the quick response!

This is what I got:

user@user-pc:~/github/darknet$ git apply rocm.patch.txt
error: patch failed: src/opencl.c:309
error: src/opencl.c: patch does not apply
user@user-pc:~/github/darknet$

I don't know why the files differ (only a little bit), since I cloned the main branch. So I manually made the changes specified in the patch... and it worked! 😃

Now I am getting another error, but it has something to do with a failed assertion on opencv, and I am almost sure it is my fault (I had problems installing opencv, so I used a script for and things got messy). I will attach the output just in case:

user@user-pc:~/github/darknet$ ./darknet detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights data/dog.jpg
Device IDs: 1
Device ID: 0
Device name: gfx803
Device vendor: Advanced Micro Devices, Inc.
Device opencl availability: OpenCL 1.2 
Device opencl used: 3137.0 (HSA1.1,LC)
Device double precision: YES
Device max group size: 256
Device address bits: 64
layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   608 x 608 x   3   ->   608 x 608 x  32  0.639 BFLOPs
    1 conv     64  3 x 3 / 2   608 x 608 x  32   ->   304 x 304 x  64  3.407 BFLOPs
   [...]
  105 conv    255  1 x 1 / 1    76 x  76 x 256   ->    76 x  76 x 255  0.754 BFLOPs
  106 yolo
Loading weights from yolov3.weights...Done!
data/dog.jpg: Predicted in 2.684549 seconds.
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.3) /home/user/github/Install-OpenCV/Ubuntu/OpenCV/opencv-3.4.3/modules/core/src/matrix_wrap.cpp:800: error: (-215:Assertion failed) (flags & FIXED_TYPE) != 0 in function 'type'

Aborted (core dumped)
user@user-pc:~/github/darknet$

I see you updated your blog to include the setup for Ubuntu, I will check it out and hopefully my error is fixed.
I will close the issue, thank you very much! 👍🏾 💯