Skip to content

Commit

Permalink
publish from 2d5e2208 (gopub)
Browse files Browse the repository at this point in the history
  • Loading branch information
huiqiwa committed Mar 23, 2023
1 parent abe6b3a commit 36f1eb8
Show file tree
Hide file tree
Showing 93 changed files with 8,044 additions and 804 deletions.
34 changes: 34 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,40 @@ sudo docker run --rm \
## ==> $PWD/build/xpu-smi*.rpm generated.
```

# Build .rpm package for CentOS Stream 9
```sh
# in /tmp/xpum_src

# Create builder
sudo docker build \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
--iidfile /tmp/xpum_builder_centos_stream9.iid \
-f builder/Dockerfile.builder-centos-stream9 .

# Build xpumanager package
rm -fr build
sudo docker run --rm \
-v $PWD:$PWD \
-u $UID \
-e CCACHE_DIR=$PWD/.ccache \
-e CCACHE_BASEDIR=$PWD \
$(cat /tmp/xpum_builder_centos_stream9.iid) $PWD/build.sh -DBUILD_DOC=ON

## ==> $PWD/build/xpumanager*.rpm generated

# Build xpu-smi package
rm -fr build
sudo docker run --rm \
-v $PWD:$PWD \
-u $UID \
-e CCACHE_DIR=$PWD/.ccache \
-e CCACHE_BASEDIR=$PWD \
$(cat /tmp/xpum_builder_centos_stream9.iid) $PWD/build.sh -DBUILD_DOC=ON -DDAEMONLESS=ON

## ==> $PWD/build/xpu-smi*.rpm generated.
```

# Build .rpm package for SUSE
```sh
# in /tmp/xpum_src
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.5
1.2.6
78 changes: 78 additions & 0 deletions builder/Dockerfile.builder-centos-stream9
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
ARG BASE_VERSION=stream9
FROM quay.io/centos/centos:$BASE_VERSION

ARG L0_SRC_URL=https://github.com/oneapi-src/level-zero/archive/refs/tags/v1.8.5.tar.gz
ARG METEE_URL=https://github.com/intel/metee/archive/refs/tags/3.1.3.tar.gz
ARG IGSC_URL=https://github.com/intel/igsc/archive/refs/tags/V0.8.4.tar.gz
ARG ZLIB_VERSION=v1.2.13
ARG GRPC_VERSION=v1.49.1
ARG PROTOBUF_VERSION=v3.19.4

RUN dnf update -y && \
dnf clean all && \
dnf install -y cmake \
dnf-plugins-core \
gcc \
gcc-c++ \
git \
libtool \
libudev-devel \
make \
openssl-devel \
python3.9 \
python3.9-devel \
python3.9-pip \
rpm-build && \
dnf config-manager --set-enabled crb && \
dnf -y install epel-release && \
dnf install -y \
ccache \
doxygen \
glibc-static \
lua-devel && \
dnf clean all

RUN git clone --recurse-submodules --depth 1 -b $GRPC_VERSION https://github.com/grpc/grpc && \
cd /grpc/third_party/zlib && \
git pull https://github.com/madler/zlib $ZLIB_VERSION && \
cd /grpc/third_party/protobuf && \
git pull https://github.com/protocolbuffers/protobuf.git $PROTOBUF_VERSION && \
cd /grpc && \
mkdir -p cmake/build && \
cd cmake/build && \
cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
../.. && \
make -j && make install && \
rm -fr /grpc

COPY builder/requirements.txt /tmp/requirements.txt
RUN python3 -m pip --proxy=$http_proxy install -r /tmp/requirements.txt

RUN curl -s --location $METEE_URL | tar -xz && \
cd /metee-* && \
mkdir build && \
cd build && \
cmake .. && \
make -j4 && \
make install && \
rm -fr /metee-*

