How can I compile the OpenCL module for Pyrit?

5,033

Solution 1

This is the way I've finaly done it on Ubuntu Server 11.04

Install a minimal X11 environment:

aptitude install xserver-xorg xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-video-ati lightdm unity-greeter openbox

Then, edit /etc/lightdm/lightdm.conf and add the following (replacing YOUR_USER_NAME with the user you will be running hashcat as):

[SeatDefaults]
greeter-session=unity-greeter
user-session=openbox
autologin-user=YOUR_USER_NAME
autologin-user-timeout=0

Then add your username to the nopasswdlogin group:

usermod -a -G nopasswdlogin $USERNAME

Get build dependencies for Catalyst:

aptitude build-dep fglrx

Download and install Catalyst 12.8:

wget http://www2.ati.com/drivers/linux/amd-driver-installer-12-8-x86.x86_64.zip
unzip amd-driver-installer-12-8-x86.x86_64.zip
sh amd-driver-installer-8.982-x86.x86_64.run --uninstall=force
sh amd-driver-installer-8.982-x86.x86_64.run

Generate a new xorg.conf:

rm -f /etc/X11/xorg.conf*
amdconfig --adapter=all --initial

Make sure the DISPLAY env var is set:

echo 'export DISPLAY=:0' >>~/.bashrc

Reboot, and you should be all set.

Solution 2

I never used Pyrit or tried to compile, however it seems like its config script (setup.py) cannot find OpenCL header files. You should look something like paths that are necessary to configure in such script. OpenCL headers for your ATI VGA will probably be installed in some subfoler of a driver installation.

EDIT:

Here is a part of this script, that sets the OpenCL.h path. Find this file on your PC, and experiment a little, which is chosen, and try to change it and see if that works.

OPENCL_INC_DIRS = []
OPENCL_LIB_DIRS = []
EXTRA_LINK_ARGS = []
LIBRARIES = ['crypto', 'z']
if sys.platform == 'darwin':
    # Use the built-in framework on MacOS
    EXTRA_LINK_ARGS.extend(('-framework', 'OpenCL'))
    OPENCL_INC_DIRS.append('/System/Library/Frameworks/OpenCL.framework/Headers')
else:
    LIBRARIES.append('OpenCL')
    try:
        if os.path.exists(os.environ['ATISTREAMSDKROOT']):
            OPENCL_INC_DIRS.append(os.path.join(os.environ['ATISTREAMSDKROOT'], 'include'))
            for path in ('lib/x86_64','lib/x86'):
                if os.path.exists(os.path.join(os.environ['ATISTREAMSDKROOT'], path)):
                    OPENCL_LIB_DIRS.append(os.path.join(os.environ['ATISTREAMSDKROOT'], path))
                    break
    except:
        pass
    for path in ('/usr/local/opencl/OpenCL/common/inc', \
                '/opt/opencl/OpenCL/common/inc', \
                '/usr/local/opencl/include', \
                '/usr/local/cuda/include'):
        if os.path.exists(path):
            OPENCL_INC_DIRS.append(path)
            break
    else:
        print >>sys.stderr, "The headers required to build the OpenCL-kernel " \
                            "were not found. Trying to continue anyway..."

# Get exact version-string from svn
try:
    svn_info = subprocess.Popen(('svn', 'info'), \
                                stdout=subprocess.PIPE).stdout.read()
    VERSION += ' (svn r%i)' % \
                int(re.compile('Revision: ([0-9]*)').findall(svn_info)[0])
except:
    pass
Share:
5,033

Related videos on Youtube

01BTC10
Author by

01BTC10

Updated on September 18, 2022

Comments

  • 01BTC10
    01BTC10 over 1 year

    I want to use my GPU with Pyrit. I use Ubuntu 11.10, ATI Radeon HD 68xx and i7 2600K.

    Step done:

    • Install latest ATI driver from manufacturer website
    • Install AMD APP SDK

    When I run benchmark I get:

    ~$ pyrit benchmark
    Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
    This code is distributed under the GNU General Public License v3+
    
    Running benchmark (5037.4 PMKs/s)... - 
    
    Computed 5037.45 PMKs/s total.
    #1: 'CPU-Core (SSE2)': 667.8 PMKs/s (RTT 3.2)
    #2: 'CPU-Core (SSE2)': 661.6 PMKs/s (RTT 3.2)
    #3: 'CPU-Core (SSE2)': 664.0 PMKs/s (RTT 3.2)
    #4: 'CPU-Core (SSE2)': 660.5 PMKs/s (RTT 3.2)
    #5: 'CPU-Core (SSE2)': 669.7 PMKs/s (RTT 3.2)
    #6: 'CPU-Core (SSE2)': 656.3 PMKs/s (RTT 3.2)
    #7: 'CPU-Core (SSE2)': 667.4 PMKs/s (RTT 3.2)
    #8: 'CPU-Core (SSE2)': 662.6 PMKs/s (RTT 3.1)
    
    • How to make sure that AMD APP SDK is correctly installed?

    • How to configure Pyrit to use OpenCL and my GPU?

    EDIT:

    Uninstalled Pyrit and re-installed AMD APP SDK. When trying to compile OpenCL support module for Pyrit I get this error:

    $ sudo python setup.py build 
    The headers required to build the OpenCL-kernel were not found. Trying to continue anyway...
    svn: '.' is not a working copy
    running build
    running build_ext
    Building modules...
    building 'cpyrit._cpyrit_opencl' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c _cpyrit_opencl.c -o build/temp.linux-x86_64-2.7/_cpyrit_opencl.o -DVERSION="0.3.0"
    _cpyrit_opencl.c:23:19: fatal error: CL/cl.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
  • RobotHumans
    RobotHumans about 10 years
    The opencl headers are provided by the opencl-headers package and placed in a sane and findable location.