start work on multi-gpu support

This commit is contained in:
jussi 2019-01-13 18:51:19 +02:00
parent fdd88eaeb2
commit f47615b970
7 changed files with 85 additions and 85 deletions

View File

@ -259,8 +259,12 @@ void editProfile::dragPoint(int index_x, int index_y, QMouseEvent* event)
palette.setCurrentColorGroup(QPalette::Active);
QColor textColor = palette.color(QPalette::Text);
coordText->position->setType(QCPItemPosition::ptPlotCoords);
coordText->position->setCoords(qv_x[index_x], qv_y[index_y] + 4);
//coordText->position->setType(QCPItemPosition::ptPlotCoords);
if (ui->curvePlot->xAxis->pixelToCoord(point.x()) < x_upper*0.1) {
coordText->position->setCoords(x_upper*0.1, qv_y[index_y] + 4);
} else {
coordText->position->setCoords(qv_x[index_x], qv_y[index_y] + 4);
}
QString xString = QString::number(qv_x[index_x]);
QString yString = QString::number(qv_y[index_y]);
coordText->setText(xString + ", " + yString);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>663</width>
<height>565</height>
<width>437</width>
<height>457</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -14,7 +14,8 @@ MainWindow::MainWindow(QWidget *parent) :
queryGPUSettings();
loadProfileSettings();
queryDriverSettings();
getGPUName();
//getGPUName();
queryGPUs();
setupMonitorTab();
setupGraphMonitorTab();
tabHandler(ui->tabWidget->currentIndex());
@ -280,7 +281,7 @@ void MainWindow::setupGraphMonitorTab()
//connect(r, SIGNAL(mouseMove(QMouseEvent*)), SLOT(plotHovered(QMouseEvent*)));
connect(plotCmdsList[i].plot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(plotHovered(QMouseEvent*)));
connect(plotCmdsList[i].plot, SIGNAL(leaveEvent(QEvent *event)), SLOT(clearPlotTracer(QEvent *event)));
//connect(plotCmdsList[i].plot, SIGNAL(leaveEvent(QEvent *event)), SLOT(clearPlotTracer(QEvent *event)));
}
tempPlot->yAxis->setLabel("Temperature (°C)");
@ -345,14 +346,14 @@ void MainWindow::updateMonitor()
if (!plotCmdsList[i].vector.isEmpty()) {
double lowestval = plotCmdsList[i].vector[0];
double largestval = plotCmdsList[i].vector[0];
for (int j=0; j<plotCmdsList[i].vector.size(); j++) {
/*for (int j=0; j<plotCmdsList[i].vector.size(); j++) {
if (plotCmdsList[i].vector[j] < lowestval) {
lowestval = plotCmdsList[i].vector[j];
}
if (plotCmdsList[i].vector[j] > largestval) {
largestval = plotCmdsList[i].vector[j];
}
}
}*/
if (largestval < plotCmdsList[i].valueq) {
plotCmdsList[i].maxtext->setText("Max: " + QString::number(plotCmdsList[i].valueq));
}
@ -408,6 +409,7 @@ void MainWindow::updateMonitor()
counter = 0;
}
counter++;
qDebug() << qv_time.size();
}
void MainWindow::plotHovered(QMouseEvent *event)
{
@ -426,7 +428,7 @@ void MainWindow::plotHovered(QMouseEvent *event)
}
}
double pointerxcoord = plotCmdsList[plotIndex].plot->xAxis->pixelToCoord(cursor.x());
qDebug() << pointerxcoord << plotVectorSize;
//qDebug() << pointerxcoord << plotVectorSize;
plotCmdsList[plotIndex].tracer->position->setCoords(pointerxcoord, plotCmdsList[plotIndex].plot->yAxis->range().upper);
// Find the y-value for the corresponding coordinate
int valIndex = 0;
@ -453,8 +455,8 @@ void MainWindow::plotHovered(QMouseEvent *event)
//QToolTip::showText(cursor, QString::number(plotCmdsList[plotIndex].vector[valIndex]), plotCmdsList[plotIndex].plot);
//QToolTip::sh
qDebug() << "inside the plot";
QThread::msleep(5);
//qDebug() << "inside the plot";
QThread::msleep(10);
} else {
// If the cursor is not within the x-range, clear the text
plotCmdsList[plotIndex].valText->setText("");
@ -464,7 +466,6 @@ void MainWindow::plotHovered(QMouseEvent *event)
}
void MainWindow::checkForProfiles()
{
qDebug() << "chkproffunc";
// If there are no profiles, create one, then list all the entries whose isProfile is true in the profile selection combo box
QSettings settings("nvfancurve");
QStringList groups = settings.childGroups();
@ -512,14 +513,31 @@ void MainWindow::getGPUDriver()
}
}
void MainWindow::getGPUName()
/*void MainWindow::getGPUName()
{
QProcess process;
process.start(queryGPUName);
process.waitForFinished(-1);
ui->GPUNameLabel->setText(process.readLine());
queryGPUs();
}*/
void MainWindow::queryGPUs()
{
QProcess process;
process.start(nvGPUCountQ);
process.waitForFinished();
for (int i=0; i<process.readLine().toInt(); i++) {
process.start(nvUUIDQ + " -i " + QString::number(i));
process.waitForFinished();
qDebug() << process.readLine();
process.start(queryGPUName + " -i " + QString::number(i));
process.waitForFinished();
QString GPUName = process.readLine();
GPUName.chop(1);
qDebug() << process.readLine();
ui->GPUComboBox->addItem("GPU-" + QString::number(i) + ": " + GPUName);
}
}
void MainWindow::fanSpeedUpdater()
{
QProcess process;
@ -840,9 +858,6 @@ void MainWindow::loadProfileSettings()
ui->fanModeComboBox->setCurrentIndex(fanControlMode);
}
ui->statusBar->showMessage("Profile settings loaded.", 7000);
//statusLabelResetTimer->start(7000);
//statusLabelResetTimer->setSingleShot(true);
connect(statusLabelResetTimer, SIGNAL(timeout()), SLOT(resetStatusLabel()));
qDebug() << xCurvePoints << yCurvePoints;
}

View File

@ -49,7 +49,9 @@ public:
QString grepStringToInt = " | egrep -o '[0-9]{0,100}'\"";
QString queryForNvidiaProp = "/bin/sh -c \"lspci -vnn | grep -c 'Kernel driver in use: nvidia'\"";
QString queryGPUName = "/bin/sh -c \"nvidia-smi --query-gpu=gpu_name --format=csv | grep '[0-9]'\"";
QString queryGPUName = "nvidia-smi --query-gpu=gpu_name --format=csv,noheader";
QString nvGPUCountQ = "nvidia-smi --query-gpu=count --format=csv,noheader";
QString nvUUIDQ = "nvidia-smi --query-gpu=uuid --format=csv,noheader";
QString errorText = "Failed to apply these settings: ";
@ -98,7 +100,8 @@ private slots:
void on_profileComboBox_activated(const QString &arg1);
void queryGPUSettings();
void getGPUName();
//void getGPUName();
void queryGPUs();
void on_frequencySlider_valueChanged(int value);
void on_frequencySpinBox_valueChanged(int arg1);
@ -137,7 +140,6 @@ private slots:
void on_editProfile_closed();
void applyFanMode();
//void resetStatusLabel();
void enableFanUpdater();
void setupMonitorTab();
void updateMonitor();
@ -178,38 +180,38 @@ private:
QTreeWidgetItem *curmaxmemclk = new QTreeWidgetItem;
// Widgets for the graph monitor
QWidget *plotWidget = new QWidget;
QScrollArea *plotScrollArea = new QScrollArea;
QVBoxLayout *lo = new QVBoxLayout;
QWidget *plotWidget = new QWidget(this);
QScrollArea *plotScrollArea = new QScrollArea(this);
QVBoxLayout *lo = new QVBoxLayout(this);
QVBoxLayout *plotLayout = new QVBoxLayout;
QVBoxLayout *plotLayout = new QVBoxLayout(this);
QVBoxLayout *tempLayout = new QVBoxLayout;
QVBoxLayout *powerDrawLayout = new QVBoxLayout;
QVBoxLayout *coreClkLayout = new QVBoxLayout;
QVBoxLayout *memClkLayout = new QVBoxLayout;
QVBoxLayout *coreUtilLayout = new QVBoxLayout;
QVBoxLayout *memUtilLayout = new QVBoxLayout;
QVBoxLayout *voltageLayout = new QVBoxLayout;
QVBoxLayout *fanSpeedLayout = new QVBoxLayout;
QVBoxLayout *tempLayout = new QVBoxLayout(this);
QVBoxLayout *powerDrawLayout = new QVBoxLayout(this);
QVBoxLayout *coreClkLayout = new QVBoxLayout(this);
QVBoxLayout *memClkLayout = new QVBoxLayout(this);
QVBoxLayout *coreUtilLayout = new QVBoxLayout(this);
QVBoxLayout *memUtilLayout = new QVBoxLayout(this);
QVBoxLayout *voltageLayout = new QVBoxLayout(this);
QVBoxLayout *fanSpeedLayout = new QVBoxLayout(this);
QCustomPlot *tempPlot = new QCustomPlot;
QCustomPlot *powerDrawPlot = new QCustomPlot;
QCustomPlot *coreClkPlot = new QCustomPlot;
QCustomPlot *memClkPlot = new QCustomPlot;
QCustomPlot *coreUtilPlot = new QCustomPlot;
QCustomPlot *memUtilPlot = new QCustomPlot;
QCustomPlot *voltagePlot = new QCustomPlot;
QCustomPlot *fanSpeedPlot = new QCustomPlot;
QCustomPlot *tempPlot = new QCustomPlot(this);
QCustomPlot *powerDrawPlot = new QCustomPlot(this);
QCustomPlot *coreClkPlot = new QCustomPlot(this);
QCustomPlot *memClkPlot = new QCustomPlot(this);
QCustomPlot *coreUtilPlot = new QCustomPlot(this);
QCustomPlot *memUtilPlot = new QCustomPlot(this);
QCustomPlot *voltagePlot = new QCustomPlot(this);
QCustomPlot *fanSpeedPlot = new QCustomPlot(this);
QWidget *tempWidget = new QWidget;
QWidget *powerDrawWidget = new QWidget;
QWidget *coreClkWidget = new QWidget;
QWidget *memClkWidget = new QWidget;
QWidget *coreUtilWidget = new QWidget;
QWidget *memUtilWidget = new QWidget;
QWidget *voltageWidget = new QWidget;
QWidget *fanSpeedWidget = new QWidget;
QWidget *tempWidget = new QWidget(this);
QWidget *powerDrawWidget = new QWidget(this);
QWidget *coreClkWidget = new QWidget(this);
QWidget *memClkWidget = new QWidget(this);
QWidget *coreUtilWidget = new QWidget(this);
QWidget *memUtilWidget = new QWidget(this);
QWidget *voltageWidget = new QWidget(this);
QWidget *fanSpeedWidget = new QWidget(this);
/*QCPTextElement *tempMaxText;
QCPTextElement *powerDrawMaxText;
@ -259,13 +261,6 @@ private:
QVector <plotCmds> plotCmdsList;
};
class plotWidgets : public QWidget
{
Q_OBJECT
protected:
//void leaveEvent(QEvent *event);
};
#endif // MAINWINDOW_H

View File

@ -15,13 +15,16 @@
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QComboBox" name="GPUComboBox"/>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="perfEditorTab">
<attribute name="title">
@ -224,31 +227,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Page</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>471</width>
<height>560</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -11,7 +11,9 @@ newProfile::newProfile(QWidget *parent) :
connect(ui->profileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(editEntryName(QListWidgetItem*)));
SignalItemDelegate *delegate = new SignalItemDelegate(ui->profileList);
deleg = delegate;
connect(deleg, SIGNAL(editStarted), SLOT(testi()));
}
newProfile::~newProfile()
@ -23,7 +25,10 @@ void newProfile::on_profileNameEdit_textChanged(const QString &arg1)
{
newProfileName = arg1;
}
void newProfile::testi()
{
qDebug() << "edit started";
}
void newProfile::on_saveButton_clicked()
{
QSettings settings("nvfancurve");
@ -73,12 +78,12 @@ void newProfile::on_cancelButton_clicked()
}
void newProfile::on_addButton_pressed()
{
SignalItemDelegate *delegate = new SignalItemDelegate(ui->profileList);
/*SignalItemDelegate *delegate = new SignalItemDelegate(ui->profileList);
connect(delegate, &SignalItemDelegate::editStarted,[](){qDebug("edit started");});
connect(delegate, &SignalItemDelegate::editFinished,[](){qDebug("edit finished");});
ui->profileList->setItemDelegate(delegate);
ui->profileList->addItem("");
int itemCount = ui->profileList->count()-1;
ui->profileList->item(itemCount)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
ui->profileList->editItem(ui->profileList->item(itemCount));
ui->profileList->editItem(ui->profileList->item(itemCount)); */
}

View File

@ -32,9 +32,12 @@ private slots:
void on_addButton_pressed();
void rightClick(QMouseEvent *event);
void testi();
private:
Ui::newProfile *ui;
QString newProfileName;
QStyledItemDelegate *deleg = new QStyledItemDelegate(this);
};
// New class for editing so we can detect when the editing has finished
class SignalItemDelegate : public QStyledItemDelegate