Bitcoin Forum

Bitcoin => Mining support => Topic started by: Syke on January 06, 2011, 06:32:08 AM



Title: Easy Ubuntu python OpenCL mining setup
Post by: Syke on January 06, 2011, 06:32:08 AM
Here's the quick instructions I use when setting up a new box. Nothing fancy, but it works. From a bare box to a mining machine.

1. Install Ubuntu 10.10.
2. Install the proprietary video driver. The regular Nvidia driver in the repo works fine. I have not tested the ATI driver.
3. Install the python stuff. Paste the following commands in a Terminal:
Code:
sudo apt-get install python-pyopencl subversion
wget http://iweb.dl.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.3.19/bitcoin-0.3.19-linux.tar.gz
tar xvf bitcoin-0.3.19-linux.tar.gz
svn checkout http://svn.json-rpc.org/trunk/python-jsonrpc
cd python-jsonrpc/
sudo python setup.py install
cd ..
mkdir .bitcoin
echo "rpcuser=un" > .bitcoin/bitcoin.conf
echo "rpcpassword=pw" >> .bitcoin/bitcoin.conf
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/BitcoinMiner.cl
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/BitcoinMiner.py
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/poclbm.py
~/bitcoin-0.3.19/bin/64/bitcoin -server&
python poclbm.py -d 0 --user un --pass pw

Change the username and password if you are worried about someone connecting to your box.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: em3rgentOrdr on January 12, 2011, 10:14:43 AM
Awesome!  I just did a fresh upgrade from Ubuntu 10.04 to 10.10, and followed your above instructions, and it worked for me, no problems.  Do you have a bitcoin donate address?

I'm getting 28,000 khash/sec on my Nvidia GF9800GX2 GPU using this OpenCL miner in addition to the 2,000 khash/sec on my low-end Core2 Duo CPU.

UPDATE: THAT 28,000 khash/sec was on just one GPU, but the GX2 has two GPUS.  When I also spawn a second process using -d 1, then I get an additional ~26,000 khash/sec for the GPU running my main display (but screen is clunkly, of course).


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: em3rgentOrdr on January 12, 2011, 12:30:47 PM
I modified this Ubuntu python script http://ubuntuforums.org/showthread.php?t=498631 (http://ubuntuforums.org/showthread.php?t=498631) which runs a command when the screensaver is invoked, to instead make it run the OpenCL miner on DEVICE 1 (which is the GPU controlling my video screen) and also modified this script to ensure it kills the OpenCL miner properly when exiting screensaver.  Then I added this script to my startup programs (in addition to the python script to run on DEVICE 0), so that I now have DEVICE 0 startup mining on login and then have DEVICE 1 startup mining when screensaver is invoked.  That's a total of ~56,000 khash/sec when my screen saver is on using both cards of my GF9800GX2!

Quote
#!/usr/bin/python

import os
import time
import subprocess

screensaver_started = 0
running = 0

while 1:
        active = 0
        out = ""

        if screensaver_started == 0:
                # Don't do anything if the screensaver isn't running
                s = os.popen("pidof gnome-screensaver")
                spid = s.read()
                s.close()
                if len(spid) > 0:
                        screensaver_started = 1
        else:
                h = os.popen("gnome-screensaver-command -q", "r")
                out = h.read()
                active = out.find("inactive")
                h.close()

                if active < 0 and running == 0:
                        p = subprocess.Popen(['python', 'poclbm.py', '-d', '1', '--user', 'un', '--pass', 'pw'])
                        running = 1
                elif active > 0 and running == 1:
                        p.kill()
                        running = 0

        time.sleep(5)

Update: I fixed a small bug...what you see above is corrected.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Syke on January 17, 2011, 07:11:00 PM
Glad it worked for you too! Sure, I'll accept donations at 1JpsaZmgqaPTx9pHayPHxNK3uuHqahDZ12.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: em3rgentOrdr on January 17, 2011, 11:47:13 PM
Glad it worked for you too! Sure, I'll accept donations at 1JpsaZmgqaPTx9pHayPHxNK3uuHqahDZ12.

