Author Topic: Mining LTC on BAMT with cgminer  (Read 13061 times)

Offline debianlinux

  • Full Member
  • ***
  • Posts: 297
  • Freow
Mining LTC on BAMT with cgminer
« on: March 15, 2013, 02:37:21 PM »
All I've read so far is that it cannot be done.

I have news for the unbelievers; it can be done quite easily.

I took an already working configuration for BTC mining. The scope of this thread is not to step you through all the guts of getting BAMT to mine at all but to take you from headlessly autostarting and remote reporting BTC mining to doing the same trick with LTC mining. If you need help with the basics then this thread is a great read on the topic although it is specific to BTC mining.

Step 1: Create a cgminer.conf file. The easiest way is to launch cgminer with your preferred command line strings and then press S then W to write out the settings to a config file named and located by your choice. I put mine in the /opt/miners/cgminer directory named scrypt.conf. Easy peasy. One thing to make sure of is that you include --api-listen in the launch strings or include "api-listen" : true, in the conf file itself. This is necessary for gpumon to play nice and be able to report the relevant information. Otherwise setting up a cgminer conf file for pool failover and the appropriate settings for optimal mining are beyond the scope of this thread.

Step 2: Create a new pools file in /etc/bamt; there is already a file there but I copied it to a new one and modified it for the ltc pools I am using and named it "scryptpools", easy peasy.

Step 3: Create a new bamt.conf file in /etc/bamt; there is already one there so I copied it to btcbamt.conf and another copy to scryptbamt.conf; I'll tell you why in a bit. In your scryptbamt.conf file you need to change the pools pointer to reference the scryptpools file you created above and you need to change the cgminer opts pointer to read --config /opt/miners/cgminer/scrypt.conf (or whatever name and path is appropriate for you). Also, set the engine and memory speeds as you may have set them in your cgminer config file. Now, to switch from mining to BTC to LTC and vice versa all you have to do is copy scryptbamt.conf to bamt.conf or btcbamt.conf to bamt.conf. In this way both configs remain individually intact and the bamt.conf is overwritten as needed. A script can easily be written to do this copying for you so all you do is type a command or click an icon like "mineltcnow" or something; again, beyond the scope of this thread.

Step 4: The big kahuna to making this work. Go to the /etc/profile.d directory. Create a file called something like scryptexports.sh. The contents of this file will be simply 3 separate line that read as follows:

export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100

That is it. Save the file and then give it executable permissions for the login that will be running BAMT. To make this simple do chmod 777 scryptexports.sh. Unless you intend to reboot you can go ahead and execute this script by typing in the full file name with extension. Nothing appears to happen but if you type "env" and hit enter you should see these environment variables as now listed. These environment variables will now be set every time the machine boots.


So, finally, launch gpumon and press "D" to make sure any mining is stopped. Press "q" to exit. Copy /etc/bamt/scryptbamt.conf to /etc/bamt/bamt.conf (remember you made a backup of your BTC version in btcbamt.conf file). Launch gpumon and press "S" to start mining. Lo and behold if your configs were sound you will now be mining LTC on your preferred pool at your configured hash rate. Press "q" to exit gpumon. Point a web browser to your BAMT box from a remote machine and wala, the reporting is as expected here as well, although the graph for the hashrate will probably be miniscule unless you are pushing some serious mh/s with your rig.

HTH
« Last Edit: March 15, 2013, 03:20:50 PM by debianlinux »

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #1 on: April 29, 2013, 07:13:14 PM »
I'd been having lots of problems with various linux distros and someone suggested that I try this.
I am, and it is now working.  Yea!

Anyway, since you are already neck deep in this, perhaps I can bounce some ideas off of you.

1)  Are you using 0.5c?  0.6 beta? 

2)  I am using BAMT bamt_v0.5phillips7900.zip because it came with the 79xx drivers built in.  I have it operating, but it is not running optimally.  I've got it at g2 I13 right now, and the 7950s are producing <300kh/s.  What combination of drivers, sdk and cgminer are you finding most acceptable.

I had assumed that I would eventually take it to ADL_SDK_5.0.zip and AMD 2.8 - but had not started playing.  If you already have selected a good pairing, please let me know, it would save lots of time.
Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb

Offline debianlinux

  • Full Member
  • ***
  • Posts: 297
  • Freow
Re: Mining LTC on BAMT with cgminer
« Reply #2 on: April 29, 2013, 08:57:13 PM »
I'm running 5770s so I do great with stock drivers and sdk. In fact, I had once tried upgrading them and my hash rate fell dramatically so I stuck with stock. I am about to build a 7950 rig and would be most interested to hear what a good mixture of software constituents is as well.

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #3 on: April 29, 2013, 09:21:43 PM »
all right, I'll dig and let you know.
Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #4 on: May 01, 2013, 02:07:30 PM »
Got it up and running on 3 rigs at this point.

I say I have a pretty good install script at this point and will happily share it here.

One thing that you might be able to answer... have you tuned the monitoring scripts at all so that they don't alert on "low mining speed"?  Since litecoin is 1000x slower than bitcoin generation it continually shows that I'm operating in yellow/red states. 

In particular the web interface and mgpumon.
Any ideas?
Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb

Offline debianlinux

  • Full Member
  • ***
  • Posts: 297
  • Freow
Re: Mining LTC on BAMT with cgminer
« Reply #5 on: May 01, 2013, 05:20:07 PM »
Yeah, that stuff can be configured in /etc/bamt/bamt.conf; there are triggers such as monitor_temp_lo and monitor_hash_lo that you can set to your own parameters.
Personally I comment out all but the monitor_temp_hi and monitor_temp_lo. If a card stops hashing guess what the temperature does?

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #6 on: May 01, 2013, 07:14:57 PM »
Yeah, that stuff can be configured in /etc/bamt/bamt.conf; there are triggers such as monitor_temp_lo and monitor_hash_lo that you can set to your own parameters.
Personally I comment out all but the monitor_temp_hi and monitor_temp_lo. If a card stops hashing guess what the temperature does?

Where do you change it?

I have three boxes.  I have them sending to a single box where I'm running mgpumon and it does not appear to change anything.

In any case, here is the script I'm using:

Code: [Select]
#!/bin/bash
########################################################################################
##
#
# Description:
#    Script designed to configure a BAMT 0.5c instance as a LiteCoin Miner using:
#        AMD Catalyst Drivers (AMD_CATALYST_DRIVERS)
#        AMD APP SDK
#        Open CL
#        ADL SDK
#        cgminer
#   
# Version: v1.0 (2013-04-30)
#
# Author: c1010010 (https://forum.litecoin.net/index.php?action=profile;area=summary;u=11759)
#     
# Attribution:
#     Based on the BitcoinTrading.com Update CGMiner for Litecoin script version 1.03
#     Author: maplesyrupghost (http://www.bitcointrading.com/forum/index.php?action=profile;u=1)
#     Link: http://www.bitcointrading.com/forum/linux-distros/bamt-version-0-5-easy-usb-based-mining-linux-with-farm-wide-management-tools/msg2518/#msg2518
#
# Change Log
#    1.0 2013-04-30 Initial Revision
#
##
########################################################################################

###
##
#    Set these variables.
##
###
AMD_CATALYST_DRIVERS_LOC="http://www2.ati.com/drivers/linux/"
AMD_CATALYST_DRIVERS="amd-catalyst-13.4-linux-x86.x86_64"
CGMINER_LOC="http://ck.kolivas.org/apps/cgminer/"
CGMINER_SRC="cgminer-3.1.0"
ADL_SDK_LOC="http://www.files.distrogeeks.com/"
ADL_SDK_SRC="ADL_SDK_5.0"
AMD_APP_SDK_LOC="http://developer.amd.com/wordpress/media/2012/11/"
AMD_APP_SDK_SRC="AMD-APP-SDK-v2.8-lnx32"


###
##
#    Variables set for script, no need to change these if you did the first part correctly.
##
###
AMD_CATALYST_DRIVERS_ZIP="$AMD_CATALYST_DRIVERS.zip"
AMD_CATALYST_DRIVERS_RUN="$AMD_CATALYST_DRIVERS.run"
CGMINER_SRC_TAR="$CGMINER_SRC.tar"
CGMINER_SRC_ZIP="$CGMINER_SRC_TAR.bz2"
ADL_SDK_ZIP="$ADL_SDK_SRC.zip"
AMD_APP_SDK_SRC_ZIP="$AMD_APP_SDK_SRC.tgz"
LTC_SCRIPT="litecoin_starter.sh"
SCRIPTFOLDER="/opt/bamt/"
CGMINER_DIR="/opt/miners/cgminer"
CGMINER_CONF="/root/.cgminer/cgminer.conf"
CGMINER_OPTIONS="--api-listen -c $CGMINER_CONF/cgminer.conf"


###
##
#    Functions for this script...
##
###
wait_for_key ()
{
echo ""
echo "[Press CTRL-C to cancel execution of this script, or press <RETURN> to continue]"; read ANY_KEY
echo ""
}

countdown ()
{
echo -n "3..."; sleep 1
echo -n "2..."; sleep 1
echo -n "1..."; sleep 1
echo "go!"; sleep 1
}


###
##
#    Prime sudo
##
###
clear
echo "This script makes use of the sudo command quite liberally.  You will want to make sure"
echo "you have sudo primed and ready for access so that it does not stop mid-execution to"
echo "ask your permission."
echo " "
echo "It is highly suggested that you CTRL-C this script now and execute the following command"
echo "prior to execution the first time:"
echo '    sudo echo "Testing sudo access"'
echo "Then execute this script again. "
echo " "
wait_for_key
countdown

###
##
#    Display script plan.
##
###
clear
echo 'This script will update your BAMT with the lated drivers and SDK and then'
echo 'configure it for Litecoin mining,'
echo '    To start litecoin mining, type  "ltc"'
echo '    To stop litecoin mining, type "noltc"'
echo '    To resume a screen session, "screen -r"'
echo ""
echo "Note: This script is only to be run with the BAMT v0.5c environment."
echo ""
echo "Version installed with this script:"
echo "    Catalyst Drivers: $AMD_CATALYST_DRIVERS_LOC$AMD_CATALYST_DRIVERS"
echo "    CGMiner: $CGMINER_SRC"
echo "    SDK: $ADL_SDK_SRC"
echo "    APP_SDK: $AMD_APP_SDK_SRC"
echo ""
wait_for_key
countdown

###
##
#    Stop any mining on this BAMT.
##
###
echo "Stopping any mining that is currently taking place."
echo "[Press CTRL-C to cancel execution of this script, or press <RETURN> to continue]"; read ANY_KEY
echo "[Begin]"
/usr/sbin/mine stop
echo "[Done]"
echo ""
sleep 1


###
##
# Removing old installed AMD Catalyst Drivers
##
###
echo "Removing old AMD Catalyst Drivers:"
wait_for_key
echo "[Begin]"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev* xorg-driver-fglrx
echo "[Done]"
echo ""
sleep 1


###
##
# Installing AMD Catalyst Drivers
##
###
echo "Installing AMD Catalyst Drivers: $AMD_CATALYST_DRIVERS"
wait_for_key
echo "[Begin]"
CURRENT_DIR=$PWD
cd /tmp
wget $AMD_CATALYST_DRIVERS_LOC$AMD_CATALYST_DRIVERS_ZIP
unzip $AMD_CATALYST_DRIVERS_ZIP
sudo sh ./$AMD_CATALYST_DRIVERS_RUN --force
cd $CURRENT_DIR
echo "[Done]"
echo ""
sleep 1


