hughperkins / cltorch

An OpenCL backend for torch.
Other
289 stars 26 forks source link

8608 segmentation fault #29

Closed yoosan closed 8 years ago

yoosan commented 8 years ago

Here I will post a issue. I run the code char-rnn and then I got a error: [1] 8608 segmentation fault th train.lua -opencl 1 I have installed package cltorch and clnn. It works when I test torch.rand(2,3):cl() . I don't know where makes error.

hughperkins commented 8 years ago

Hmmm... not much to go on there. Can you do the following please:

uname -a
cat /etc/lsb-release
clinfo
path = {}

function path.join(a,b)
  return a .. '/' .. b
end

function path.exists(a)
  print('exists', a)
  return true
end
#!/bin/bash

gdb $1 -ex "catch throw" -ex "run $2 $3 $4 $5 $6 $7 $8 $9"

Run as before, but put ./rungdb.sh in front of luajit train.lua. When it crashes, type:

bt

... and provide the output

yoosan commented 8 years ago

Thanks!! I run this code on my iMac(OS X Yosemite 10.10). So i haven't the file /etc/lsb-release. Since I don't have knowledge of OpenCL and more experience of torch. Is there any package I haven't installed? I mean, does the library OpenCL exists in my Mac? I will read code carefully.

hughperkins commented 8 years ago

Hi, after googling a bit, for 'mac os x opencl', looks like:

However, I think the easiest might be to install EasyCL, and try that. Can you do the following please? :

git clone --recursive https://github.com/hughperkins/EasyCL.git
cd EasyCL
mkdir build
cd build
ccmake ..
# press 'c' for configure
# set BUILD_TESTS to 'ON', 
# change BUILD_TYPE to 'Debug' 
# press 'c' for configure, then 'g' for generate
# => ccmake should exit back to commandline, then do:
make -j 4
cp ../test/*.cl .
./gpuinfo
./easycl_unittests

and provide the output of the last two commands, and also of any build errors.

yoosan commented 8 years ago

OK, some results as follows:

This is another report. th> cltorch.getDeviceProperties(1) { deviceType : "GPU" localMemSizeKB : 16 globalMemSizeMB : 384 deviceVersion : "OpenCL 1.0 " platformVendor : "Apple" deviceName : "Radeon HD 4850" maxComputeUnits : 10 globalMemCachelineSizeKB : 0 openClCVersion : "OpenCL C 1.0 " maxClockFrequency : 503 maxMemAllocSizeMB : 128 maxWorkGroupSize : 1024 }

EasyCL also works, when i run ./gpuinfo then i get num platforms: 1

platform index: 0: platform id: 0x7fff0000 platform vendor: Apple platform name: Apple platform num devices: 2

device index: 0 device id: 0xffffffff device type: 2 global memory size: 16384MB local memory size: 32KB global cache size: 0KB global cacheline size: 8388608 max memory alloc size: 4096MB max compute units: 4 max workgroup size: 1024 max workitem dimensions: 3 max workitem sizes: 1024 1 1 device name: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz opencl c version: OpenCL C 1.2 opencl device version: OpenCL 1.2 frequency MHz: 2660

device index: 1 device id: 0x1021a00 device type: 4 global memory size: 384MB local memory size: 16KB global cache size: 0KB global cacheline size: 0 max memory alloc size: 128MB max compute units: 10 max workgroup size: 1024 max workitem dimensions: 3 max workitem sizes: 1024 1024 1024 device name: Radeon HD 4850 opencl c version: OpenCL C 1.0 opencl device version: OpenCL 1.0 frequency MHz: 503

hughperkins commented 8 years ago

Ah. Unfortunately, cltorch needs a GPU that supports OpenCL 1.1.

yoosan commented 8 years ago

Awesome! I will find some way to change my OpenCL version. sigh... I will post here If I get a good result. Thank you, hughperkins!