ROCm-OpenCL-Runtime icon indicating copy to clipboard operation
ROCm-OpenCL-Runtime copied to clipboard

build instructions in README.md fails

Open phomes opened this issue 8 years ago • 11 comments

Following the instructions in the README.md fails for me.

I created a dir "amd" and ran the repo init and sync there. That created a opencl dir under which I created a build dir and ran:

$ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..

  • The C compiler identification is GNU 6.3.1 -- The CXX compiler identification is GNU 6.3.1 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Looking for dirent.h -- Looking for dirent.h - found -- Looking for dlfcn.h -- Looking for dlfcn.h - found -- Looking for errno.h -- Looking for errno.h - found -- Looking for fcntl.h -- Looking for fcntl.h - found -- Looking for inttypes.h -- Looking for inttypes.h - found -- Looking for link.h -- Looking for link.h - found -- Looking for malloc.h -- Looking for malloc.h - found -- Looking for malloc/malloc.h -- Looking for malloc/malloc.h - not found -- Looking for ndir.h -- Looking for ndir.h - not found -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for signal.h -- Looking for signal.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for sys/dir.h -- Looking for sys/dir.h - found -- Looking for sys/ioctl.h -- Looking for sys/ioctl.h - found -- Looking for sys/mman.h -- Looking for sys/mman.h - found -- Looking for sys/ndir.h -- Looking for sys/ndir.h - not found -- Looking for sys/param.h -- Looking for sys/param.h - found -- Looking for sys/resource.h -- Looking for sys/resource.h - found -- Looking for sys/stat.h -- Looking for sys/stat.h - found -- Looking for sys/time.h -- Looking for sys/time.h - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for sys/uio.h -- Looking for sys/uio.h - found -- Looking for termios.h -- Looking for termios.h - found -- Looking for unistd.h -- Looking for unistd.h - found -- Looking for valgrind/valgrind.h -- Looking for valgrind/valgrind.h - not found -- Looking for zlib.h -- Looking for zlib.h - found -- Looking for fenv.h -- Looking for fenv.h - found -- Looking for FE_ALL_EXCEPT -- Looking for FE_ALL_EXCEPT - found -- Looking for FE_INEXACT -- Looking for FE_INEXACT - found -- Looking for mach/mach.h -- Looking for mach/mach.h - not found -- Looking for histedit.h -- Looking for histedit.h - found -- Looking for CrashReporterClient.h -- Looking for CrashReporterClient.h - not found -- Looking for linux/magic.h -- Looking for linux/magic.h - found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Looking for pthread_getspecific in pthread -- Looking for pthread_getspecific in pthread - found -- Looking for pthread_rwlock_init in pthread -- Looking for pthread_rwlock_init in pthread - found -- Looking for pthread_mutex_lock in pthread -- Looking for pthread_mutex_lock in pthread - found -- Looking for dlopen in dl -- Looking for dlopen in dl - found -- Looking for clock_gettime in rt -- Looking for clock_gettime in rt - found -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
    -- Looking for compress2 in z -- Looking for compress2 in z - found -- Looking for el_init in edit -- Looking for el_init in edit - found -- Looking for setupterm in tinfo -- Looking for setupterm in tinfo - found -- Looking for xar_open in xar -- Looking for xar_open in xar - not found -- Looking for arc4random -- Looking for arc4random - not found -- Looking for backtrace -- Looking for backtrace - found -- backtrace facility detected in default set of libraries -- Found Backtrace: /usr/include
    -- Looking for _Unwind_Backtrace -- Looking for _Unwind_Backtrace - found -- Looking for getpagesize -- Looking for getpagesize - found -- Looking for sysconf -- Looking for sysconf - found -- Looking for getrusage -- Looking for getrusage - found -- Looking for setrlimit -- Looking for setrlimit - found -- Looking for isatty -- Looking for isatty - found -- Looking for futimens -- Looking for futimens - found -- Looking for futimes -- Looking for futimes - found -- Looking for posix_fallocate -- Looking for posix_fallocate - found -- Looking for sigaltstack -- Looking for sigaltstack - found -- Looking for writev -- Looking for writev - found -- Looking for lseek64 -- Looking for lseek64 - found -- Looking for mallctl -- Looking for mallctl - not found -- Looking for mallinfo -- Looking for mallinfo - found -- Looking for malloc_zone_statistics -- Looking for malloc_zone_statistics - not found -- Looking for mkdtemp -- Looking for mkdtemp - found -- Looking for mkstemp -- Looking for mkstemp - found -- Looking for mktemp -- Looking for mktemp - found -- Looking for getcwd -- Looking for getcwd - found -- Looking for gettimeofday -- Looking for gettimeofday - found -- Looking for getrlimit -- Looking for getrlimit - found -- Looking for posix_spawn -- Looking for posix_spawn - found -- Looking for pread -- Looking for pread - found -- Looking for realpath -- Looking for realpath - found -- Looking for sbrk -- Looking for sbrk - found -- Looking for strtoll -- Looking for strtoll - found -- Looking for strerror -- Looking for strerror - found -- Looking for strerror_r -- Looking for strerror_r - found -- Looking for strerror_s -- Looking for strerror_s - not found -- Looking for setenv -- Looking for setenv - found -- Looking for dlopen -- Looking for dlopen - found -- Looking for dladdr -- Looking for dladdr - not found -- Looking for GLIBC -- Looking for GLIBC - found -- Looking for pthread_getname_np in pthread -- Looking for pthread_getname_np in pthread - found -- Looking for pthread_setname_np in pthread -- Looking for pthread_setname_np in pthread - found -- Performing Test HAVE_INT64_T -- Performing Test HAVE_INT64_T - Success -- Performing Test HAVE_UINT64_T -- Performing Test HAVE_UINT64_T - Success -- Performing Test HAVE_U_INT64_T -- Performing Test HAVE_U_INT64_T - Success -- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB -- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success -- Performing Test LLVM_HAS_ATOMICS -- Performing Test LLVM_HAS_ATOMICS - Success -- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG -- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG - Success -- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG -- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG - Failed -- Performing Test HAS_MAYBE_UNINITIALIZED -- Performing Test HAS_MAYBE_UNINITIALIZED - Success -- Native target architecture is X86 -- Threads enabled. -- Doxygen disabled. -- Go bindings enabled. -- Found OCaml: /usr/bin/ocamlfind
    -- OCaml bindings disabled, need ctypes >=0.4. -- LLVM host triple: x86_64-unknown-linux-gnu -- LLVM default target triple: x86_64-unknown-linux-gnu -- Performing Test C_SUPPORTS_FPIC -- Performing Test C_SUPPORTS_FPIC - Success -- Performing Test CXX_SUPPORTS_FPIC -- Performing Test CXX_SUPPORTS_FPIC - Success -- Building with -fPIC -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success -- Performing Test C_SUPPORTS_WERROR_DATE_TIME -- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success -- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME -- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success -- Performing Test CXX_SUPPORTS_CXX11 -- Performing Test CXX_SUPPORTS_CXX11 - Success -- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG -- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success -- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG -- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed -- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG -- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed -- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG -- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Failed -- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG -- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Success -- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP -- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed -- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG -- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Failed -- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG -- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Failed -- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS -- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS - Success -- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS -- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS - Success -- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS -- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS - Success -- Performing Test C_SUPPORTS_FDATA_SECTIONS -- Performing Test C_SUPPORTS_FDATA_SECTIONS - Success -- Performing Test CXX_SUPPORTS_FDATA_SECTIONS -- Performing Test CXX_SUPPORTS_FDATA_SECTIONS - Success -- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.13") -- Constructing LLVMBuild project information git: 'svn' is not a git command. See 'git --help'.

