Difference between pages "Switching gcc" and "Litecoin Mining for Funtoo"

(Difference between pages)
(Changing Default gcc)
 
m (What are Funtoo Litecoin Funds Used For?)
 
Line 1: Line 1:
 +
Litecoin mining is a fun and easy way that you can help support the Funtoo Linux project. Litecoin is a virtual cryptographic currency that is generated using CPUs and video card GPU computational power, and can be converted into a traditional currency like US dollars.
  
== How to switch the gcc version for a specific task ==
+
== How does Litecoin Relate to Funtoo? ==
  
This article describes how you can switch the [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version.
+
Part of Funtoo is having fun, and part of having fun is being creative, and exploring new ideas and concepts, and not being limited by the expectations of others. These concepts include technology, but also include new community concepts and approaches for supporting a community. Distributed support via CPU and GPU power is certainly a novel way of supporting an open source project, and because of this it is a perfect fit for Funtoo. In many ways, the resource challenges faced by open source projects are more complex than the technical challenges, and deserve to be taken seriously. By exploring the use of Litecoin, we are exploring an innovative way to fund the project.
Let's assume, you want to use gcc-4.4.5, but your main [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version is 4.6:
+
 
 +
=== What are Funtoo Litecoin Funds Used For? ===
 +
 
 +
These funds will be used to support Funtoo's operating budget, covering hosting and server equipment expenses and other expenses such as hardware purchases for supporting ongoing development for various developers.
 +
 
 +
== Litecoin Pools ==
 +
 
 +
 
 +
Typically, Litecoins are mined by pools of computers, and funtoo is part of the following pooled litecoin mining efforts:
 +
 
 +
{| style="background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1"
 +
! pool
 +
! host
 +
! port
 +
! user
 +
! password
 +
! stats
 +
! review
 +
|-
 +
| Coinotron
 +
| <tt>stratum+tcp://coinotron.com:3334</tt>
 +
| <tt>3334</tt>
 +
| <tt>funtoo.public</tt>
 +
| <tt>p</tt>
 +
|
 +
| We've found this pool to be very efficient.
 +
|-
 +
| Burnside's Litecoin Mining Pool
 +
| <tt>ltc.kattare.com</tt>
 +
| <tt>9332</tt>
 +
| <tt>funtoo.public</tt>
 +
| <tt>p</tt>
 +
| [http://ltc.kattare.com/stats.php stats]
 +
| very good PPNLS pool
 +
|-
 +
| OzCoin
 +
| <tt>newlc.ozco.in</tt>
 +
| <tt>9332</tt>
 +
| <tt>funtoo.public</tt>
 +
| <tt>p</tt>
 +
| [https://lc.ozcoin.net/content/overview ozcoin overview]
 +
| very good PPS pool
 +
|}
 +
 
 +
There are lots of different ways to mine Litecoins. You can use any of our pools above. You can also use your CPU or your graphics card. To see what different types of hardware can do, see the [https://github.com/litecoin-project/litecoin/wiki/Mining-hardware-comparison Litecoin Mining Hardware Comparison] page. Note that many of these systems are overclocked so make note of the CPU and memory frequencies listed here.
 +
 
 +
== "Got Litecoins Already" Method ==
 +
 
 +
If you already have Litecoins that you want to donate to Funtoo Linux, you can send them to <tt>LgtcMbY5JYTQAGzdfJ9U83CPhspNkbJzym</tt>. Thanks!
 +
 
 +
Here's how to do it with litecoind:
  
 
<console>
 
<console>
# ##i##gcc --version
+
# ##i##litecoind sendtoaddress LgtcMbY5JYTQAGzdfJ9U83CPhspNkbJzym 50
gcc (Gentoo 4.6.2-r1 p1.4, pie-0.5.0) 4.6.2
+
Copyright (C) 2011 Free Software Foundation, Inc.
+
This is free software; see the source for copying conditions.  There is NO
+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
 
</console>
 
</console>
  
So - what to do? The best and safest way is to switch your [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version temporarily to the same version that is used by the upstream project.
+
Be sure to let Daniel know that you sent some coin so that you can receive proper respect :)
  
To do that, we use the tool gcc-config. First, we'll have a look on what versions are available on your system. Install the desired version of [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] explicitly:
+
== CPU Mining ==
 +
 
 +
Here's how to get started and convert your idle CPU power into a contribution to the Funtoo Linux project.
 +
 
 +
The "miner" is the program that performs the computation to generate litecoins. It receives blocks from a server, which it performs computations on. Miners are designed to run continually in the background, where they use up idle CPU only, and will not impact the speed of your system. A significant contribution to Funtoo Linux is only realized when miners are run continually for days and weeks -- so running a miner for an hour or so is typically not effective.
 +
 
 +
=== Installation using Portage ===
 +
 
 +
This method will use CFLAGS from /etc/portage/make.conf. Note that <tt>-O2</tt> seems to work much better than <tt>-O3</tt>.
  
 
<console>
 
<console>
# ##i##emerge =sys-devel/gcc-4.4.5*
+
# ##i##emerge pooler-cpuminer
 
</console>
 
</console>
  
After emerging, you can see that it is installed with <tt>gcc-config</tt>:
+
=== Set up go.sh ===
 +
 
 +
Create the following <tt>go.sh</tt> script to start the miner:
 +
 
 +
<pre>
 +
#!/bin/bash
 +
threads=$(grep -c "^processor" /proc/cpuinfo)
 +
while true;
 +
do
 +
  minerd --algo scrypt -s 45 --retry-pause 5 --threads $threads --url http://ltc.kattare.com:9332 --userpass funtoo.public:p
 +
done
 +
</pre>
 +
 
 +
Make it executable:
  
 
<console>
 
<console>
# ##i##gcc-config --list-profiles
+
# ##i##chmod +x go.sh
[1] x86_64-pc-linux-gnu-4.4.5
+
[2] x86_64-pc-linux-gnu-4.6.2 *
+
#
+
 
</console>
 
</console>
  
This list shows the versions of gcc that are now installed. The new compiler is now available and can be called as <tt>gcc-4.4.5</tt>. But the default system compiler (what you get when you call <tt>gcc</tt>) is set to 4.6.2. Like with other Funtoo tools, the asterisk marks the currently active version of gcc.  
+
=== Run go.sh ===
  
If possible, it is best to modify Makefiles and change the <tt>CC</tt> variable to force any required sources to use <tt>gcc-4.4.5</tt> instead of <tt>gcc</tt> to build. This is a non-invasive change that will be local to your current project, which is the preferred way to make these types of build changes. This is the mechanism we use for building Enterprise kernels that build cleanly with earlier versions of gcc.
+
Run <tt>go.sh</tt> to start the miner.  
  
== Changing Default gcc ==
+
<console>
 +
# ##i##./go.sh
 +
</console>
  
Again, this is not recommended as it will affect the default <tt>gcc</tt> version that the entire system will use. Use this with caution. It is also not supported to run Funtoo Linux with a non-standard system compiler, sicne we are not testing it.
+
The cpuminer will only use idle CPU and will not slow down your system. Modern systems will generate somewhere from 15 to 60 KHash/sec total, which will result in $10 to Funtoo Linux per month for a Core i7 system at current exchange rates, when run continually.
  
Before you switch your [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version, it is very important that you make a note about what version was the active one before, so you can easily switch it back to the profiles default after you're done.
+
Keep those miners running and thanks for supporting Funtoo Linux!
  
To switch the version to 4.4.5, we make use of gcc-config again. You can define the version you want to switch to either by giving the number printed before the listed version in the output of <code>gcc-config --list-profiles</code> or by entering the whole string. So, giving <code>1</code> or <code>x86_64-pc-linux-gnu-4.4.5</code> to gcc-config leads to the same result:
+
== GPU Mining ==
  
<console>
 
# ##i##gcc-config 1
 
* Switching native-compiler to x86_64-pc-linux-gnu-4.4.5 ...
 
>>> Regenerating /etc/ld.so.cache...                                                                            [ ok ]
 
  
* If you intend to use the gcc from the new profile in an already
+
'''cgminer stopped supporting GPU/Scrypt mining in 3.8 series'''. 3.7.2 version is stable and recommended for gpu mining.
* running shell, please remember to do:
+
  
*  # source /etc/profile
 
#>
 
</console>
 
  
Like it's already suggested in the output from above, the next and last step is to refresh your environment to make use of this switch. You may either issue the following two commands or open another login shell for this. No matter what you do, you should verify that the active [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version is the one you wanted to switch to:
+
Some of the more hardcore individuals in the Funtoo community may want to use their graphics processor to mine litecoins. Modern graphics cards, particularly AMD (ATI) cards, can offer hashrates well above 100Khash/sec, even above 400Khash/sec for some cards. Daniel Robbins has a few Radeon HD 6950's that can generate in excess of 400Khash/sec ''each''.
  
<console>
+
AMD (ATI) cards tend to work much better than NVIDIA for litecoin mining. Here's how to do GPU mining:
# ##i##gcc --version
+
gcc (Gentoo 4.6.2-r1 p1.4, pie-0.5.0) 4.6.2
+
Copyright (C) 2011 Free Software Foundation, Inc.
+
This is free software; see the source for copying conditions.  There is NO
+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
  
# ##i##source /etc/profile
+
=== Prerequisites ===
# ##i##env-update
+
>>> Regenerating /etc/ld.so.cache...
+
# ##i##gcc --version
+
gcc (Gentoo 4.4.5 p1.3, pie-0.4.5) 4.4.5
+
Copyright (C) 2010 Free Software Foundation, Inc.
+
This is free software; see the source for copying conditions.  There is NO
+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
  
#
+
First, X will need to be installed, and you will need to ensure all your video cards are defined in <tt>/etc/X11/xorg.conf</tt>. For AMD cards, ati-drivers 13.1 appears to work well. Ensure that full hardware acceleration is working and that <tt>ati</tt> OpenGL and <tt>amd</tt> OpenCL are selected via <tt>eselect</tt>. (This is probably how things are set up if you simply emerged ati-drivers.)
 +
 
 +
=== Install cgminer ===
 +
 
 +
First, enable the <tt>scrypt</tt> USE variable (important!). Now, emerge cgminer:
 +
 
 +
<console>
 +
# ##i##USE="scrypt" emerge =net-misc/cgminer-3.7.2
 
</console>
 
</console>
  
As you see here, the current shell is using [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version 4.4.5 only after you have refreshed your environment. Now you can build your packages / source which need this specific version of [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc].
+
=== Create cgminer script ===
 +
 
 +
Create a <tt>go.sh</tt> script that looks like this:
 +
 
 +
<pre>
 +
#!/bin/bash
 +
export GPU_MAX_ALLOC_PERCENT=100
 +
export GPU_USE_SYNC_OBJECTS=1
 +
export DISPLAY=:0
 +
cgminer \
 +
-o http://newlc.ozco.in:9332/ -u funtoo.public -p p \
 +
-o http://ltc.kattare.com:9332/ -u funtoo.public -p p \
 +
--intensity 17 \
 +
--scrypt \
 +
--shaders 1536 --thread-concurrency 8000 -g 1 --worksize 256 \
 +
--auto-fan --temp-target 80
 +
</pre>
 +
 
 +
This script will start cgminer to connect to newlc.ozco.in, but will automatically fall back to the kattare pool if ozco.in is down. Intensity ranges from 1-20, with higher settings generally offering better hashrates. But if you get too close to 20, you will notice a slow down in interactive performance when using the X server. ssh performance will be unaffected.
 +
 
 +
Be sure to properly set the number of shaders on your card -- 1536 is for an unlocked Radeon HD 6950. Consult [https://github.com/ckolivas/cgminer/blob/master/SCRYPT-README SCRYPT-README] (look for the <tt>--shaders</tt> description) to view the correct shaders to use for your card.
 +
 
 +
=== Start Mining ===
 +
 
 +
Now make it executable, '''make sure X is running''', and start mining:
 +
 
 +
<console>
 +
# ##i##chmod +x go.sh
 +
# ##i##./go.sh
 +
</console>
  
It is important that you reset the [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] version back to the default of your profile. To do that, simply reply the above steps again but this time, use your profile's default version of [http://en.wikipedia.org/wiki/GNU_Compiler_Collection gcc] to switch to.
+
There are other cool things you can do with cgminer, such as overclocking your video card and ramping up the intensity to at or near 20 to dramatically increase hashrates. Happy mining, and if you are mining for Funtoo, thanks :)

Revision as of 04:12, 28 November 2013

Litecoin mining is a fun and easy way that you can help support the Funtoo Linux project. Litecoin is a virtual cryptographic currency that is generated using CPUs and video card GPU computational power, and can be converted into a traditional currency like US dollars.

How does Litecoin Relate to Funtoo?

Part of Funtoo is having fun, and part of having fun is being creative, and exploring new ideas and concepts, and not being limited by the expectations of others. These concepts include technology, but also include new community concepts and approaches for supporting a community. Distributed support via CPU and GPU power is certainly a novel way of supporting an open source project, and because of this it is a perfect fit for Funtoo. In many ways, the resource challenges faced by open source projects are more complex than the technical challenges, and deserve to be taken seriously. By exploring the use of Litecoin, we are exploring an innovative way to fund the project.

What are Funtoo Litecoin Funds Used For?

These funds will be used to support Funtoo's operating budget, covering hosting and server equipment expenses and other expenses such as hardware purchases for supporting ongoing development for various developers.

Litecoin Pools

Typically, Litecoins are mined by pools of computers, and funtoo is part of the following pooled litecoin mining efforts:

pool host port user password stats review
Coinotron stratum+tcp://coinotron.com:3334 3334 funtoo.public p We've found this pool to be very efficient.
Burnside's Litecoin Mining Pool ltc.kattare.com 9332 funtoo.public p stats very good PPNLS pool
OzCoin newlc.ozco.in 9332 funtoo.public p ozcoin overview very good PPS pool

There are lots of different ways to mine Litecoins. You can use any of our pools above. You can also use your CPU or your graphics card. To see what different types of hardware can do, see the Litecoin Mining Hardware Comparison page. Note that many of these systems are overclocked so make note of the CPU and memory frequencies listed here.

"Got Litecoins Already" Method

If you already have Litecoins that you want to donate to Funtoo Linux, you can send them to LgtcMbY5JYTQAGzdfJ9U83CPhspNkbJzym. Thanks!

Here's how to do it with litecoind:

# litecoind sendtoaddress LgtcMbY5JYTQAGzdfJ9U83CPhspNkbJzym 50 

Be sure to let Daniel know that you sent some coin so that you can receive proper respect :)

CPU Mining

Here's how to get started and convert your idle CPU power into a contribution to the Funtoo Linux project.

The "miner" is the program that performs the computation to generate litecoins. It receives blocks from a server, which it performs computations on. Miners are designed to run continually in the background, where they use up idle CPU only, and will not impact the speed of your system. A significant contribution to Funtoo Linux is only realized when miners are run continually for days and weeks -- so running a miner for an hour or so is typically not effective.

Installation using Portage

This method will use CFLAGS from /etc/portage/make.conf. Note that -O2 seems to work much better than -O3.

# emerge pooler-cpuminer

Set up go.sh

Create the following go.sh script to start the miner:

#!/bin/bash
threads=$(grep -c "^processor" /proc/cpuinfo)
while true;
do
  minerd --algo scrypt -s 45 --retry-pause 5 --threads $threads --url http://ltc.kattare.com:9332 --userpass funtoo.public:p
done

Make it executable:

# chmod +x go.sh

Run go.sh

Run go.sh to start the miner.

# ./go.sh

The cpuminer will only use idle CPU and will not slow down your system. Modern systems will generate somewhere from 15 to 60 KHash/sec total, which will result in $10 to Funtoo Linux per month for a Core i7 system at current exchange rates, when run continually.

Keep those miners running and thanks for supporting Funtoo Linux!

GPU Mining

cgminer stopped supporting GPU/Scrypt mining in 3.8 series. 3.7.2 version is stable and recommended for gpu mining.


Some of the more hardcore individuals in the Funtoo community may want to use their graphics processor to mine litecoins. Modern graphics cards, particularly AMD (ATI) cards, can offer hashrates well above 100Khash/sec, even above 400Khash/sec for some cards. Daniel Robbins has a few Radeon HD 6950's that can generate in excess of 400Khash/sec each.

AMD (ATI) cards tend to work much better than NVIDIA for litecoin mining. Here's how to do GPU mining:

Prerequisites

First, X will need to be installed, and you will need to ensure all your video cards are defined in /etc/X11/xorg.conf. For AMD cards, ati-drivers 13.1 appears to work well. Ensure that full hardware acceleration is working and that ati OpenGL and amd OpenCL are selected via eselect. (This is probably how things are set up if you simply emerged ati-drivers.)

Install cgminer

First, enable the scrypt USE variable (important!). Now, emerge cgminer:

# USE="scrypt" emerge =net-misc/cgminer-3.7.2

Create cgminer script

Create a go.sh script that looks like this:

#!/bin/bash
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
export DISPLAY=:0
cgminer \
-o http://newlc.ozco.in:9332/ -u funtoo.public -p p \
-o http://ltc.kattare.com:9332/ -u funtoo.public -p p \
--intensity 17 \
--scrypt \
--shaders 1536 --thread-concurrency 8000 -g 1 --worksize 256 \
--auto-fan --temp-target 80 

This script will start cgminer to connect to newlc.ozco.in, but will automatically fall back to the kattare pool if ozco.in is down. Intensity ranges from 1-20, with higher settings generally offering better hashrates. But if you get too close to 20, you will notice a slow down in interactive performance when using the X server. ssh performance will be unaffected.

Be sure to properly set the number of shaders on your card -- 1536 is for an unlocked Radeon HD 6950. Consult SCRYPT-README (look for the --shaders description) to view the correct shaders to use for your card.

Start Mining

Now make it executable, make sure X is running, and start mining:

# chmod +x go.sh
# ./go.sh

There are other cool things you can do with cgminer, such as overclocking your video card and ramping up the intensity to at or near 20 to dramatically increase hashrates. Happy mining, and if you are mining for Funtoo, thanks :)