Bitcoin Forum
April 20, 2024, 03:51:51 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: pyADL - Python AMD ADL Wrapper  (Read 5589 times)
netxshare (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100


View Profile
May 16, 2011, 05:18:28 AM
 #1

I slapped this together last night I needed a easy way to access ADL from python so I could configure things remotely.
Now all this is a wrapper for AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ ) all I have done is turned it into a python extended library, all ADL code is by Thorsten Gilling.

I am not sure if anyone will find a use for it but it is something I wanted. It works on Windows and Linux. I would like to put it in with a miner next.


ADL SDK - http://developer.amd.com/Downloads/ADL_SDK_3.0.zip

Put the ADL SDK in ./ADL_SDK

Functions

pyADL.SetupADL(DeviceIndex) - This sets the GPU you wish to use.
pyADL.getTemp() - Returns the GPU Temp.
pyADL.getFanSpeed() - Returns the fan speed percent.
pyADL.getFanRPM() - Returns the fan RPMs.
pyADL.getCoreClockSpeed() - Returns Current Core Clock Speed.
pyADL.getMemoryClockSpeed() - Returns Current Memory Clock Speed.
pyADL.getVoltage() - Returns Current Voltage.

pyADL.setFanSpeed(Precent) - Sets The Fan Speed.
pyADL.setCoreClockSpeed(Level,Speed) - Sets Core Clock Speed. Level(0,1,2)
pyADL.setMemoryClockSpeed(Level,Speed) - Sets Memory Clock Speed. Level(0,1,2)
pyADL.setVoltage(Level, Voltage) - Sets Voltage. Level(0,1,2)
 

Example

 

import pyADL

pyADL.SetupADL(0)
print pyADL.getTemp()
print pyADL.getFanSpeed()
print pyADL.getFanRPM()
print pyADL.getCoreClockSpeed()
print pyADL.getMemoryClockSpeed()
print pyADL.getVoltage()
pyADL.setFanSpeed(75)
pyADL.SetupADL(5) # Switch to Second GPU on 6990
print pyADL.getTemp()


http://www.bitshift.io/pyADL/
https://github.com/bitshiftio/pyADL

donations: 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
1713585111
Hero Member
*
Offline Offline

Posts: 1713585111

View Profile Personal Message (Offline)

Ignore
1713585111
Reply with quote  #2

1713585111
Report to moderator
1713585111
Hero Member
*
Offline Offline

Posts: 1713585111

View Profile Personal Message (Offline)

Ignore
1713585111
Reply with quote  #2

1713585111
Report to moderator
1713585111
Hero Member
*
Offline Offline

Posts: 1713585111

View Profile Personal Message (Offline)

Ignore
1713585111
Reply with quote  #2

1713585111
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713585111
Hero Member
*
Offline Offline

Posts: 1713585111

View Profile Personal Message (Offline)

Ignore
1713585111
Reply with quote  #2

1713585111
Report to moderator
1713585111
Hero Member
*
Offline Offline

Posts: 1713585111

View Profile Personal Message (Offline)

Ignore
1713585111
Reply with quote  #2

1713585111
Report to moderator
1713585111
Hero Member
*
Offline Offline

Posts: 1713585111

View Profile Personal Message (Offline)

Ignore
1713585111
Reply with quote  #2

1713585111
Report to moderator
jedi95
Full Member
***
Offline Offline

Activity: 219
Merit: 120


View Profile
May 16, 2011, 06:55:00 AM
 #2

This could be very useful if implemented into a kernel for Phoenix. Especially when combined with MMP which supports sending meta to the server. That would allow for some interesting remote monitoring capabilities. Right now I have to run another script alongside the miners to update the temps.

Phoenix Miner developer

Donations appreciated at:
1PHoenix9j9J3M6v3VQYWeXrHPPjf7y3rU
phelix
Legendary
*
Offline Offline

Activity: 1708
Merit: 1019



View Profile
May 17, 2011, 11:59:52 PM
 #3

that is cool. I will try it tomorrow. The big GUIs to overclock start making me sick.