Ok, just sent you 10 bitcoins.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: humble on January 21, 2011, 04:16:57 AM
Has anyone got this running with ATI cards? I'd be curious how it compares to Diablo...


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: The Script on January 22, 2011, 06:03:55 AM
Here's the quick instructions I use when setting up a new box. Nothing fancy, but it works. From a bare box to a mining machine.

1. Install Ubuntu 10.10.
2. Install the proprietary video driver. The regular Nvidia driver in the repo works fine. I have not tested the ATI driver.
3. Install the python stuff. Paste the following commands in a Terminal:
Code:
sudo apt-get install python-pyopencl subversion
wget http://iweb.dl.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.3.19/bitcoin-0.3.19-linux.tar.gz
tar xvf bitcoin-0.3.19-linux.tar.gz
svn checkout http://svn.json-rpc.org/trunk/python-jsonrpc
cd python-jsonrpc/
sudo python setup.py install
cd ..
mkdir .bitcoin
echo "rpcuser=un" > .bitcoin/bitcoin.conf
echo "rpcpassword=pw" >> .bitcoin/bitcoin.conf
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/BitcoinMiner.cl
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/BitcoinMiner.py
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/poclbm.py
~/bitcoin-0.3.19/bin/64/bitcoin -server&
python poclbm.py -d 0 --user un --pass pw

Change the username and password if you are worried about someone connecting to your box.



Hey, I'm a complete newbie but am trying to ramp up my hash/s rate so I can get more shares in Slush's pooled mining venture.  I have a Lenovo SL510 laptop which apparently has the GMA4500 graphics card.  I have Win 7 and Ubuntu dual booted on the machine.  Currently I'm running my miner in Ubuntu and was wondering if this python code is compatible with my graphics card.  Would that be the best way to get a higher hash rate? Any advice?

Oh yeah, currently I'm only getting ~800 khash/s running the miner using my CPUs (dual core, 2.2 GHz).


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Syke on January 22, 2011, 08:41:26 AM
No, sorry. The Intel graphics you have won't work.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Syke on January 22, 2011, 09:55:36 AM
Has anyone got this running with ATI cards? I'd be curious how it compares to Diablo...

The python-pyopencl package depends on the Nvidia drivers, which conflict with the ATI OpenCL drivers. So these instructions will not work on ATI.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: jamesb on February 16, 2011, 12:02:08 PM
Hello

thank you for your great work Syke (alias m0mchil?). I'm trying to make the miner work but it seems that the actual version on the git causes issues http://pastebin.com/QgFCsUHu which isn't my own paste. So I'm not alone with it.

Do you think someone can fix it any time soon. Does the problem come from json-rpc (need to upgrade?) or the your miner ? Thank you in advance.

Edit: I had to modify the port detection method because it found 'w' which isn't valid.
Edit2: I've used the revision 873dcf91516420b8baa92b7a71e2d1558fea370f which works fine, 58 Mhash/s great ! (have some 'Warning: overflow encountered in uint_scalars' though every 10-30 sec)


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: sniper_sniperson on March 24, 2011, 10:58:00 PM
Any ideas how to start the stuff under Ubuntu server on Virtual Box, because without running gui 'fglrxinfo' just responds:

Quote
Error: unable to open display (null)

 :-\

I think there might be a problem loading the ati driver since there is no gui service running in server mode...


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: carbonpenguin on April 05, 2011, 07:00:57 PM
I'm a totally command-line illiterate ubuntu user, so I just copy/pasted the above into the command line, and it seemed to install. Now what do I do?


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: qed on April 06, 2011, 07:10:51 PM
Confirmed not working on ATI card on Ubuntu even if the OpenCL example programs are running.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Jossie90 on April 07, 2011, 05:49:29 PM
I can unconfirm that. I've got a notebook here with Ubuntu 10.10 (Maverick) with an ATI Firepro.

