## CUDA without IEEE 754 binary128

emerge nvidia-cuda-sdk-9.0.176出现如下错误

/usr/include/bits/floatn.h(61): error: invalid argument to attribute "__mode__"
/usr/include/bits/floatn.h(73): error: identifier "__float128" is undefined

--- a/usr/include/bits/floatn.h 2017-09-13 16:00:37.079654880 +0200
+++ b/usr/include/bits/floatn.h 2017-09-13 16:00:00.999104815 +0200
@@ -28,7 +28,8 @@
support, for x86_64 and x86.  */
#if (defined __x86_64__                            \
? __GNUC_PREREQ (4, 3)                        \
-     : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4)))
+     : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \
+  &&  !defined(__CUDACC__)
# define __HAVE_FLOAT128 1
#else
# define __HAVE_FLOAT128 0

## Let's get started...

I installed NVIDIA drivers via this method: https://www.reddit.com/r/EtherMining/comments/6ip97k/ubuntu_1604_no_cuda_devices_detected_on_gtx_1070/dj859ss/

Now we make nvidia generate an xorg.conf file that we'll need later:

nvidia-xconfig --allow-empty-initial-configuration --enable-all-gpus --cool-bits=28 --separate-x-screens

So now we have NVIDIA installed and our conf file made, now what? Gotta have the server set some stuff up on boot for me so I don't have to do it by hand every time.

sudo nano /etc/rc.local

In here I have:

# Enable persistence mode so the driver doesn't get unloaded

sudo nvidia-smi -pm ENABLED

# Power limit the card so it's not ramping up to full speed, I've benchmarked and found that FOR MY CARD, 110W does not impact performance.

sudo nvidia-smi -pl 110

# Start the X server, nvidia-settings are retarded and require it to be running.

X :0 &
sleep 5
export DISPLAY=:0
sleep 3

sudo nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=75" -a "[gpu:0]/GPUGraphicsClockOffset[3]=-200" -a "[gpu:0]/GPUMemoryTransferRateOffset[3]=1200"

exit 0

Please for the love of god, google the nvidia settings and see what each does and if it applies to you. GPUFanControlState so I can control the fan speed. GPUTargetFanSpeed so I can lock it at a certain speed (75%). GPUGraphicsClockOffset so I can underclock the GPU. GPUMemoryTransferRateOffset to OC my memory by 1200Mhz (9200Mhz total).

Cool, so now every time I boot my server, these settings are applied. Lazy++

But what to do about the miner?

I got you covered. In crontab -e I have:

* * * * * bash /mnt/scratch/Scripts/mining/watchdog.sh > /tmp/watchdog.log 2>&1

It's a simple script...

#! /bin/bash

if pgrep "ethminer" >/dev/null 2>&1; then
else
if nvidia-smi -q | grep "75 %" >/dev/null 2>&1; then
byobu new -d -s mining "YOUR COMMAND TO START YOUR MINER GOES HERE"
else
echo "Fans are down! Fuck!"
fi
fi

Now, I can log into the server via SSH and pull up byobu to check on the mining process directly! If it crashes (which it never has), the watchdog will restart it. If the server is rebooted for whatever reason, it will automatically apply my settings at boot and the miner will run when the watchdog script detects things are right.

Obviously there are things I could still do here. Have it notify me when it starts the miner, have it parse the json from whattomine and switch to ETC for me if it's significantly higher. All kinds of stuff I can do with this in the future.

Hopefully this saves someone some frustration of getting this stuff to work. If you feel generous and want to tip, go here https://www.reddit.com/r/EtherMining/wiki/index and tip the mods or whoever runs this place (it's at the bottom of their guide which most of you will never read).

Edit: Removed GPUPowerMizerMode as there's no reason to run it in performance mode instead of adaptive. It had literally zero effect on mining speed and only prevents the card from idling properly if not mining.

Also, someone linked a github guide very close to what I wrote up, so look at that as well if you don't like mine.