###
##
# Installing CGMiner
##
###
echo "Installing CGMiner: $CGMINER_SRC"
wait_for_key
echo "[Begin]"
CURRENT_DIR=$PWD
cd /usr/share
wget $CGMINER_LOC$CGMINER_SRC_ZIP
tar xvfj $CGMINER_SRC_ZIP
cd $CGMINER_SRC/ADL_SDK
echo "    Installing ADL_SDK: $ADL_SDK"
wait_for_key
echo "    [Begin]"
CURRENT_DIR_2=$PWD
wget $ADL_SDK_LOC$ADL_SDK_ZIP
unzip $ADL_SDK_ZIP
cd include
mv adl* ..
echo "    Generating links."
cd /opt
tar xf /opt/AMD-APP-SDK-v2.4-lnx32/icd-registration.tgz
ln -sf /opt/AMD-APP-SDK-v2.4-lnx32/include/CL /usr/include
ln -sf /opt/AMD-APP-SDK-v2.4-lnx32/lib/x86/* /usr/lib/
echo "    Executing ldconfig."
ldconfig
cd $CURRENT_DIR_2
echo "[Done]"

echo "    Installing AMD_APP_SDK: $AMD_APP_SDK_SRC"
wait_for_key
echo "    [Begin]"
CURRENT_DIR_2=$PWD
wget $AMD_APP_SDK_LOC$AMD_APP_SDK_SRC_ZIP
tar -xvzf $AMD_APP_SDK_SRC_ZIP
tar -xvzf AMD-APP-SDK-v2.8-RC-lnx32.tgz
cd AMD-APP-SDK-v2.8-RC-lnx32
cp -pv lib/x86/* /usr/lib/
rsync -avl include/CL/ /usr/include/CL/
cd ..
tar -xvzf icd-registration.tgz
rsync -avl etc/OpenCL/ /etc/OpenCL/
echo "    Executing ldconfig."
ldconfig
cd $CURRENT_DIR_2
echo "    [Done]"

cd /usr/share/$CGMINER_SRC
CFLAGS="-O2 -Wall -march=native -I/opt/AMDAPP/include" LDFLAGS="-L/usr/lib"
./configure --enable-scrypt
echo "Compling: $CGMINER_SRC"
wait_for_key
echo "[Begin]"
make
cd /opt/miners
mkdir cgminer_backup
cd cgminer
echo "Backing up old CGMiner"
cp * ../cgminer_backup/
cd /usr/share/$CGMINER_SRC
cp -r * /opt/miners/cgminer
cd $CURRENT_DIR
echo "[Done]"


#
# Update CGMiner For Litecoin End
#
# Lazy Litecoin Script Start
#

echo "Building scripts to launch litecoin miner: $SCRIPTFOLDER$LTC_SCRIPT"
wait_for_key
echo "[Begin]"
echo '#!/bin/bash' >> $SCRIPTFOLDER$LTC_SCRIPT
echo "cd $CGMINER_DIR" >> $SCRIPTFOLDER$LTC_SCRIPT
echo 'export DISPLAY=:0' >> $SCRIPTFOLDER$LTC_SCRIPT
echo 'export GPU_USE_SYNC_OBJECTS=1' >> $SCRIPTFOLDER$LTC_SCRIPT
echo 'export GPU_MAX_ALLOC_PERCENT=100' >> $SCRIPTFOLDER$LTC_SCRIPT
echo 'echo "Litecoin screen about to start."' >> $SCRIPTFOLDER$LTC_SCRIPT
echo "screen -dmS LTCScreen ./cgminer $CGMINER_OPTIONS" >> $SCRIPTFOLDER$LTC_SCRIPT
echo 'echo "Litecoin screen session started."' >> $SCRIPTFOLDER$LTC_SCRIPT
chmod u+x $SCRIPTFOLDER$LTC_SCRIPT

echo 'Putting aliases to start mining in /root/.bashrc'
# Put our aliases in bashrc...
echo "# Start of lines added by BitcoinTrading.com Lazy Litecoin Script:" >> /root/.bashrc
echo "alias ltc='cd $SCRIPTFOLDER;./$LTC_SCRIPT'" >> /root/.bashrc
echo "alias noltc='killall screen'" >> /root/.bashrc
echo "# End of lines." >> /root/.bashrc

# Putting our aliases into the system right now so you don't need to restart.
alias ltc='cd $SCRIPTFOLDER;./$LTC_SCRIPT'
alias noltc='killall screen'
echo "[Done]"

echo "Finishing up the process."
wait_for_key
echo "[Begin]"
echo 'Synchronizing data on disk with memory.'
sync
# Let's clear the screen.
echo "[Done]"
echo ""
echo '    To start litecoin mining, type  "ltc"'
echo '    To stop litecoin mining, type "noltc"'
echo '    To resume a screen session, "screen -r"'
echo 'This script assumes you have a cgminer.conf if your /root/.cgminer directory.'
wait_for_key

#
# Update CGMiner Litecoin with Lazy Litecoin Script End
#
echo "Checking for the presence of your cards."
wait_for_key
echo "[Begin]"
sudo aticonfig --lsa
sudo aticonfig --adapter=all --initial
echo "[Done]"
echo ""

echo "Preparing to do a coldreboot.  You will need to reboot."
wait_for_key
countdown
coldreboot

Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb

Offline debianlinux

  • Full Member
  • ***
  • Posts: 297
  • Freow
Re: Mining LTC on BAMT with cgminer
« Reply #7 on: May 01, 2013, 07:53:13 PM »
bamt.conf located in /etc/bamt is not a shell script file as it is in the YAML format. In case you removed or badly overwrote the original there is a spare copy located in /opt/bamt/examples/ called bamt.conf.simple. I am seriously doubting the pasted information you provided is from bamt.conf it is more likely a litecoin specific shell script file with a .sh extension.

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #8 on: May 01, 2013, 08:00:37 PM »
bamt.conf located in /etc/bamt is not a shell script file as it is in the YAML format. In case you removed or badly overwrote the original there is a spare copy located in /opt/bamt/examples/ called bamt.conf.simple. I am seriously doubting the pasted information you provided is from bamt.conf it is more likely a litecoin specific shell script file with a .sh extension.

No, it's not from BAMT, I wrote it... well, most of it.  Some of the content came from MapleSyrupGhost.  The reason I wrote it was to automate the installation of the correct drivers, sdk, and cgminer.  The BAMT 0.5c version is not optimized to work with Sapphire 7950s... and this is.

I'm familiar with /etc/bamt/bamt.conf... I'm saying that editing that file produces no results with mgpumon that I can see.  I've edited it on the senders as well as on the receiver side.

Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb

Offline debianlinux

  • Full Member
  • ***
  • Posts: 297
  • Freow
Re: Mining LTC on BAMT with cgminer
« Reply #9 on: May 01, 2013, 08:43:38 PM »
Yeah, okay, I read your script and see what it is doing.

I've never messed with the munin stuff to get multiple miner stats on a single server. I don't have that many miners, lol although I'm about to have 3 instead of 2 so I might be interested in it but currently I just ssh into them as needed which is rarely to never.

Offline debianlinux

  • Full Member
  • ***
  • Posts: 297
  • Freow
Re: Mining LTC on BAMT with cgminer
« Reply #10 on: May 01, 2013, 09:56:51 PM »
Just to be sure, you did add "do_bcast_status: 1" to the bamt.conf file of each individual mining machine, yes? That is required for the miner to broadcast its' gpumon status.

Offline jimmydorry

  • Newbie
  • *
  • Posts: 18
Re: Mining LTC on BAMT with cgminer
« Reply #11 on: May 01, 2013, 11:26:00 PM »
c1010010, did you get your hash rate up? I had the same problem with the 7900 copy of BAMT. Gonna have another go from scratch this time to try and get the >500kh

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #12 on: May 02, 2013, 04:15:50 AM »
c1010010, did you get your hash rate up? I had the same problem with the 7900 copy of BAMT. Gonna have another go from scratch this time to try and get the >500kh

I did.  It took some playing, but I have a good ~570 kh/s rate on the cards.



here is my cgminer.conf.  I may tweak a little more, but it has been 2 days stable with no HW errors.

Code: [Select]
"intensity" : "20,20,20,20",
"vectors" : "1,1,1,1",
"worksize" : "256,256,256,256",
"kernel" : "scrypt,scrypt,scrypt,scrypt",
"lookup-gap" : "0,0,0,0",
"thread-concurrency" : "24768,24768,24768,24768",
"shaders" : "1792,1792,1792,1792",
"gpu-engine" : "0-1100,0-1100,0-1100,0-1100",
"gpu-fan" : "0-85,0-85,0-85,0-85",
"gpu-memclock" : "1250,1250,1250,1250",
"gpu-memdiff" : "0,0,0,0",
"gpu-powertune" : "0,0,0,0",
"gpu-vddc" : "0.000,0.000,0.000,0.000",
"temp-cutoff" : "95,95,95,95",
"temp-overheat" : "85,85,85,85",
"temp-target" : "75,75,75,75",
"api-listen" : true,
"api-port" : "4028",
"auto-fan" : true,
"auto-gpu" : true,
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "1",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "1",
"scrypt" : true,
"temp-hysteresis" : "3",
"shares" : "0",
"kernel-path" : "/usr/local/bin"

I'll let you know if I find another sweet-spot.
Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb

Offline Chuck Finley

  • Sr. Member
  • ****
  • Posts: 612
Re: Mining LTC on BAMT with cgminer
« Reply #13 on: May 02, 2013, 12:24:52 PM »
The reason I didn't go with BAMT is that it looks like support for it died off a long time ago. I do like the multi-rig monitoring setup though.

I would much rather take that and put it on a nice clean working linux distro than to force myself to use something that might not work well down the road (I have seen threads where people complained about issues with 7xxx series using BAMT (even with 0.5c or whatever the version is that is supposed to support 7xxx series cards).

I've already installed munin on my rigs but if anyone knows what scripts/programs BAMT uses to monitor the farm I'd like to know, espcially if someone's got a copy that can be plugged into any linux distro!

LTC: LchuckfK3g2tHrdAv8CDTUSJpZjbBSk66m

Offline c1010010

  • Full Member
  • ***
  • Posts: 200
Re: Mining LTC on BAMT with cgminer
« Reply #14 on: May 02, 2013, 02:35:32 PM »
The reason I didn't go with BAMT is that it looks like support for it died off a long time ago. I do like the multi-rig monitoring setup though.

I would much rather take that and put it on a nice clean working linux distro than to force myself to use something that might not work well down the road (I have seen threads where people complained about issues with 7xxx series using BAMT (even with 0.5c or whatever the version is that is supposed to support 7xxx series cards).

I've already installed munin on my rigs but if anyone knows what scripts/programs BAMT uses to monitor the farm I'd like to know, espcially if someone's got a copy that can be plugged into any linux distro!

Honestly, you could use that script (with a few edits) on any linux distro... just comment out the special BAMT script components at the end.
Tips Greatly Appreciated for Great Advice : [LTC] LhDtXg5smGeDJhfCJhafebBfZUfUHZgVJb