RUN curl -s --location $IGSC_URL | tar -xz && \
cd /igsc-* && \
mkdir build && \
cd build && \
cmake .. && \
make -j4 && \
make install && \
rm -fr /igsc-*

RUN curl -s --location ${L0_SRC_URL} | tar -xz && \
cd /level-zero-* && \
mkdir build && \
cd build && \
cmake .. && \
cmake --build . --config Release && \
cmake --build . --config Release --target install && \
rm -fr /level-zero-* && \
ldconfig
9 changes: 9 additions & 0 deletions builder/build-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ centos8_ver=8
suse_ver=15.4
ubuntu_ver_focal=20.04
ubuntu_ver_jammy=22.04
centos_stream9_ver=stream9

docker pull centos:$centos7_ver
docker pull centos:$centos8_ver
docker pull opensuse/leap:$suse_ver
docker pull ubuntu:$ubuntu_ver_focal
docker pull ubuntu:$ubuntu_ver_jammy
docker pull quay.io/centos/centos:$centos_stream9_ver

docker build \
--build-arg http_proxy=$http_proxy \
Expand Down Expand Up @@ -69,6 +71,13 @@ docker build \
-t $registry/xpum-builder-ubuntu-jammy:$image_tag \
-f Dockerfile.builder-ubuntu .. > ubuntu_jammy.log 2>&1 &

docker build \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
--build-arg BASE_VERSION=$centos_stream9_ver \
-t $registry/xpum-builder-centos-stream9:$image_tag \
-f Dockerfile.builder-centos-stream9 .. > centos-stream9.log 2>&1 &

wait

docker system prune
Expand Down
21 changes: 16 additions & 5 deletions cli/src/comlet_diagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <set>
#include <unordered_map>

#include "local_functions.h"