To get it working I got
(a) the official ubuntu fglrx driver
(b) the ATI Stream SDK
(c) pyopencl from here http://pypi.python.org/pypi/pyopencl/2011.1beta3 , along with the required dependencies
I compiled pyopencl and it works just fine (around 58Mh/s).


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: singpolyma on April 12, 2011, 02:45:10 PM
I can unconfirm that. I've got a notebook here with Ubuntu 10.10 (Maverick) with an ATI Firepro.

To get it working I got
(a) the official ubuntu fglrx driver
(b) the ATI Stream SDK
(c) pyopencl from here http://pypi.python.org/pypi/pyopencl/2011.1beta3 , along with the required dependencies
I compiled pyopencl and it works just fine (around 58Mh/s).

Is it possible to make this work with ATI Radeon HD 2600 XT ?  I think I installed it right, but it only lists my CPU as an option for OpenCL device.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: dust on April 12, 2011, 03:04:06 PM
Is it possible to make this work with ATI Radeon HD 2600 XT ?  I think I installed it right, but it only lists my CPU as an option for OpenCL device.

Only ATI 4xxx series and up are supported.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: blap on April 13, 2011, 07:12:40 PM
I can unconfirm that. I've got a notebook here with Ubuntu 10.10 (Maverick) with an ATI Firepro.

To get it working I got
(a) the official ubuntu fglrx driver
(b) the ATI Stream SDK
(c) pyopencl from here http://pypi.python.org/pypi/pyopencl/2011.1beta3 , along with the required dependencies
I compiled pyopencl and it works just fine (around 58Mh/s).

I do all, but when I run poclbm.py, I got: "ImportError: No module named sha256"

With: ubuntu 10.10 and ATI Mobility Radeon HD 5650

What I can do?


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Dusty on April 15, 2011, 09:01:43 AM
I do all, but when I run poclbm.py, I got: "ImportError: No module named sha256"

With: ubuntu 10.10 and ATI Mobility Radeon HD 5650

What I can do?

I've the exact same problem, I also installed the package python-pycryptopp that should contain that package but I get the same import error.

Anybody care to help?

thanks!


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: blap on April 15, 2011, 06:40:36 PM
I do all, but when I run poclbm.py, I got: "ImportError: No module named sha256"

With: ubuntu 10.10 and ATI Mobility Radeon HD 5650

What I can do?

I've the exact same problem, I also installed the package python-pycryptopp that should contain that package but I get the same import error.

Anybody care to help?

thanks!

try to get sha256.py.
Code:
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/sha256.py
=)


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: blap on April 15, 2011, 06:44:09 PM
I do all, but when I run poclbm.py, I got: "ImportError: No module named sha256"

With: ubuntu 10.10 and ATI Mobility Radeon HD 5650

What I can do?

I've the exact same problem, I also installed the package python-pycryptopp that should contain that package but I get the same import error.

Anybody care to help?

thanks!

try to get sha256.py.
Code:
wget --no-check-certificate https://github.com/m0mchil/poclbm/raw/master/sha256.py
=)

now I got:
Code:
Traceback (most recent call last):
  File "poclbm.py", line 3, in <module>
    import pyopencl as cl
  File "/usr/lib/pymodules/python2.6/pyopencl/__init__.py", line 3, in <module>
    import pyopencl._cl as _cl
ImportError: libOpenCL.so.1: cannot open shared object file: No such file or directory

