dwaaan / pyrit

Automatically exported from code.google.com/p/pyrit
0 stars 0 forks source link

Opencl fails to build #217

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I get the following error when i try to build the cpyrit-opencl module:
http://pastie.org/1344314
I have the amdstream package with the opencl headers.

Original issue reported on code.google.com by niclas.k...@gmail.com on 3 Dec 2010 at 4:18

GoogleCodeExporter commented 8 years ago
Did you get the correct arch of package? Also, what operating system? Ubuntu?

Original comment by james0p0...@googlemail.com on 4 Dec 2010 at 9:03

GoogleCodeExporter commented 8 years ago
The correct arch of package? Im using Archlinux. Maybe im pointing to the wrong 
$PATH?
How can i cant the correct path?

Original comment by niclas.k...@gmail.com on 4 Dec 2010 at 11:12

GoogleCodeExporter commented 8 years ago
Sorry, I got confused, make sure you download the ATI stream sdk package and 
extract it somewhere. Then run "export ATISTREAMSDKROOT=<location where sdk is 
extracted>" in my case that was /home/james/building/ati-stream-sdk-v2.2-lnx32. 
run that straight before the build command.

Original comment by james0p0...@googlemail.com on 4 Dec 2010 at 2:22

GoogleCodeExporter commented 8 years ago
I did exactly that. Yet i get the same error: 

[niclas@handgranat cpyrit-opencl-0.3.0]$ python2 setup.py build
svn: '.' is not a working copy
running build
running build_ext
Building modules...
building 'cpyrit._cpyrit_opencl' extension
gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe 
-DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fPIC -I/usr/include/CL 
-I/usr/include/python2.7 -c _cpyrit_opencl.c -o 
build/temp.linux-x86_64-2.7/_cpyrit_opencl.o -DVERSION="0.3.0"
gcc -pthread -shared -Wl,--hash-style=gnu -Wl,--as-needed 
build/temp.linux-x86_64-2.7/_cpyrit_opencl.o -L/usr/lib -lssl -lOpenCL -lz 
-lpython2.7 -o build/lib.linux-x86_64-2.7/cpyrit/_cpyrit_opencl.so
/usr/bin/ld: cannot find -lOpenCL
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Original comment by niclas.k...@gmail.com on 4 Dec 2010 at 6:52

GoogleCodeExporter commented 8 years ago
hmmm. It seems to be looking for an libOpenCL.so which it can't find...

Maybe this:

Set the library path LD_LIBRARY_PATH.
– For 32-bit systems:
export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86:$LD_LIBRARY_PATH
– For 64-bit systems:
export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH

Original comment by james0p0...@googlemail.com on 4 Dec 2010 at 7:32

GoogleCodeExporter commented 8 years ago
i got the libOpenCL.so in /opt/amdstream/lib/x86_64/ but that command didnt 
seem to work or change anything. I still have the same issue. I'm modifying the 
setup.py file to fit my system.

ive changed this part:

OPENCL_INC_DIRS = []
for path in ('/opt/amdstream/include/CL', \
            '/opt/amdstream/bin/x86_64', \
            '/opt/amdstream/lib/x86_64'):
    if os.path.exists(path):
        OPENCL_INC_DIRS.append(path)
        break

Original comment by niclas.k...@gmail.com on 4 Dec 2010 at 7:41

GoogleCodeExporter commented 8 years ago
Ok, that needs to be fixed then. Looks like someone else had that problem as 
well:

"I had problems with the build and ld reporting it couldn't find the OpenCL 
library:
/usr/bin/ld: cannot find -lOpenCL
collect2: ld returned 1 exit status
A quick workaround was to create a symblink of libOpenCL.so to /lib64:
sudo ln -s /home/ivc/ati-stream-sdk/lib/x86_64/libOpenCL.so /lib64/"

Ref: http://beta.ivancover.com/wiki/index.php/Pyrit_setup

Original comment by james0p0...@googlemail.com on 5 Dec 2010 at 12:43

GoogleCodeExporter commented 8 years ago
Great! Seems to have worked properly! 

[niclas@handgranat cpyrit-opencl-0.3.0]$ python2 setup.py build
svn: '.' is not a working copy
running build
running build_ext
Building modules...
building 'cpyrit._cpyrit_opencl' extension
gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe 
-DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fPIC 
-I/opt/amdstream/include/CL -I/usr/include/python2.7 -c _cpyrit_opencl.c -o 
build/temp.linux-x86_64-2.7/_cpyrit_opencl.o -DVERSION="0.3.0"
gcc -pthread -shared -Wl,--hash-style=gnu -Wl,--as-needed 
build/temp.linux-x86_64-2.7/_cpyrit_opencl.o -L/usr/lib -lssl -lOpenCL -lz 
-lpython2.7 -o build/lib.linux-x86_64-2.7/cpyrit/_cpyrit_opencl.so
[niclas@handgranat cpyrit-opencl-0.3.0]$ sudo python2 setup.py install
svn: '.' is not a working copy
running install
running build
running build_ext
Building modules...
running install_lib
copying build/lib.linux-x86_64-2.7/cpyrit/_cpyrit_opencl.so -> 
/usr/lib/python2.7/site-packages/cpyrit
running install_egg_info
Writing /usr/lib/python2.7/site-packages/cpyrit_opencl-0.3.0-py2.7.egg-info

Nothing new appears in list. I tried to run "python -c 'from cpyrit import 
_cpyrit_opencl'"

But that gave me:
[niclas@handgranat ~]$ python2 -c 'from cpyrit import _cpyrit_opencl'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib/python2.7/site-packages/cpyrit/_cpyrit_opencl.so: 
undefined symbol: SHA1_Update

Meaning that the installation wasnt that proper afterall - Yet no errors where 
reported during build/install. Now how does this compute? Im gonna try with the 
svn version also. 

Original comment by niclas.k...@gmail.com on 5 Dec 2010 at 1:58

GoogleCodeExporter commented 8 years ago
UPDATE: Alright one opencl-device is working! Though it removed one of my CPU 
cores also i have two GPU's only one is showing up. 

[niclas@handgranat ~]$ pyrit list_cores
Pyrit 0.4.0-dev (svn r288) (C) 2008-2010 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+

The following cores seem available...
#1:  'OpenCL-Device 'ATI RV770''
#2:  'CPU-Core (SSE2)'
#3:  'CPU-Core (SSE2)'
#4:  'CPU-Core (SSE2)'
#5:  'Network-Clients'

Original comment by niclas.k...@gmail.com on 5 Dec 2010 at 2:12

GoogleCodeExporter commented 8 years ago
closed

Original comment by lukas.l...@gmail.com on 5 Dec 2010 at 1:20