how do the levels work? is there some kind of automatic switching?
fpgaminer
Hero Member
*****
Offline Offline

Activity: 560
Merit: 517



View Profile WWW
May 18, 2011, 02:09:53 AM
 #4

I am very interested in this! Haven't had the time to play with it yet, but I appreciate your work! *HIGH FIVE*

bolapara
Member
**
Offline Offline

Activity: 78
Merit: 10


View Profile
May 18, 2011, 02:59:48 AM
 #5

I was contemplating writing this exact thing.  Thank you.  Will check it out.
Cryptoman
Hero Member
*****
Offline Offline

Activity: 726
Merit: 500



View Profile
May 18, 2011, 05:31:15 AM
 #6

Now all this is a wrapper for AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ ) all I have done is turned it into a python extended library, all ADL code is by Thorsten Gilling.

I'm a bit confused.  Do I still need AMDOverdriveCtrl compiled and running on my system in order to use pyADL?  I've been unable to get AMDOverdriveCtrl to compile because of wxWidgets.

"A small body of determined spirits fired by an unquenchable faith in their mission can alter the course of history." --Gandhi
Cryptoman
Hero Member
*****
Offline Offline

Activity: 726
Merit: 500



View Profile
May 18, 2011, 05:08:47 PM
 #7

OK, I answered my own question.  You don't need to compile the AMDOverdriveCtrl GUI first.  However, the author seems to have only partially changed the extension name from ADL to pyADL.  You still need to refer to it as ADL, viz:

Code:
import ADL

ADL.SetupADL(0)
print ADL.getTemp()
print ADL.getCoreClockSpeed()
print ADL.getMemoryClockSpeed()
ADL.setMemoryClockSpeed(0,300)
ADL.setMemoryClockSpeed(1,300)
ADL.setMemoryClockSpeed(2,300)

I'm not sure what the levels refer to, but it would probably be clear if I read the SDK notes.  At any rate, it appears that level 2 is the one that is engaged on the GPUs while mining under full load.

"A small body of determined spirits fired by an unquenchable faith in their mission can alter the course of history." --Gandhi
gat3way
Sr. Member
****
Offline Offline

Activity: 256
Merit: 250


View Profile
May 18, 2011, 05:40:46 PM
 #8

Welcome to the hell of properly mapping ADL adapters to OpenCL devices Smiley

The scenario with unsupported by OCL onboard adapters is easy to manage...but you have lots of other peculiarities there. E.g some 5970s are reported as a single adapter (2 devices in OpenCL)....some as 4 adapters with different ids (still 2 devices in OpenCL). The good thing is that I haven't seen yet a case where we have different ordering of devices...that would really be a problem.

I've asked the AMD OpenCL guys if it's possible to create an extension that exports temperature/fan speed data to OpenCL...never got any reply.
teknohog
Sr. Member
****
Offline Offline

Activity: 519
Merit: 252


555


View Profile WWW
May 18, 2011, 05:48:21 PM
 #9

Thanks, this looks nice Smiley

I was thinking of doing something similar the other day, but I noticed that AMDOverdriveCtrl can also run on the command line (with a proper DISPLAY= variable in the environment).

The only problem was that in this mode, it can only load one default setting, so it takes some scripting to set multiple cards. In my case, the card indices are 0 and 3, so my config files are default-0.ovdr and default-3.ovdr. Each is symlinked to default.ovdr in turn, for running the overdrive command.

Code:
CMD=AMDOverdriveCtrl
DIR=~/.AMDOverdriveCtrl
LINK=default.ovdr

cd $DIR

export DISPLAY=:0

INDICES="`ls default-*.ovdr | sed -e 's/default-\([0-9]\+\).ovdr/\1/'`"

for i in $INDICES; do
    rm $LINK
    ln -s default-$i.ovdr $LINK
    $CMD -i $i -a -b
done

world famous math art | masternodes are bad, mmmkay?
Every sha(sha(sha(sha()))), every ho-o-o-old, still shines
phelix
Legendary
*
Offline Offline

Activity: 1708
Merit: 1019



View Profile
May 19, 2011, 07:56:43 AM
 #10