I found this topic: http://bitcointalk.org/index.php?topic=3359.0;all
but I do not kown what to do next...
=(


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Dusty on April 16, 2011, 12:15:55 AM
Thank brunopio!
Your hint solved my problem.

While for yours:
Code:
Traceback (most recent call last):
  File "poclbm.py", line 3, in <module>
    import pyopencl as cl
  File "/usr/lib/pymodules/python2.6/pyopencl/__init__.py", line 3, in <module>
    import pyopencl._cl as _cl
ImportError: libOpenCL.so.1: cannot open shared object file: No such file or directory

I found this topic: http://bitcointalk.org/index.php?topic=3359.0;all
but I do not kown what to do next...
=(

Try with:
apt-get install python-pyopencl


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Pander on April 18, 2011, 01:27:45 PM
in /opt/ati-stream-.../lib/ do
Code:
sudo ln -s libOpenCL.so libOpenCL.so.1


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: JWU42 on April 23, 2011, 11:42:07 PM
Bruno's issue is that the LD_LIBRARY_PATH isn't in .bashr

Code:
export LD_LIBRARY_PATH=/opt/ati-stream-sdk-v2.1-lnx64/lib/x86_64/:$LD_LIBRARY_PATH

This assumes your are following Raulo's guide and using 2.1 and are on x86_64


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: TheShoura on May 05, 2011, 08:40:50 AM
How do I change the PW's after running the script


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: DELTA9 on May 15, 2011, 05:42:34 PM
trying to mine on my HP laptop...xubuntu 32bit, nvidia 8400m gs

Quote
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/thevjm/BitcoinMiner.py", line 272, in miningThread
    self.loadKernel()
  File "/home/thevjm/BitcoinMiner.py", line 355, in loadKernel
    self.context = cl.Context([self.device], None, None)
RuntimeError: Context failed: out of host memory

seems to be having trouble communicating with bitcoin RPC, can anyone help?


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: floe on May 25, 2011, 04:51:17 PM
Just cloned the git repo on my Ubuntu 11.04 machine and started the miner without any issues at all.
Thanks for such a smooth piece of software  :D
Currently reporting ~ 6.3 Mhash/s on my Geforce 8600 GT, very impressive.

One additional question: do the hashes generated by poclbm show up in the "hashespersec" statistic shown by "bitcoind getinfo"? Seems like they don't...

Florian


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Shin on May 25, 2011, 05:34:58 PM
Hi,
I just got through these steps to bitcoin mining on a NVidia GF9400 and I get just 2350khash/sec. That's not so impressive against my low end Core2Duo with 1680khash/sec.

Is my card not so good?

Cheers...


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: ethereal on May 26, 2011, 05:47:55 PM
Aha, got it. Thanks!

Currently mining at ~20,000 khash/s on a AMD 550v; my CPU usage is negligable.

- ethereal


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: deuxmill on May 27, 2011, 11:36:40 PM
Hello guys i managed to get it working ... i'm currently trying to conect to bitcoin.cz could anyone please tell me the command to do so.

Thank you


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: AngelusWebDesign on May 31, 2011, 10:55:52 PM
Glad it worked for you too! Sure, I'll accept donations at 1JpsaZmgqaPTx9pHayPHxNK3uuHqahDZ12.

Ok, just sent you 10 bitcoins.

This is quaint to read -- I see it came from January of this year.
Today you'd never see someone give 10 BTC, no matter how grateful they were :)
That would be $90 at today's prices.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: T4b on June 03, 2011, 06:15:56 PM
Hello guys i managed to get it working ... i'm currently trying to conect to bitcoin.cz could anyone please tell me the command to do so.

Thank you
python poclbm.py -d 0 --user USER --pass PASSWORD --host=mining.bitcoin.cz --port=8332

This miner uses about 50% cpu although it is supposed to be a gpu miner. What could be the cause of this? I guess this isn't the normal behaviour?


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: CristianCantoro on June 04, 2011, 06:28:20 PM
Hi everybody,

I have tried to rum poclbm on Ubuntu 11.04 my graphics card is Nvidia is the following (output of lshw)
product: C67 [GeForce 7000M / nForce 610M]

If I run poclbm I get:

$ ./poclbm.py
Traceback (most recent call last):
  File "./poclbm.py", line 27, in <module>
    platforms = cl.get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: invalid/unknown error code

I have read previous links but that did not help. I have nvdia drivers installed and also CUDA installed.
Thanks in advance.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: T4b on June 07, 2011, 03:30:50 PM
When I run the last command, I receive
Traceback (most recent call last):
  File "poclbm.py", line 3, in <module>
    import pyopencl as cl
  File "/usr/lib/pymodules/python2.7/pyopencl/__init__.py", line 3, in <module>
    import pyopencl._cl as _cl
ImportError: libboost_python-py27.so.1.42.0: cannot open shared object file: No such file or directory


Libboost_python 1.42 has been installed, so I do not know what the issue is.
Then it's maybe in the wrong place, if it's actually installed?

This miner uses about 50% cpu although it is supposed to be a gpu miner. What could be the cause of this? I guess this isn't the normal behaviour?


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: EJW on June 08, 2011, 06:40:21 PM
Quote

now I got:
Code:
Traceback (most recent call last):
  File "poclbm.py", line 3, in <module>
    import pyopencl as cl
  File "/usr/lib/pymodules/python2.6/pyopencl/__init__.py", line 3, in <module>
    import pyopencl._cl as _cl
ImportError: libOpenCL.so.1: cannot open shared object file: No such file or directory

I found this topic: http://bitcointalk.org/index.php?topic=3359.0;all
but I do not kown what to do next...
=(


Yo, first post...I too have this problem trying to get mining up and running.
I'm using an NVIDEA graphics card, so I think the problem is that I'm running a 32-bit machine and the script is assuming is 64-bit. Thing is I'm fairly new to both Ubuntu and Python so I've no idea what to do! Any help would be greatly appreciated.


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: floe on June 10, 2011, 09:43:01 AM
$ ./poclbm.py
Traceback (most recent call last):
  File "./poclbm.py", line 27, in <module>
    platforms = cl.get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: invalid/unknown error code

When you have this problem, you should check /etc/OpenCL/vendors/amdocl32.icd - this file should exist and contain the string "libamdocl32.so"
(for a 64-bit system, replace 32 with 64).

Floe


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Friar on June 12, 2011, 01:10:42 AM
I've gone through this installation process, but I seem to be spending most of the time downloading blocks.

Also, is there somewhere that defines what the command line arguments are? Can I use my GPU and both CPU cores?  How can I look in my wallet?


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: ThiagoCMC on June 26, 2011, 02:50:59 PM
Guys,

 I would like to update this thing a bit, look:

 
Quote
Do not use Ubuntu 11.04 with NVidia cards! The poclbm.py/python process will consume all of your CPU for nothing. This behavior does not exist in Ubuntu 10.10.

 
Quote
The poclbm in Ubuntu 10.10 does not consume 100% of CPU, but Xorg does if you try to use the mining machine as a daily Desktop...  :-\

 New procedure:

Code:
cd ~

sudo add-apt-repository ppa:stretch/bitcoin
sudo apt-get update
sudo apt-get install python-pyopencl subversion git-core bitcoin

svn checkout http://svn.json-rpc.org/trunk/python-jsonrpc
cd ~/python-jsonrpc/
sudo python setup.py install
cd ~

mkdir ~/.bitcoin
echo "rpcuser=user" > .bitcoin/bitcoin.conf
echo "rpcpassword=password" >> .bitcoin/bitcoin.conf

bitcoin -server &

git clone https://github.com/m0mchil/poclbm.git
cd ~/poclbm
python poclbm.py -d 0 --user user --pass password

 You can change the command:

Code:
bitcoin -server &

 to:

Code:
bitcoind -daemon

 ...if you do not want the GUI interface of Bitcoin client.

 Advantages of this approach:

 1- To upgrade Bitcoin client, just run:

Code:
sudo apt-get update
sudo apt-get upgrade

 2- To upgrade poclbm, just run:

Code:
cd ~/poclbm
git pull

 3- To upgrade python-jsonrpc, run:

Code:
cd ~/python-jsonrpc/
svn up
# If there is a new version:
sudo python setup.py install
cd ~

 That's it!

Cheers!
Thiago


Title: Re: Easy Ubuntu python OpenCL mining setup
Post by: Zenitur on July 30, 2011, 08:01:45 AM
http://svn.json-rpc.org/trunk/python-jsonrpc - Error 404.

P.S. Ubuntu sucks.