Did you mean one of these? fsck mv show -- Targeting AMDGPU -- Targeting X86 -- Found Z3: /usr/lib64/libz3.so (Required is at least version "4.5") -- Looking for sys/resource.h -- Looking for sys/resource.h - found -- Clang version: 5.0.0 -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed -- LLD version: 5.0.0 CMake Warning at library/amdgcn/CMakeLists.txt:12 (message): amdhsacod is not found, testing disabled

CMake Warning at library/amdgcn/CMakeLists.txt:13 (message): Specify amdhsacod executable with -DAMDHSACOD=<...>

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: HSA_LIB linked by target "amdocl64" in directory /home/phomes/amd/opencl/api/opencl/amdocl

-- Configuring incomplete, errors occurred! See also "/home/phomes/amd/opencl/build/CMakeFiles/CMakeOutput.log". See also "/home/phomes/amd/opencl/build/CMakeFiles/CMakeError.log".

phomes avatar May 15 '17 20:05 phomes

You need to install ROCm 1.5 first. You'll find the instructions at https://rocm.github.io/install.html

I'll update the README. Thank you for reporting this issue.

lmoriche avatar May 15 '17 21:05 lmoriche

Thanks!

Not my lucky day though:

dnf install rocm

Error: package rocm-1.5.80-1.x86_64 requires kernel = 4.9.0_kfd_compute_rocm_rel_1.5_80-2, but none of the providers can be installed