ok, I got it to work. the installation was a royal pain. it's cool but there still are some problems.

it's crashing badly (randomly?) every couple hundred calls with a runtime error in pythonw, I am still looking into that.

it's very verbose on the command line. Is there an easy way to redirect it's output to something else than stdout (besides modifying the .cpp)?

netxshare (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100


View Profile
May 19, 2011, 01:26:19 PM
 #11

Sorry, was not aware anyone else had posted in this thread.

You do not need AMDOverdriveCtrl to use this. I did as you noticed change it from pyADL to ADL in the python code using pyADL was not correct.

I think I know what is causing the crashing I will take a look in to it and update the code. I can also add a option to enable/disable the output, this way it can be enabled when you are configuring the system and disable when you need it to run all the time.

donations: 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
phelix
Legendary
*
Offline Offline

Activity: 1708
Merit: 1019



View Profile
May 19, 2011, 02:23:55 PM
 #12

It might be some deallocation problem. I got this error once: fatal python error dealocating none   mostly it crashes with pretty much no information why. I am so used to having nice Python tracebacks. =)

Is there a particular reason you return NULL sometimes and not Py_None? Or is it the same?


It would be interesting to build a temperature controlled miner with this tool.
netxshare (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100


View Profile
May 19, 2011, 03:39:23 PM
 #13

It might be some deallocation problem. I got this error once: fatal python error dealocating none   mostly it crashes with pretty much no information why. I am so used to having nice Python tracebacks. =)

Is there a particular reason you return NULL sometimes and not Py_None? Or is it the same?


It would be interesting to build a temperature controlled miner with this tool.

I updated a line of code on github I am not sure if this will make a difference at all, but I ran a loop for a while and had no problems. Could you please update and give it a shot.

donations: 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
phelix
Legendary
*
Offline Offline

Activity: 1708
Merit: 1019



View Profile
May 19, 2011, 03:57:02 PM
 #14

Unfortunately still the same problem. I'll take another look at it later. Now sports =)
bolapara
Member
**
Offline Offline

Activity: 78
Merit: 10


View Profile
May 19, 2011, 06:56:15 PM
Last edit: May 19, 2011, 08:10:42 PM by bolapara
 #15

Odd, can't get core or memory clocks from one of my two 5870s.

Code:
core: getCoreClockSpeed() Failed.
mem: getMemoryClockSpeed() Failed.

Edit: typo, should be 5870.
netxshare (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100


View Profile
May 20, 2011, 06:18:08 AM
 #16

Odd, can't get core or memory clocks from one of my two 5870s.

Code:
core: getCoreClockSpeed() Failed.
mem: getMemoryClockSpeed() Failed.

Edit: typo, should be 5870.


Are you running it on linux? if so did you do env Display= :0.1 or whatever you need to do?


I have done a few tests and I ran the current version in a for loop of 1550 with calls to every getXXX function on each gpu, no errors.

I also started working on an example of something I am using pyADL for



It is a real time chart so it updates on it's own, will be useful when all the remote monitoring is done.

donations: 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
phelix
Legendary
*
Offline Offline

Activity: 1708
Merit: 1019



View Profile
May 20, 2011, 10:38:18 AM
 #17

it's definiteley much more stable now! did not crash on me so far.   Cheesy

donated a coin
(and unfortunately I am not one of the old dragons sitting on a big pile of early btc).

Mononofu
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
May 20, 2011, 01:37:45 PM
 #18

Any plans on releasing that realtime temperature tracker?

Looks awesome, and would save me quite some work Smiley
bolapara
Member
**
Offline Offline

Activity: 78
Merit: 10


View Profile
May 21, 2011, 07:47:12 PM
 #19

Are you running it on linux? if so did you do env Display= :0.1 or whatever you need to do?

Yep.  DISPLAY is set properly.  Other calls (like setfanspeed) work.  Those two calls always fail.
Mononofu
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
May 26, 2011, 09:44:20 PM
 #20

Ok, for anyone interested, I wrote my own temperature tracker: http://forum.bitcoin.org/index.php?topic=10073.0
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!