-
Notifications
You must be signed in to change notification settings - Fork 40
Fix: [GPU] Not show gpu on some platform. #529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: [GPU] Not show gpu on some platform. #529
Conversation
-- Not show gpu on some platform. Log: fix issue Bug: https://pms.uniontech.com/task-view-378987.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR refactors the main function’s GPU info retrieval logic by separating the base and memory info calls so that GPU details are displayed even when memory info detection fails on some platforms. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
fa702c1 to
e96c146
Compare
deepin pr auto review我对这段代码进行审查,发现了一些需要改进的地方:
改进建议: #include <iostream>
#include <QMap>
#include <QString>
// 添加日志函数
void logInfo(const QString& message) {
std::cout << "[INFO] " << message.toStdString() << std::endl;
}
void logError(const QString& message) {
std::cerr << "[ERROR] " << message.toStdString() << std::endl;
}
bool getGpuBaseInfo(QMap<QString, QString> &mapInfo) {
// 原有实现
}
bool getGpuMemInfoForFTDTM(QMap<QString, QString> &mapInfo) {
// 原有实现
}
int main(int argc, char *argv[]) {
// 处理命令行参数
if (argc > 1) {
logError("Usage: " + QString(argv[0]) + " [no arguments]");
return 1;
}
QMap<QString, QString> mapInfo;
// 获取基础信息
if (!getGpuBaseInfo(mapInfo)) {
logError("Failed to get GPU base information");
return 1;
}
// 获取内存信息
if (!getGpuMemInfoForFTDTM(mapInfo)) {
logError("Failed to get GPU memory information");
return 1;
}
// 输出信息
for (auto it = mapInfo.begin(); it != mapInfo.end(); ++it) {
logInfo(it.key() + ": " + it.value());
}
return 0;
}
这些改进将使代码更加健壮、可维护,并提高其安全性。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
|
This pr cannot be merged! (status: unstable) |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
7e87464
into
linuxdeepin:develop/eagle
-- Not show gpu on some platform.
Log: fix issue
Bug: https://pms.uniontech.com/task-view-378987.html
Summary by Sourcery
Bug Fixes: