Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Changed extension name to ADL

- Added getGPULoad()
  • Loading branch information...
commit f219b55fa93be13a0398bc21350af281a959180f 1 parent de4e4c1
@bitshiftio authored
Showing with 408 additions and 395 deletions.
  1. +42 −41 ReadMe.txt
  2. +321 −312 pyADL.cpp
  3. +38 −36 pyADL.py
  4. +7 −6 setup.py
View
83 ReadMe.txt
@@ -1,41 +1,42 @@
-/* ---------------------------------------------------------------------------
-** This software is in the public domain, furnished "as is", without technical
-** support, and with no warranty, express or implied, as to its usefulness for
-** any purpose.
-**
-** THIS PROGRAM MAY DAMAGE YOUR VIDEO CARD, IF YOU APPLY NONSENSIAL VALUES.
-** e.g. INCREASING THE VOLTAGES AND FREQUENCIES IN CONJUNCTION WITH LOWERING THE
-** FAN SPEED IS NOT ADVISABLE!
-**
-** ALL ADL code has been taken from AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ )
-**
-** AMDOverdriveCtrl Author: Thorsten Gilling (tgilling@web.de)
-**
-** pyADL.cpp
-** This is just a simple python extended library for AMD ADL
-** Author: netxshare - http://www.bitshift.io
-**
-** 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
-** -------------------------------------------------------------------------*/
-
-
-I accept NO responsibility for any damage that may or may not be caused to your system by attempting an overclock, and this will also possibly void a manufacturer's warranty. Do this at your OWN RISK.
-
-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)
+/* ---------------------------------------------------------------------------
+** This software is in the public domain, furnished "as is", without technical
+** support, and with no warranty, express or implied, as to its usefulness for
+** any purpose.
+**
+** THIS PROGRAM MAY DAMAGE YOUR VIDEO CARD, IF YOU APPLY NONSENSIAL VALUES.
+** e.g. INCREASING THE VOLTAGES AND FREQUENCIES IN CONJUNCTION WITH LOWERING THE
+** FAN SPEED IS NOT ADVISABLE!
+**
+** ALL ADL code has been taken from AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ )
+**
+** AMDOverdriveCtrl Author: Thorsten Gilling (tgilling@web.de)
+**
+** pyADL.cpp
+** This is just a simple python extended library for AMD ADL
+** Author: netxshare - http://www.bitshift.io
+**
+** 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
+** -------------------------------------------------------------------------*/
+
+
+I accept NO responsibility for any damage that may or may not be caused to your system by attempting an overclock, and this will also possibly void a manufacturer's warranty. Do this at your OWN RISK.
+
+ADL SDK - http://developer.amd.com/Downloads/ADL_SDK_3.0.zip
+
+Put the ADL SDK in ./ADL_SDK
+
+Functions
+
+ADL.SetupADL(DeviceIndex) - This sets the GPU you wish to use.
+ADL.getTemp() - Returns the GPU Temp.
+ADL.getGPULoad() - Returns the current gpu load percent.
+ADL.getFanSpeed() - Returns the fan speed percent.
+ADL.getFanRPM() - Returns the fan RPMs.
+ADL.getCoreClockSpeed() - Returns Current Core Clock Speed.
+ADL.getMemoryClockSpeed() - Returns Current Memory Clock Speed.
+ADL.getVoltage() - Returns Current Voltage.
+
+ADL.setFanSpeed(Precent) - Sets The Fan Speed.
+ADL.setCoreClockSpeed(Level,Speed) - Sets Core Clock Speed. Level(0,1,2)
+ADL.setMemoryClockSpeed(Level,Speed) - Sets Memory Clock Speed. Level(0,1,2)
+ADL.setVoltage(Level, Voltage) - Sets Voltage. Level(0,1,2)
View
633 pyADL.cpp
@@ -1,312 +1,321 @@
-/* ---------------------------------------------------------------------------
-** This software is in the public domain, furnished "as is", without technical
-** support, and with no warranty, express or implied, as to its usefulness for
-** any purpose.
-**
-** THIS PROGRAM MAY DAMAGE YOUR VIDEO CARD, IF YOU APPLY NONSENSIAL VALUES.
-** e.g. INCREASING THE VOLTAGES AND FREQUENCIES IN CONJUNCTION WITH LOWERING THE
-** FAN SPEED IS NOT ADVISABLE!
-**
-** ALL ADL code has been taken from AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ )
-**
-** AMDOverdriveCtrl Author: Thorsten Gilling (tgilling@web.de)
-**
-** pyADL.cpp
-** This is just a simple python extended library for AMD ADL
-** Author: netxshare - http://www.bitshift.io
-**
-** 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
-** -------------------------------------------------------------------------*/
-
-
-#include <Python.h>
-#include "adl.h"
-
-ADL* adl;
-long int GpuIndex = 0;
-static int MissingFeatures = 0;
-
-static PyObject *SetupADL(PyObject *self, PyObject *args)
-{
- adl = ADL::Instance();
-
-
-
- if(! PyArg_ParseTuple(args, "i", &GpuIndex))
- return NULL;
-
- if (adl == NULL)
- {
-
- return Py_BuildValue("s","Unable to initialize AMD ADL Library.");
- }
-
- adl->SetGPUIndex(&GpuIndex);
-
-
- return Py_None;
-
-}
-
-
-static PyObject *getTemp(PyObject *self, PyObject *noarg)
-{
- if (adl->GetSupportedFeatures() & ADL::FEAT_GET_TEMPERATURE)
- {
- return Py_BuildValue("f", (float)adl->mTemperature.iTemperature/1000.0);
- }
- else
- return Py_BuildValue("s", "getTemp() Failed.");
-
-}
-
-static PyObject *getFanSpeed(PyObject *self, PyObject *noarg)
-{
-
- if ((adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED_INFO) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED))
- {
- return Py_BuildValue("i", adl->mCurrentFanSpeed.iFanSpeed * 100 / adl->mFanSpeedInfo.iMaxRPM);
- }
- else
- return Py_BuildValue("s", "getFanSpeed() Failed.");
-
-}
-
-static PyObject *getFanRPM(PyObject *self, PyObject *noarg)
-{
-
- if ((adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED_INFO) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED))
- {
- return Py_BuildValue("i", adl->mCurrentFanSpeed.iFanSpeed);
- }
- else
- return Py_BuildValue("s", "getFanRPM() Failed.");
-}
-
-static PyObject *getCoreClockSpeed(PyObject *self, PyObject *noarg)
-{
-
-
- if (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS)
- {
- return Py_BuildValue("i", adl->mpODPerformanceLevels->aLevels[adl->mODActivity.iCurrentPerformanceLevel].iEngineClock/100);
- }
- else
- return Py_BuildValue("s", "getCoreClockSpeed() Failed.");
-}
-
-static PyObject *getMemoryClockSpeed(PyObject *self, PyObject *noarg)
-{
-
-
- if (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS)
- {
- return Py_BuildValue("i", adl->mpODPerformanceLevels->aLevels[adl->mODActivity.iCurrentPerformanceLevel].iMemoryClock/100);
- }
- else
- return Py_BuildValue("s", "getMemoryClockSpeed() Failed.");
-}
-
-static PyObject *getVoltage(PyObject *self, PyObject *noarg)
-{
-
-
- if (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS)
- {
- return Py_BuildValue("f", (float)adl->mpODPerformanceLevels->aLevels[adl->mODActivity.iCurrentPerformanceLevel].iVddc/1000.0);
- }
- else
- return Py_BuildValue("s", "getVoltage() Failed.");
-}
-
-static PyObject *setFanSpeed(PyObject *self, PyObject *args)
-{
- int percent;
-
- if(! PyArg_ParseTuple(args, "i", &percent))
- return NULL;
-
- if (adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED)
- {
- ADLFanSpeedValue speed_value;
-
- speed_value.iSize = sizeof(ADLFanSpeedValue);
- speed_value.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
- speed_value.iFanSpeed = percent;
- speed_value.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
-
- if(SAVE_CALL(adl->ADL_Overdrive5_FanSpeed_Set)(adl->GetGPUIndex(), 0, &speed_value) != ADL_OK)
- {
- return Py_False;
- }
- else
- {
- ACT_LOG("Fan speed set to " << percent << "%");
- return Py_True;
- }
-
- }
-
- return Py_False;
-
-
-}
-
-
-static PyObject *setCoreClockSpeed(PyObject *self, PyObject *args)
-{
- int Level,CoreSpeed;
-
- if(! PyArg_ParseTuple(args, "ii", &Level, &CoreSpeed))
- return NULL;
-
- if((adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PERF_LEVELS))
- {
- ADLODParameters para;
- ADLODPerformanceLevels* levels;
-
- ADL* adl = ADL::Instance();
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODParameters_Get)(adl->GetGPUIndex(), &para) == ADL_OK)
- {
- int perf_level_size = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * (para.iNumberOfPerformanceLevels - 1);
- levels = (ADLODPerformanceLevels*)malloc(perf_level_size);
- levels->iSize = perf_level_size;
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Get)(adl->GetGPUIndex(), 0, levels) == ADL_OK)
- {
- levels->aLevels[Level].iEngineClock = CoreSpeed * 100;
- ACT_LOG("SetOverdriveValues: Level " << Level << ": Core Clock: " << CoreSpeed << "MHz");
-
- }
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Set)(adl->GetGPUIndex(), levels) != ADL_OK)
- {
- return Py_False;
- }
-
- free(levels);
- levels = NULL;
-
- return Py_True;
- }
- return Py_False;
- }
- return Py_False;
-}
-
-static PyObject *setMemoryClockSpeed(PyObject *self, PyObject *args)
-{
- int Level,CoreSpeed;
-
- if(! PyArg_ParseTuple(args, "ii", &Level, &CoreSpeed))
- return NULL;
-
- if((adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PERF_LEVELS))
- {
- ADLODParameters para;
- ADLODPerformanceLevels* levels;
-
- ADL* adl = ADL::Instance();
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODParameters_Get)(adl->GetGPUIndex(), &para) == ADL_OK)
- {
- int perf_level_size = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * (para.iNumberOfPerformanceLevels - 1);
- levels = (ADLODPerformanceLevels*)malloc(perf_level_size);
- levels->iSize = perf_level_size;
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Get)(adl->GetGPUIndex(), 0, levels) == ADL_OK)
- {
- levels->aLevels[Level].iMemoryClock = CoreSpeed * 100;
- ACT_LOG("SetOverdriveValues: Level " << Level << ": Memory Clock: " << CoreSpeed << "MHz");
-
- }
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Set)(adl->GetGPUIndex(), levels) != ADL_OK)
- {
- return Py_False;
- }
-
- free(levels);
- levels = NULL;
-
- return Py_True;
- }
- return Py_False;
- }
- return Py_False;
-}
-
-static PyObject *setVoltage(PyObject *self, PyObject *args)
-{
- int Level,Voltage;
-
- if(! PyArg_ParseTuple(args, "ii", &Level, &Voltage))
- return NULL;
-
- if((adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PERF_LEVELS))
- {
- ADLODParameters para;
- ADLODPerformanceLevels* levels;
-
- ADL* adl = ADL::Instance();
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODParameters_Get)(adl->GetGPUIndex(), &para) == ADL_OK)
- {
- int perf_level_size = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * (para.iNumberOfPerformanceLevels - 1);
- levels = (ADLODPerformanceLevels*)malloc(perf_level_size);
- levels->iSize = perf_level_size;
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Get)(adl->GetGPUIndex(), 0, levels) == ADL_OK)
- {
- levels->aLevels[Level].iVddc = Voltage;
- ACT_LOG("SetOverdriveValues: Level " << Level << ": Voltage: " << Voltage << " V");
-
- }
-
- if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Set)(adl->GetGPUIndex(), levels) != ADL_OK)
- {
- return Py_False;
- }
-
- free(levels);
- levels = NULL;
-
- return Py_True;
- }
- return Py_False;
- }
- return Py_False;
-}
-
-
-
-static PyMethodDef ADL_Methods[] = {
-
- {"SetupADL", SetupADL, METH_VARARGS, "Initialize ADL"},
- {"getTemp", getTemp, METH_NOARGS, "Returns GPU Temperature."},
- {"getFanSpeed", getFanSpeed, METH_NOARGS, "Returns Fan Speed."},
- {"getFanRPM", getFanRPM, METH_NOARGS, "Returns Current Fan RPM."},
- {"getCoreClockSpeed", getCoreClockSpeed, METH_NOARGS, "Returns Current Core Clock Speed."},
- {"getMemoryClockSpeed", getMemoryClockSpeed, METH_NOARGS, "Returns Current Memory Clock Speed."},
- {"getVoltage", getVoltage, METH_NOARGS, "Returns Current Voltage."},
- {"setFanSpeed", setFanSpeed, METH_VARARGS, "Sets The Fan Speed."},
- {"setCoreClockSpeed", setCoreClockSpeed, METH_VARARGS, "Sets The Core Clock Speed."},
- {"setMemoryClockSpeed", setMemoryClockSpeed, METH_VARARGS, "Sets The Memory Clock Speed."},
- {"setVoltage", setVoltage, METH_VARARGS, "Sets The GPU Voltage."},
- {NULL, NULL, 0, NULL}
-};
-
-
-PyMODINIT_FUNC initpyADL(void)
-{
-
- PyObject *m;
-
- m = Py_InitModule("pyADL", ADL_Methods);
- if (m == NULL)
- return;
-
-}
-
-
+/* ---------------------------------------------------------------------------
+** This software is in the public domain, furnished "as is", without technical
+** support, and with no warranty, express or implied, as to its usefulness for
+** any purpose.
+**
+** THIS PROGRAM MAY DAMAGE YOUR VIDEO CARD, IF YOU APPLY NONSENSIAL VALUES.
+** e.g. INCREASING THE VOLTAGES AND FREQUENCIES IN CONJUNCTION WITH LOWERING THE
+** FAN SPEED IS NOT ADVISABLE!
+**
+** ALL ADL code has been taken from AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ )
+**
+** AMDOverdriveCtrl Author: Thorsten Gilling (tgilling@web.de)
+**
+** pyADL.cpp
+** This is just a simple python extended library for AMD ADL
+** Author: netxshare - http://www.bitshift.io
+**
+** 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
+** -------------------------------------------------------------------------*/
+
+
+#include <Python.h>
+#include "adl.h"
+
+ADL* adl;
+long int GpuIndex = 0;
+
+static PyObject *SetupADL(PyObject *self, PyObject *args)
+{
+ adl = ADL::Instance();
+
+
+
+ if(! PyArg_ParseTuple(args, "i", &GpuIndex))
+ return NULL;
+
+ if (adl == NULL)
+ {
+
+ return Py_BuildValue("s","Unable to initialize AMD ADL Library.");
+ }
+
+ adl->SetGPUIndex(&GpuIndex);
+
+
+ return Py_None;
+
+}
+
+static PyObject *getGPULoad(PyObject *self, PyObject *noarg)
+{
+ if (adl->GetSupportedFeatures() & ADL::FEAT_GET_ACTIVITY)
+ {
+ return Py_BuildValue("i", adl->mODActivity.iActivityPercent);
+ }
+ else
+ return Py_BuildValue("s", "getGPULoad() Failed.");
+
+}
+
+static PyObject *getTemp(PyObject *self, PyObject *noarg)
+{
+ if (adl->GetSupportedFeatures() & ADL::FEAT_GET_TEMPERATURE)
+ {
+ return Py_BuildValue("f", (float)adl->mTemperature.iTemperature/1000.0);
+ }
+ else
+ return Py_BuildValue("s", "getTemp() Failed.");
+}
+
+static PyObject *getFanSpeed(PyObject *self, PyObject *noarg)
+{
+
+ if ((adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED_INFO) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED))
+ {
+ return Py_BuildValue("i", adl->mCurrentFanSpeed.iFanSpeed * 100 / adl->mFanSpeedInfo.iMaxRPM);
+ }
+ else
+ return Py_BuildValue("s", "getFanSpeed() Failed.");
+
+}
+
+static PyObject *getFanRPM(PyObject *self, PyObject *noarg)
+{
+
+ if ((adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED_INFO) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED))
+ {
+ return Py_BuildValue("i", adl->mCurrentFanSpeed.iFanSpeed);
+ }
+ else
+ return Py_BuildValue("s", "getFanRPM() Failed.");
+}
+
+static PyObject *getCoreClockSpeed(PyObject *self, PyObject *noarg)
+{
+
+
+ if (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS)
+ {
+ return Py_BuildValue("i", adl->mpODPerformanceLevels->aLevels[adl->mODActivity.iCurrentPerformanceLevel].iEngineClock/100);
+ }
+ else
+ return Py_BuildValue("s", "getCoreClockSpeed() Failed.");
+}
+
+static PyObject *getMemoryClockSpeed(PyObject *self, PyObject *noarg)
+{
+
+
+ if (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS)
+ {
+ return Py_BuildValue("i", adl->mpODPerformanceLevels->aLevels[adl->mODActivity.iCurrentPerformanceLevel].iMemoryClock/100);
+ }
+ else
+ return Py_BuildValue("s", "getMemoryClockSpeed() Failed.");
+}
+
+static PyObject *getVoltage(PyObject *self, PyObject *noarg)
+{
+
+
+ if (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS)
+ {
+ return Py_BuildValue("f", (float)adl->mpODPerformanceLevels->aLevels[adl->mODActivity.iCurrentPerformanceLevel].iVddc/1000.0);
+ }
+ else
+ return Py_BuildValue("s", "getVoltage() Failed.");
+}
+
+static PyObject *setFanSpeed(PyObject *self, PyObject *args)
+{
+ int percent;
+
+ if(! PyArg_ParseTuple(args, "i", &percent))
+ return NULL;
+
+ if (adl->GetSupportedFeatures() & ADL::FEAT_GET_FANSPEED)
+ {
+ ADLFanSpeedValue speed_value;
+
+ speed_value.iSize = sizeof(ADLFanSpeedValue);
+ speed_value.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
+ speed_value.iFanSpeed = percent;
+ speed_value.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_FanSpeed_Set)(adl->GetGPUIndex(), 0, &speed_value) != ADL_OK)
+ {
+ return Py_False;
+ }
+ else
+ {
+ ACT_LOG("Fan speed set to " << percent << "%");
+ return Py_True;
+ }
+
+ }
+
+ return Py_False;
+
+
+}
+
+
+static PyObject *setCoreClockSpeed(PyObject *self, PyObject *args)
+{
+ int Level,CoreSpeed;
+
+ if(! PyArg_ParseTuple(args, "ii", &Level, &CoreSpeed))
+ return NULL;
+
+ if((adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PERF_LEVELS))
+ {
+ ADLODParameters para;
+ ADLODPerformanceLevels* levels;
+
+ ADL* adl = ADL::Instance();
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODParameters_Get)(adl->GetGPUIndex(), &para) == ADL_OK)
+ {
+ int perf_level_size = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * (para.iNumberOfPerformanceLevels - 1);
+ levels = (ADLODPerformanceLevels*)malloc(perf_level_size);
+ levels->iSize = perf_level_size;
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Get)(adl->GetGPUIndex(), 0, levels) == ADL_OK)
+ {
+ levels->aLevels[Level].iEngineClock = CoreSpeed * 100;
+ ACT_LOG("SetOverdriveValues: Level " << Level << ": Core Clock: " << CoreSpeed << "MHz");
+
+ }
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Set)(adl->GetGPUIndex(), levels) != ADL_OK)
+ {
+ return Py_False;
+ }
+
+ free(levels);
+ levels = NULL;
+
+ return Py_True;
+ }
+ return Py_False;
+ }
+ return Py_False;
+}
+
+static PyObject *setMemoryClockSpeed(PyObject *self, PyObject *args)
+{
+ int Level,CoreSpeed;
+
+ if(! PyArg_ParseTuple(args, "ii", &Level, &CoreSpeed))
+ return NULL;
+
+ if((adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PERF_LEVELS))
+ {
+ ADLODParameters para;
+ ADLODPerformanceLevels* levels;
+
+ ADL* adl = ADL::Instance();
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODParameters_Get)(adl->GetGPUIndex(), &para) == ADL_OK)
+ {
+ int perf_level_size = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * (para.iNumberOfPerformanceLevels - 1);
+ levels = (ADLODPerformanceLevels*)malloc(perf_level_size);
+ levels->iSize = perf_level_size;
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Get)(adl->GetGPUIndex(), 0, levels) == ADL_OK)
+ {
+ levels->aLevels[Level].iMemoryClock = CoreSpeed * 100;
+ ACT_LOG("SetOverdriveValues: Level " << Level << ": Memory Clock: " << CoreSpeed << "MHz");
+
+ }
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Set)(adl->GetGPUIndex(), levels) != ADL_OK)
+ {
+ return Py_False;
+ }
+
+ free(levels);
+ levels = NULL;
+
+ return Py_True;
+ }
+ return Py_False;
+ }
+ return Py_False;
+}
+
+static PyObject *setVoltage(PyObject *self, PyObject *args)
+{
+ int Level,Voltage;
+
+ if(! PyArg_ParseTuple(args, "ii", &Level, &Voltage))
+ return NULL;
+
+ if((adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PARAMETERS) && (adl->GetSupportedFeatures() & ADL::FEAT_GET_OD_PERF_LEVELS))
+ {
+ ADLODParameters para;
+ ADLODPerformanceLevels* levels;
+
+ ADL* adl = ADL::Instance();
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODParameters_Get)(adl->GetGPUIndex(), &para) == ADL_OK)
+ {
+ int perf_level_size = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * (para.iNumberOfPerformanceLevels - 1);
+ levels = (ADLODPerformanceLevels*)malloc(perf_level_size);
+ levels->iSize = perf_level_size;
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Get)(adl->GetGPUIndex(), 0, levels) == ADL_OK)
+ {
+ levels->aLevels[Level].iVddc = Voltage;
+ ACT_LOG("SetOverdriveValues: Level " << Level << ": Voltage: " << Voltage << " V");
+
+ }
+
+ if(SAVE_CALL(adl->ADL_Overdrive5_ODPerformanceLevels_Set)(adl->GetGPUIndex(), levels) != ADL_OK)
+ {
+ return Py_False;
+ }
+
+ free(levels);
+ levels = NULL;
+
+ return Py_True;
+ }
+ return Py_False;
+ }
+ return Py_False;
+}
+
+
+
+static PyMethodDef ADL_Methods[] = {
+
+ {"SetupADL", SetupADL, METH_VARARGS, "Initialize ADL."},
+ {"getGPULoad", getGPULoad, METH_NOARGS, "Returns Current GPU Load."},
+ {"getTemp", getTemp, METH_NOARGS, "Returns GPU Temperature."},
+ {"getFanSpeed", getFanSpeed, METH_NOARGS, "Returns Fan Speed."},
+ {"getFanRPM", getFanRPM, METH_NOARGS, "Returns Current Fan RPM."},
+ {"getCoreClockSpeed", getCoreClockSpeed, METH_NOARGS, "Returns Current Core Clock Speed."},
+ {"getMemoryClockSpeed", getMemoryClockSpeed, METH_NOARGS, "Returns Current Memory Clock Speed."},
+ {"getVoltage", getVoltage, METH_NOARGS, "Returns Current Voltage."},
+ {"setFanSpeed", setFanSpeed, METH_VARARGS, "Sets The Fan Speed."},
+ {"setCoreClockSpeed", setCoreClockSpeed, METH_VARARGS, "Sets The Core Clock Speed."},
+ {"setMemoryClockSpeed", setMemoryClockSpeed, METH_VARARGS, "Sets The Memory Clock Speed."},
+ {"setVoltage", setVoltage, METH_VARARGS, "Sets The GPU Voltage."},
+ {NULL, NULL, 0, NULL}
+};
+
+
+PyMODINIT_FUNC initADL(void)
+{
+
+ PyObject *m;
+
+ m = Py_InitModule("ADL", ADL_Methods);
+ if (m == NULL)
+ return;
+
+}
+
+
View
74 pyADL.py
@@ -1,36 +1,38 @@
-'''
-/* ---------------------------------------------------------------------------
-** This software is in the public domain, furnished "as is", without technical
-** support, and with no warranty, express or implied, as to its usefulness for
-** any purpose.
-**
-** THIS PROGRAM MAY DAMAGE YOUR VIDEO CARD, IF YOU APPLY NONSENSIAL VALUES.
-** e.g. INCREASING THE VOLTAGES AND FREQUENCIES IN CONJUNCTION WITH LOWERING THE
-** FAN SPEED IS NOT ADVISABLE!
-**
-** ALL ADL code has been taken from AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ )
-**
-** AMDOverdriveCtrl Author: Thorsten Gilling (tgilling@web.de)
-**
-** pyADL.cpp
-** This is just a simple python extended library for AMD ADL
-** Author: netxshare - http://www.bitshift.io
-**
-** 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
-** -------------------------------------------------------------------------*/
-'''
-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.setCoreClockSpeed(2,900)
-pyADL.SetupADL(5) # Switch to Second GPU on 6990
-#pyADL.setCoreClockSpeed(2,900)
-print pyADL.getTemp()
-#pyADL.setMemoryClockSpeed(2,1000)
+'''
+/* ---------------------------------------------------------------------------
+** This software is in the public domain, furnished "as is", without technical
+** support, and with no warranty, express or implied, as to its usefulness for
+** any purpose.
+**
+** THIS PROGRAM MAY DAMAGE YOUR VIDEO CARD, IF YOU APPLY NONSENSIAL VALUES.
+** e.g. INCREASING THE VOLTAGES AND FREQUENCIES IN CONJUNCTION WITH LOWERING THE
+** FAN SPEED IS NOT ADVISABLE!
+**
+** ALL ADL code has been taken from AMDOverdriveCtrl ( http://amdovdrvctrl.sourceforge.net/ )
+**
+** AMDOverdriveCtrl Author: Thorsten Gilling (tgilling@web.de)
+**
+** pyADL.py
+** This is just a simple python extended library for AMD ADL
+** Author: netxshare - http://www.bitshift.io
+**
+** 1CWddfhXagPoWgzUCs7oVHFjwBmqbAoJRr
+** -------------------------------------------------------------------------*/
+'''
+import ADL
+
+ADL.SetupADL(0)
+print ADL.getGPULoad()
+print ADL.getTemp()
+print ADL.getFanSpeed()
+print ADL.getFanRPM()
+print ADL.getCoreClockSpeed()
+print ADL.getMemoryClockSpeed()
+print ADL.getVoltage()
+ADL.setFanSpeed(75)
+#ADL.setCoreClockSpeed(2,900)
+ADL.SetupADL(5) # Switch to Second GPU on 6990
+#ADL.setCoreClockSpeed(2,900)
+print ADL.getTemp()
+print ADL.getGPULoad()
+#ADL.setMemoryClockSpeed(2,1000)
View
13 setup.py
@@ -1,19 +1,20 @@
-import sys
-from distutils.core import setup, Extension
+from distutils.core import setup, Extension
+import sys
+
if(sys.platform == 'linux2'):
extra_compile_args = ['-DLINUX']
else:
extra_compile_args = None
-setup (name = 'pyADL',
- version = '0.01',
+setup (name = 'adl',
+ version = '0.02',
description = 'Python AMD ADL Wrapper',
author = 'netxshare',
- url = 'http://www.bitshift.io',
+ url = 'http://www.bitshift.io/pyADL/',
ext_modules = [
Extension(
- 'pyADL',
+ 'ADL',
extra_compile_args=extra_compile_args,
include_dirs = ['./ADL_SDK/include/'],
sources = ['pyADL.cpp','adl.cpp']
Please sign in to comment.
Something went wrong with that request. Please try again.