Skip to content

Instantly share code, notes, and snippets.

@OkayDave
Created February 1, 2014 20:10
Show Gist options
  • Save OkayDave/8758028 to your computer and use it in GitHub Desktop.
Save OkayDave/8758028 to your computer and use it in GitHub Desktop.
Cudaminer temperature control
#!/usr/bin/env python
import subprocess
import time
def get_temp():
output = subprocess.check_output(" nvidia-smi | grep Default | cut -d' ' -f5", shell=True)
temp = float(output.strip().decode("utf-8")[0:-1])
print("tmp: " + str(temp))
return temp
def start_miner():
print("starting miner")
return subprocess.Popen(cmd, shell=True)
def stop_miner():
return True
cmd = "cudaminer -H 2 -i 1 -o stratum+tcp://fast-pool.com:9999 -u saucyk.test -p test"
isRunning = False
process = None;
while True:
if isRunning:
if (get_temp() > 90):
process.terminate()
isRunning = False
else:
if (get_temp() < 70):
process = start_miner()
isRunning = True
time.sleep(15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment