ROCm / MIOpen

AMD's Machine Intelligence Library
https://rocm.docs.amd.com/projects/MIOpen/en/latest/
Other
1.09k stars 231 forks source link

MIOpen not found by hipcc? (ld.lld: error: unable to find library) #3189

Closed Picus303 closed 3 months ago

Picus303 commented 3 months ago

Hello! I'm sorry to ask this here, I really didn't where to ask and I thought you might be the most likely to know. I'm a engineering student trying to learn how to use HIP/ROCM by myself and it's hard as you can guess...

I can't find a way to include MIOpen when I compile my code with hipcc. #include <miopen/miopen.h> + hipcc main.hip -o test -Wall -Wextra -lmiopen-hip -lhiprand

The error is:

ld.lld: error: unable to find library -lmiopen-hip
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried multiple variations such as -lmiopen or -lmiopen-hip-dev but none worked.

There is the MIOpen '.so' file in the ROCm lib folder and apt show rocm-libs -a shows me:

miopen-hip (= 3.00.0.60002-115~22.04)
miopen-hip-dev (= 3.00.0.60002-115~22.04)

Again, I'm sorry to bother you with this but please, do you know what I missed?

junliume commented 3 months ago

@Picus303 could you try -lmiopen instead of -lmiopen-hip? The so file usually is located at /opt/rocm/lib/libMIOpen.so Please let us know if you still encounter problems. Thanks!

Picus303 commented 3 months ago

Thanks for your answer! As I said, -lmiopen give the same result and the so file is where it's supposed to be in /opt/rocm/lib/libMIOpen.so.

Note that I was able to compile with the other libraries I tried. For now: hipBLAS, rocBLAS, hipRAND, hipFFT, rocSOLVER.

Picus303 commented 3 months ago

@junliume Otherwise, it seems like there is a little more documentation to compile with CMAKE (https://rocm.docs.amd.com/en/latest/conceptual/cmake-packages.html). Do you think it would be better for me to use it?

EDIT: I was able to make it work with CMake but still unable with hipcc. It's not as big as a problem now that I have another solution but I'm still curious to know why only MIOpen can't be found.

junliume commented 3 months ago

@Picus303 sorry I made a typo above (and it reveals a problem that might result in our oversight, and our team needs to figure out a way to be more consistent with the other libraries in naming convention).

Could you try -lMIOpen instead of -lmiopen? The reason is that MIOpen so file is named as such at /opt/rocm/lib/libMIOpen.so

P.S. a dry run of hipcc -lmiopen -v vs. hipcc -lMIOpen -v will show more details in the terminal.

Picus303 commented 3 months ago

@junliume That was it, Thanks!

And yeah, it would be nice if it could be written in lowercase like the others or if there was a documentation page with a list like on the one I sent you for CMake.

btw, if one day I reach a level that makes me legitimate to do so, I'd like to help with the ROCm/HIP documentation (add more full examples, stuff like that). Do you think it would be possible for someone who doesn't work at AMD?