Closed kunalsekhri closed 8 years ago
Hi kunalsekhri, do you have an OpenCL-enabled GPU in your system? Do you have OpenCL-enabled drivers installed for it? Can you provide the output of the clinfo
command please? You might need to install it first, eg sudo apt-get install clinfo
. By the way, what operating system are you using?
hi , Following is the result of clinfo on my system
umber of platforms 1 Platform Name NVIDIA CUDA Platform Vendor NVIDIA Corporation Platform Version OpenCL 1.2 CUDA 7.5.18 Platform Profile FULL_PROFILE Platform Extensions cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts Platform Extensions function suffix NV
Platform Name NVIDIA CUDA
Number of devices 1
Device Name GeForce GTX 960
Device Vendor NVIDIA Corporation
Device Vendor ID 0x10de
Device Version OpenCL 1.2 CUDA
Driver Version 352.39
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile FULL_PROFILE
Device Topology (NV) PCI-E, 01:00.0
Max compute units 8
Max clock frequency 1342MHz
NVIDIA Compute Capability 5.2
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
Warp size (NV) 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 Yes
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
Correctly-rounded divide and sqrt operations No
Address bits 64, Little-Endian
Global memory size 4294246400 (3.999GiB)
Error Correction support No
Max memory allocation 1073561600 (1024MiB)
Unified memory for Host and Device No
Integrated memory (NV) No
Minimum alignment for any data type 128 bytes
Alignment of base address 4096 bits (512 bytes)
Global Memory cache type Read/Write
Global Memory cache size 131072
Global Memory cache line 128 bytes
Image support Yes
Max number of samplers per kernel 32
Max size for 1D images from buffer 134217728 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 16384x16384 pixels
Max 3D image size 4096x4096x4096 pixels
Max number of read image args 256
Max number of write image args 16
Local memory type Local
Local memory size 49152 (48KiB)
Registers per block (NV) 65536
Max constant buffer size 65536 (64KiB)
Max number of constant args 9
Max size of kernel argument 4352 (4.25KiB)
Queue properties
Out-of-order execution Yes
Profiling Yes
Profiling timer resolution 1000ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
Kernel execution timeout (NV) Yes
Concurrent copy and kernel execution (NV) Yes
Number of async copy engines 2
Prefer user sync for interop No
printf() buffer size 1048576 (1024KiB)
Built-in kernels
Device Available Yes
Compiler Available Yes
Linker Available Yes
Device Extensions cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts 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
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) NVIDIA CUDA
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [NV]
clCreateContext(NULL, ...) [default] Success [NV]
clCreateContext(NULL, ...) [other]
ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.3 ICD loader Profile OpenCL 1.2
My OS is . Distributor ID: Ubuntu Description: Ubuntu 15.04 Release: 15.04 Codename: vivid
Hmmm, looks convincing. Shows a device with device type 'GPU'. OpenCL 1.2 too, which isn't a prerequisite for cltorch, but which is nice :-) Puzzling. Can you confirm that just after running clinfo
, with above output, you are still getting the same error as earlier in cltorch. Not that clinfo
changes anything, just want to confirm that it isn't sometimes-working sometimes-isnt.
Can you also provide:
/etc/OpenCL/vendors
please, along with their filenamesls /opt/cuda-7.0/lib64
.(Edit: interestingly, OpenCL 1.2 available for my NVIDIA devices too now :-) Just for completeness, please note that I upgraded my driver to 352.55, and cltorch tests continue to work for me:
______________________________________________________________________________________________________________|_ ==> test_sumall
_______________________________________________________________________________________________________________| ==> test_sumallt
________________________________________________________________________________________________________________ ==> Done
Completed 219 asserts in 112 tests with 0 errors
--------------------------------------------------------------------------------
all tests finished
$ nvidia-smi
Sun Oct 25 10:55:26 2015
+------------------------------------------------------+
| NVIDIA-SMI 352.55 Driver Version: 352.55 |
|-------------------------------+----------------------+----------------------+
)
Edit 2: seems the driver on my system is at :
/usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1
/usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.352.55
Can you do ls -l
on /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1
on your system, and also on the file that it symbolically links to? (ie, on my system, the first file links to the second:
$ ls -l /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1
lrwxrwxrwx 1 root root 26 Oct 25 10:50 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1 -> libnvidia-opencl.so.352.55
$ ls -lh /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.352.55
-rwxr-xr-x 1 root root 16M Oct 25 10:50 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.352.55
Edit 3: can you also run the following, and provide the results please? :
~/torch/bin/gpuinfo
My results of are /etc/OpenCL/vendors ==> libnvidia-opencl.so.1.
yes results are same luajit -l cltorch -e 'cltorch.test()' luajit: Something went wrong: OpenCL library not found at /tmp/luarocks_cltorch-scm-1-79/cltorch/cltorch/src/init.cpp:225 stack traceback: [C]: at 0x7ffa2100f0a0 [C]: in function 'require' ...landmarker3/torch/install/share/lua/5.1/cltorch/init.lua:19: in main chunk [C]: at 0x0046eba0 [C]: at 0x00405ea0
My result for ls -l in user directory $ sudo ls -l /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1 lrwxrwxrwx 1 root root 26 Aug 15 00:45 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1 -> libnvidia-opencl.so.352.39
$ sudo ls -l /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.352.39 -rw-r--r-- 1 root root 15898064 Aug 14 20:54 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.352.39
My result for gpuinfo are
~/torch/bin/gpuinfo bash: /home/landmarker3/torch/bin/gpuinfo: No such file or directory
Is here the part of my bashrc hope it may also help source ~/torch/install/bin/torch-activate export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:~/torch/install/lib
Hmmm .... ok... puzzling :-P Can we start with EasyCL first please? Since it's failing at a low-level, might as well start with the low-level library, to keep it simple. Dont suppose, can you try the following please? :
git clone --recursive https://github.com/hughperkins/EasyCL.git
cd EasyCL
mkdir build
cd build
ccmake ..
# press 'c', set BUILD_TESTS=ON, Build_type = Debug, 'c' configure, 'g' generate
# (ccmake should exit when you press 'g')
make -j 4 install
./gpuinfo
cp ../test/*.cl .
./easycl_unittests
I have installed here are logs
landmarker3@LANDMARKER3:~/NewEasy.git/build$ make -j 4 install
[ 1%] Built target easycl_gtest
[ 1%] Built target clew_delete_stamp
[ 2%] Creating directories for 'clew-external'
[ 3%] No download step for 'clew-external'
[ 6%] [ 6%] No patch step for 'clew-external'
No update step for 'clew-external'
[ 7%] Performing configure step for 'clew-external'
loading initial cache file /home/landmarker3/NewEasy.git/build/clew/tmp/clew-external-cache.cmake
-- Project source dir = /home/landmarker3/NewEasy.git/thirdparty/clew
-- Project build dir = /home/landmarker3/NewEasy.git/build/clew/src/clew-external-build
-- Configuring done
-- Generating done
-- Build files have been written to: /home/landmarker3/NewEasy.git/build/clew/src/clew-external-build
[ 8%] Performing build step for 'clew-external'
[100%] Built target clew
[ 9%] Performing install step for 'clew-external'
[100%] Built target clew
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/lib/libclew.so.1.0.0
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/lib/libclew.so
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/clew.h
[ 10%] Completed 'clew-external'
[ 10%] Built target clew-external
Linking CXX executable gpuinfo
Linking CXX shared library libEasyCL.so
[ 15%] Built target gpuinfo
CMakeFiles/EasyCL.dir/thirdparty/lua-5.1.5/src/loslib.c.o: In function os_tmpname': /home/landmarker3/NewEasy.git/thirdparty/lua-5.1.5/src/loslib.c:60: warning: the use of
tmpnam' is dangerous, better use `mkstemp'
[ 65%] Built target EasyCL
Linking CXX executable easycl_unittests
[100%] Built target easycl_unittests
Install the project...
-- Install configuration: "Debug"
-- Installing: /home/landmarker3/NewEasy.git/dist/lib/libEasyCL.so
-- Removed runtime path from "/home/landmarker3/NewEasy.git/dist/lib/libEasyCL.so"
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/deprecated.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLArray.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLKernel.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/EasyCL_export.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLFloatWrapperConst.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLFloatWrapper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLIntWrapper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/DevicesInfo.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLArrayFloat.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLKernel_structs.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/DeviceInfo.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/mystdint.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLArrayInt.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLUCharWrapper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/CLWrapper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/platforminfo_helper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/deviceinfo_helper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/EasyCL.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/ICLArray.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/templates/TemplatedKernel.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/templates/LuaTemplater.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/util/easycl_stringhelper.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/include/easycl/util/StatefulTimer.h
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/easycl_activate.sh
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testfloatarray.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testinout.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testeasycl.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/test_scenario_te42kyfo.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testbuildlog.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testStructs.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testlocal.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testdefines.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testintarray.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/bin/testscalars.cl
-- Up-to-date: /home/landmarker3/NewEasy.git/dist/lib/libeasycl_gtest.so
-- Installing: /home/landmarker3/NewEasy.git/dist/bin/easycl_unittests
-- Removed runtime path from "/home/landmarker3/NewEasy.git/dist/bin/easycl_unittests"
-- Installing: /home/landmarker3/NewEasy.git/dist/bin/gpuinfo
-- Removed runtime path from "/home/landmarker3/NewEasy.git/dist/bin/gpuinfo"
Result of ./gpuinfo is ./gpuinfo opencl library not found.
Result of ./easycl_unittests
~/NewEasy.git/build$ ./easycl_unittests args: ./easycl_unittests --gtest_filter=-SLOW Note: Google Test filter = -SLOW [==========] Running 61 tests from 24 test cases. [----------] Global test environment set-up. [----------] 1 test from testscalars [ RUN ] testscalars.test1 opencl library not found
Ok, interesting. So, basically, I'm pretty sure that clew is failing to find libOpenCL.so. Can you try the following please:
ls -lh /usr/lib/x86_64-linux-gnu/libOpenCL.so*
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu ./gpuinfo
ls -lh /usr/lib/x86_64-linux-gnu/libOpenCL.so.* lrwxrwxrwx 1 root root 18 Oct 25 2014 /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0 -rw-r--r-- 1 root root 39K Oct 25 2014 /usr/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu in bashrc done . landmarker3@LANDMARKER3:~/NewEasy.git/build$ source ~/.bashrc landmarker3@LANDMARKER3:~/NewEasy.git/build$ ./gpuinfo opencl library not found.
Hi,
Pleaes dont run bashrc. Please run directly:
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu ./gpuinfo
(all one line)
(Sorry, a bit terse, I was on the train, and just about to disappear into a tunnel :-P)
landmarker3@LANDMARKER3:~/NewEasy.git/build$ LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu ./gpuinfo opencl library not found.
Mmmkay. I'm thinking, I made a docker container containing cltorch the other day. I deleted it, but I've still got the Dockerfile. If you want, I can rebuild this container, test it, and put it on Docker hub?
Advantage is, this handles taking care of all hte dependencies and stuff. You basically just need the CUDA GPU, and the CUDA drivers installed, which seems to be the case already :-)
Yes ,please provide me with that Dockerfile for cltorch which i can run on my system.
Thanks
Hi kunalsekhri, Ok, I started to look at this yesterday. Seems my memory doesnt quite match reality, and whilst I have a docker container with cltorch inside, I cant quite seem to get it to actually run against the GPU yet :-P I will have a dig, and see what I can come up with.
Ok, so I needed to downgrade my drivers back again. On 352.55, I couldnt get it to work. I downgraded back to 346.96, and working again. I have two docker files. The first one installs cltorch, and clnn, based on ubuntu:14.04:
FROM ubuntu:14.04
RUN apt-get -y update && apt-get install -y git gcc g++ wget && wget https://raw.githubusercontent.com/torch/ezinstall/master/install-deps
RUN bash install-deps
RUN git clone https://github.com/torch/distro.git ~/torch --recursive
RUN cd ~/torch && ls
RUN ls ~/torch
RUN cd ~/torch && chmod +x install.sh && bash ./install.sh
RUN . ~/torch/install/bin/torch-activate && luarocks install cltorch
RUN . ~/torch/install/bin/torch-activate && luarocks install clnn
RUN apt-get install -y ocl-icd-libopencl1
CMD bash ~/torch/install/bin/th
The second installs nvidia 346.96 over the top:
FROM hughperkins/cltorch:latest
# RUN wget http://us.download.nvidia.com/XFree86/Linux-x86_64/352.55/NVIDIA-Linux-x86_64-352.55.run
RUN wget http://us.download.nvidia.com/XFree86/Linux-x86_64/346.96/NVIDIA-Linux-x86_64-346.96.run
RUN apt-get install -y clinfo
RUN chmod +x NVIDIA-Linux-x86_64-3*.run
RUN ./NVIDIA-Linux-x86_64-3*.run -s --no-kernel-module
RUN apt-get install -y cmake-curses-gui
RUN cd ~ && mkdir git && cd git && git clone --recursive https://github.com/hughperkins/EasyCL.git
RUN cd ~/git/EasyCL && mkdir build && cd build && cmake -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug .. && make -j 4 install
CMD ~/torch/install/bin/th -l cltorch
(It also installs EasyCL too, so can use gpuinfo if we want).
To run it, you need to:
docker run -it --device /dev/nvidiactl --device /dev/nvidia0 --device /dev/nvidia-uvm hughperkins/cltorch-nvidia:346.96
(Note: there was a bug in the tests recently, https://github.com/hughperkins/cltorch/issues/27 . If you redo docker pull hughperkins/cltorch
, it should pull down the fix for that big.)
(Note that I set up automated builds on hub.docker.com for this, at https://hub.docker.com/r/hughperkins/cltorch-nvidia/ )
Hi kunalsekhri, Qingchao just noticed what the issue is, https://github.com/hughperkins/cltorch/issues/28#issuecomment-151689734 . clew is searching for libOpenCL.so, but you and he have libOpenCL.so.1. I will see if I can tweak clew somehow to fix that.
In the meantime, I reckon you can fix the problem like this:
sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/x86_64-linux-gnu/libOpenCL.so
Fixed in 67f24cf Can you reinstall, and try again please?
Closing this, since fixed I think, right?
I have installed cltorch on system but during test it is failing . Giving error as luajit -l cltorch -e 'cltorch.test()' luajit: Something went wrong: OpenCL library not found at /tmp/luarocks_cltorch-scm-1-1357/cltorch/cltorch/src/init.cpp:225 stack traceback: [C]: at 0x7f71ddffe0a0 [C]: in function 'require' ...landmarker3/torch/install/share/lua/5.1/cltorch/init.lua:19: in main chunk [C]: at 0x0046eba0 [C]: at 0x00405ea0
[edit by hugh: removed the build log]
I have added itorch activate file in the bashrc file also .