On fedora 25. I will try to build from source

phomes avatar May 15 '17 21:05 phomes

Hi, I will correct this today.

jedwards-AMD avatar May 15 '17 21:05 jedwards-AMD

If you would like to install the binaries right how you can do this work around:

'sudo dnf install rocm-dev'

This will give you all of the development packages that you need to link opencl against. You can then install the driver parts with these commands:

'sudo dnf install kernel-4.9.0_kfd_compute_rocm_rel_1.5_80' 'sudo dnf install kernel-headers-4.9.0_kfd_compute_rocm_rel_1.5_80' 'sudo dnf install Linux-firmware-201705121727'

jedwards-AMD avatar May 15 '17 21:05 jedwards-AMD

i am on fedora 25 with kernel 4.11.6-201 all build fine but LLVM_BIN=./compiler/llvm/bin LD_LIBRARY_PATH=./api/opencl/amdocl clinfo
Number of platforms 0

opencl with the amdgpu-pro opencl works fine [AMD/ATI] Baffin [Radeon RX 460]

any idea what i can do?

arpu avatar Jun 27 '17 22:06 arpu

In a recent change, we moved the OpenCL runtime install directory to ${CMAKE_BINARY_DIR}/lib. I've updated the build instructions, you should now set LD_LIBRARY_PATH=./lib

lmoriche avatar Jun 27 '17 22:06 lmoriche

ok i see thx for this hint!

but get the same result :/ do i need any drm driver? package rocm-1.5.99-1.x86_64 requires kernel = 4.9.0_kfd_compute_rocm_rel_1.5_99, but none of the providers can be installed

arpu avatar Jun 27 '17 22:06 arpu

ldd /usr/bin/clinfo  1 ↵  10240  00:30:25 linux-vdso.so.1 (0x00007ffe97ff0000) libOpenCL.so.1 => ./lib/libOpenCL.so.1 (0x00007f7e9863e000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f7e98400000) libc.so.6 => /lib64/libc.so.6 (0x00007f7e9803a000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7e97e1c000) /lib64/ld-linux-x86-64.so.2 (0x000055eb50162000)

arpu avatar Jun 27 '17 22:06 arpu

and this is the working amdgpu-pro ldd /usr/bin/clinfo  ✓  10267  00:32:03 linux-vdso.so.1 (0x00007ffc011a4000) libOpenCL.so.1 => /opt/amdgpu-pro/lib64/libOpenCL.so.1 (0x00007f993d23e000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f993d03a000) libc.so.6 => /lib64/libc.so.6 (0x00007f993cc74000) librt.so.1 => /lib64/librt.so.1 (0x00007f993ca6c000) libm.so.6 => /lib64/libm.so.6 (0x00007f993c763000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f993c543000) /lib64/ld-linux-x86-64.so.2 (0x00005571bf7f8000)

arpu avatar Jun 27 '17 22:06 arpu

Run clinfo in gdb, and set a breakpoint on dlopen to see which libraries are loaded and wether a non-null handle is returned.

lmoriche avatar Jun 27 '17 23:06 lmoriche

@phomes In addition to needing the rest of the ROCm stack, it looks like your git distro did not include subversion support. This can be installed as the git-svn package on Debian, Ubuntu and Red Hat distros. If you're on Gentoo, you'll want to add the these to a /etc/portage/package.use/ file before emergeing git:

dev-vcs/git subversion
dev-vcs/subversion -dso perl

I was unable to build everything without it.

@arpu you may want to try running it with strace e.g. LLVM_BIN=./compiler/llvm/bin LD_LIBRARY_PATH=./api/opencl/amdocl strace clinfo to see what step of platform discovery is failing. I have encountered two failure scenarios so far that may help you:

  • Missing an icd file in the icd loader's search path
    • Can be remedied by sudo cp <synced-opencl-repo>/api/opencl/config/amdocl64.icd /etc/OpenCL/vendors/
    • The name of the library the icd references has changed from the one in AMDGPU-Pro 17.20, so this might explain why amdgpu-pro continues to work for you if you have its icd in the vendors search path.
  • KFD HSA driver stack incompatibility
    • Check ls /sys/devices/virtual/kfd/kfd/topology/nodes to see if there is a node recognized for your GPUs (there might also be node(s) for your CPU(s)).
    • If there isn't, the easiest blanket way to ensure compatibility is to use the ROCK linux kernel. If you can't, then you may be able to use the individual applicable modules if your active Linux kernel is compatible (e.g. 4.9)

JustinTArthur avatar Jul 26 '17 15:07 JustinTArthur