namespace xpum::cli {

static CharTableConfig ComletConfigDiagnosticDevice(R"({
Expand Down Expand Up @@ -112,7 +114,9 @@ std::unordered_map<int, int> testIdToType = {{1, XPUM_DIAG_PERFORMANCE_COMPUTATI
{3, XPUM_DIAG_PERFORMANCE_MEMORY_BANDWIDTH},
{4, XPUM_DIAG_MEDIA_CODEC},
{5, XPUM_DIAG_INTEGRATION_PCIE},
{6, XPUM_DIAG_PERFORMANCE_POWER}};
{6, XPUM_DIAG_PERFORMANCE_POWER},
{7, XPUM_DIAG_COMPUTATION},
{8, XPUM_DIAG_LIGHT_CODEC}};

void ComletDiagnostic::setupOptions() {
this->opts = std::unique_ptr<ComletDiagnosticOptions>(new ComletDiagnosticOptions());
Expand Down Expand Up @@ -144,6 +148,10 @@ void ComletDiagnostic::setupOptions() {
auto stressTimeOpt = addOption("--stresstime", this->opts->stressTime, "Stress time (in minutes)");
auto preCheckOpt = addFlag("--precheck", this->opts->preCheck, "Do the precheck on the GPU and GPU driver");
auto onlyGPUOpt = addFlag("--gpu", this->opts->onlyGPU, "Show the GPU status only");
auto sinceTimeOpt = addOption("--since", this->opts->sinceTime, "Start time for log scanning. The generic format is \"YYYY-MM-DD HH:MM:SS\".\n\
Alternatively the strings \"yesterday\", \"today\" are also understood.\n\
Relative times also may be specified, prefixed with \"-\" referring to times before the current time.\n\
Scanning will starts from the latest boot if it is not specified.");

auto singleTestIdList = addOption("--singletest", this->opts->singleTestIdList,
"Selectively run some particular tests. Separated by the comma.\n\
Expand All @@ -152,9 +160,11 @@ void ComletDiagnostic::setupOptions() {
3. Memory Bandwidth\n\
4. Media Codec\n\
5. PCIe Bandwidth\n\
6. Power");
6. Power\n\
7. Computation functional test\n\
8. Media Codec functional test");
singleTestIdList->delimiter(',');
singleTestIdList->check(CLI::Range(1, 6));
singleTestIdList->check(CLI::Range(1, (int)testIdToType.size()));

preCheckOpt->excludes(deviceIdOpt);
preCheckOpt->excludes(level);
Expand All @@ -165,7 +175,8 @@ void ComletDiagnostic::setupOptions() {
level->excludes(stressTimeOpt);
level->excludes(singleTestIdList);
singleTestIdList->excludes(level);

sinceTimeOpt->needs(preCheckOpt);

deviceIdOpt->excludes(preCheckOpt);
if (stressFlag == nullptr) {
deviceIdOpt->needs(level);
Expand Down Expand Up @@ -269,7 +280,7 @@ std::unique_ptr<nlohmann::json> ComletDiagnostic::run() {
}

if (this->opts->preCheck) {
json = this->coreStub->getPreCheckInfo(this->opts->onlyGPU, this->opts->rawJson);
json = getPreCheckInfo(this->opts->onlyGPU, this->opts->rawJson, this->opts->sinceTime);
return json;
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/comlet_diagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct ComletDiagnosticOptions {
bool onlyGPU = false;
uint32_t stressTime = 0;
bool stress = false;
std::string sinceTime;
};

enum ShowMode {
Expand Down
16 changes: 12 additions & 4 deletions cli/src/comlet_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ static nlohmann::json discoveryBasicJson = R"({
}]
})"_json;


// To add a new data to dump, the dumpId should be max(
// dumpId in discoveryDetailedJson and function initDumpPropConfig) + 1
static nlohmann::json discoveryDetailedJson = R"({
"columns": [{
"title": "Device ID"
Expand All @@ -62,6 +65,7 @@ static nlohmann::json discoveryDetailedJson = R"({
"device_id", [
{ "label": "Device Type", "value": "device_type" },
{ "label": "Device Name", "value": "device_name", "dumpId": 2 },
{ "label": "PCI Device ID", "value": "pci_device_id", "dumpId": 24},
{ "label": "Vendor Name", "value": "vendor_name", "dumpId": 3 },
{ "label": "UUID", "value": "uuid", "dumpId": 4 },
{ "label": "Serial Number", "value": "serial_number", "dumpId": 5 },
Expand Down Expand Up @@ -166,7 +170,9 @@ static void initDumpPropConfig() {
keys.push("rows");

dumpFieldConfig.clear();
//Add "for dump only" data here
dumpFieldConfig.push_back(dump_prop_config{"Device ID", "device_id", 1, "", 0});
dumpFieldConfig.push_back(dump_prop_config{"PCI Vendor ID", "pci_vendor_id", 23, "", 0});

readDumpPropConfig(discoveryDetailedJson, keys, dumpFieldConfig);
std::sort(dumpFieldConfig.begin(), dumpFieldConfig.end(),
Expand Down Expand Up @@ -269,13 +275,15 @@ void ComletDiscovery::checkBadDevices(nlohmann::json &deviceJsonList) {
deviceJson["gfx_data_firmware_version"] =
fwVer.gfx_data_fw_version;
}
std::string name;
if (getPciName(name, bdf) == true) {
deviceJson["device_name"] = name;
PciDeviceData pdd;
if (getPciDeviceData(pdd, bdf) == true) {
deviceJson["device_name"] = pdd.name;
deviceJson["pci_device_id"] = pdd.pciDeviceId;
deviceJson["pci_vendor_id"] = pdd.vendorId;
}
std::vector<std::string> pciPath;
if (getPciPath(pciPath, bdf) == true) {
name = this->coreStub->getPciSlotName(pciPath);
std::string name = this->coreStub->getPciSlotName(pciPath);
if (name.length() > 0) {
deviceJson["pci_slot"] = name;
}
Expand Down
Loading

0 comments on commit 36f1eb8

Please sign in to comment.