Tuesday 4 November 2014

X11 Crypto Currency Mining with sgminer on an AMD GPU

I've recently been looking at crypto currency mining and thought I'd give it a go.

I'm using an AMD GPU (R9 270x) and running the x11 mod version of sgminer 4.1.0

You can download the version I am using here:
http://ul.to/be0z5bnt

I am using the pool at http://www.simplemulti.com/

stratum+tcp://ca.simplemulti.com:3453

This is an X11 profit switching pool. This means that your client will mine a selection of coins  (at the moment URO, CANN, START, DRK) as it will always get you to mine the one with the lowest difficulty rating (ie. the easiest and quickest).

You can get it to pay out for each coin mined separately or get them to convert them all into the coin of your choice simply by adding your coin payment addresses on the config screen:

http://www.simplemulti.com/configuration_guide

With the Powercolor R9 270x I am getting on average 2.2-2.4 MH/s which from reading on forums is pretty good for this card (the card is at a steady 62% c and the fan is reasably quiet). Previously I started using an R7 250 which was getting a pitiful 500 KH/s :)

Currently when converted into my coin of choice it ends up being worth about £0.15 per day (at current prices). Not a great deal of money, but the computer is always on anyway and the increased power consumption won't be that much. That also doesn't take into account the fact that the value of the coins could rise significantly in future (or drop but what the hell :) )

Shown below is the contents of my sgminer.conf file:


{
"pools" : [
{
"url" : "stratum+tcp://ca.simplemulti.com:3453",
"user" : "username",
"pass" : "password"
}
]
,
"api-mcast-port" : "4028",
"api-port" : "4028",
"api-listen" : true,
"worksize" : "256",
"no-submit-stale" : true,
"kernel" : "x11mod",
"lookup-gap" : "2",
"thread-concurrency" : "26496",
"shaders" : "1280",
"gpu-threads" : "2",
"gpu-engine" : "1120-1120",
"gpu-fan" : "0-0",
"gpu-memclock" : "1400",
"gpu-memdiff" : "0",
"gpu-powertune" : "20",
"gpu-vddc" : "1.2",
"gpu-dyninterval" : "7",
"gpu-platform" : "1",
"temp-cutoff" : "95",
"temp-overheat" : "85",
"temp-target" : "75",
"expiry" : "10",
"failover-switch-delay" : "60",
"log" : "5",
"no-pool-disable" : true,
"queue" : "0",
"scan-time" : "5",
"tcp-keepalive" : "30",
"temp-hysteresis" : "3",
"shares" : "0",
"kernel-path" : "/usr/local/bin"

}


The batch file I use the launch the miner is set up as follows:

del x11mod*.bin
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_USE_SYNC_OBJECTS 1
sgminer.exe -I 15 -o stratum+tcp://ca.simplemulti.com:3453 -u username -p password
PAUSE


Tuesday 25 June 2013

HP MicroServer N54L




Just bought one of these tiny servers at work and am really impressed with it!

I have listed below the components I have put into the server:

16Gb (2 x 8Gb) 1333MHz DDR3 Non-ECC CL9 DIMM Memory (Kingston KVR13N9K2/16)

HP P410/256MB RAID Controller

4 x WD Red 1TB 3.5" SATA (In RAID 5) 2.7Gb usable

1 x StarTech.com 5.25in Trayless Hot Swap Mobile Rack for 3.5in Hard Drive

re purposed the 250Gb hard disk that was supplied with the server in a trayless hot swap rack that fits in the 5.25" optical drive bay. This is the boot disk for the server.

The existing cable that connects the back plate on the drive bays in the server can be disconnected from the internal RAID controller and connected to the HP P410.


I have installed ESXi 5.1 onto the boot disk and will be running 2 virtual servers on it (both Centos 6 web servers).

The processor is about the same spec as a few G5 ML115 servers I have been hosting the same sites on so it should be fine.  

The plus side is that this server is now fully hardware RAID5 and takes up a fraction of the space/power that the older servers did.

I can see me getting more of these servers set up at work and have been looking into having one at home as an offsite backup for work (loaded with larger hard disks though).


Thursday 25 April 2013

Speeding up Imagemagick convert by using it in conjunction with Ghostscript


Using the script below resulted in the Imagemagick convert taking 7.5 seconds, compared with the 2 pronged approach taking just over 0.5 seconds


#!/bin/bash


echo "---------------------------------------------------------"
echo "Use ImageMagick to convert PDF to 450x307 jpg"
echo "---------------------------------------------------------"

TT="$(date +%s%N)"

convert -resize 450x307 test.pdf test_resized.jpg

T="$(($(date +%s%N)-TT))"

# Seconds
S="$((T/1000000000))"

# Milliseconds
M="$((T/1000000))"

printf "Run time: %02d:%02d:%02d:%02d.%03d\n" "$((S/86400))" "$((S/3600%24))" "$((S/60%60))" "$((S%60))" "${M}"

echo "---------------------------------------------------------"
echo "Use Ghostscript to convert PDF to 450x307 jpg"
echo "---------------------------------------------------------"

TT="$(date +%s%N)"
gs -sDEVICE=jpeg -dNumRenderingThreads=4 -dNOGC -o test.jpg -dJPEGQ=95 test.pdf 2>&1
convert -resize 450x307 test.jpg test_resized.jpg
T="$(($(date +%s%N)-TT))"
# SecondsS="$((T/1000000000))"

# Milliseconds
M="$((T/1000000))"

printf "Run time: %02d:%02d:%02d:%02d.%03d\n" "$((S/86400))" "$((S/3600%24))" "$((S/60%60))" "$((S%60))" "${M}"
echo "---------------------------------------------------------"

Wednesday 10 April 2013

Upgrade Ghostscript and Imagemagick on a Centos server


The following script can be used to remove a previous instance of Ghostscript and Imagemagick from a Centos based server and re-install the current versions.


A manual upgrade is required as the Centos repo does not currently have Ghostscript v9 (which is required to use the inkcov device example here).

#!/bin/bash
yum remove imagemagick -y
yum remove ghostscript -y

cd /tmp


wget http://downloads.ghostscript.com/public/ghostscript-9.07.tar.gz
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz


tar xf ghostscript-9.07.tar.gz
tar xf ImageMagick.tar.gz


cd /tmp/ghostscript-9.07
autoconf
./configure
make
make install

cd /tmp/ImageMagick
autoconf
./configure --enable-shared \
           --with-modules \
           --with-perl \
           --with-x \
           --with-threads \
           --with-magick_plus_plus \
           --with-gslib \
           --with-wmf \
           --with-lcms \
           --with-rsvg \
           --with-xml \
           --without-dps
make
sudo make install
sudo ldconfig /usr/local/lib




cd /
rm -Rf /tmp/ghostscript-9.07
rm -Rf /tmp/ImageMagick

echo "Done!"










Counting the number of colour pages in a PDF with Ghostscript

Using Centos and Ghostscript (9.05 and above):

I am developing a print on demand solution at work and came up against an issue where I wanted to to be able to inspect a PDF file and work out where the colour pages appeared (if at all).

I am using Centos 5 as the production servers but this solution should work on any Linux system running Ghostscript 9.05 or above.

Ghostscript 9.05 is required as you need access to the inkcov device to be able to work out the ink coverage for each of the CMYK plates.

Now I had to make the assumption that if C=M=Y that the page had 4 colour grey/black on it rather than it being a colour image.  This may not be a 100% foolproof method but it was the only way I could think of determining if the page was colour or greyscale.

Anyway, here is the script I came with:


gs -o - -sDEVICE=inkcov test.pdf  | grep -v "^ 0.00000  0.00000  0.00000" | awk '{if($1~/Page/){lastpage=$2;} if($1!~/Page/ && $1~/0./ && ($1!=$2 && $1!=3) && $1!=0.00000){ print lastpage}}'

Basically the command queries the PDF and ignores the lines returned where CMY are 0.

AWK is then used to ignore the lines that are irrelevant and print only the page number for the pages which were determined to be colour.