Updated to 0.4.0-1 ze-monitor to allow showing amount of memory on GPU
This commit is contained in:
parent
93f25bd919
commit
34edaa3fdc
@ -95,7 +95,7 @@ RUN apt-get install -y \
|
|||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
|
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
|
||||||
|
|
||||||
RUN git clone --depth 1 --branch v0.3.0-1 https://github.com/jketreno/ze-monitor /opt/ze-monitor
|
RUN git clone --depth 1 --branch v0.4.0-1 https://github.com/jketreno/ze-monitor /opt/ze-monitor
|
||||||
WORKDIR /opt/ze-monitor/build
|
WORKDIR /opt/ze-monitor/build
|
||||||
RUN cmake .. \
|
RUN cmake .. \
|
||||||
&& make \
|
&& make \
|
||||||
@ -287,6 +287,7 @@ RUN usermod -aG ze-monitor root
|
|||||||
# the source or follow on containers will always rebuild whenever
|
# the source or follow on containers will always rebuild whenever
|
||||||
# the source changes.
|
# the source changes.
|
||||||
#COPY /src/ /opt/airc/src/
|
#COPY /src/ /opt/airc/src/
|
||||||
|
COPY /src/requirements.txt /opt/airc/src/requirements.txt
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-c" ]
|
||||||
|
|
||||||
|
@ -83,11 +83,30 @@ def get_graphics_cards():
|
|||||||
|
|
||||||
# Clean up the output (remove leading/trailing whitespace and newlines)
|
# Clean up the output (remove leading/trailing whitespace and newlines)
|
||||||
output = result.stdout.strip()
|
output = result.stdout.strip()
|
||||||
for line in output.splitlines():
|
for index in range(len(output.splitlines())):
|
||||||
# Updated regex to handle GPU names containing parentheses
|
result = subprocess.run(['ze-monitor', f'--device {index+1} --info'], capture_output=True, text=True, check=True)
|
||||||
match = re.match(r'^[^(]*\((.*)\)', line)
|
gpu_info = result.stdout.strip().splitlines()
|
||||||
|
gpu = {
|
||||||
|
"discrete": True, # Assume it's discrete initially
|
||||||
|
"name": None,
|
||||||
|
"memory": None
|
||||||
|
}
|
||||||
|
gpus.append(gpu)
|
||||||
|
for line in gpu_info:
|
||||||
|
match = re.match(r'^Device: [^(]*\((.*)\)', line)
|
||||||
if match:
|
if match:
|
||||||
gpus.append(match.group(1))
|
gpu["name"] = match.group(1)
|
||||||
|
continue
|
||||||
|
|
||||||
|
match = re.match(r'^\s*Memory: (.*)', line)
|
||||||
|
if match:
|
||||||
|
gpu["memory"] = match.group(1)
|
||||||
|
continue
|
||||||
|
|
||||||
|
match = re.match(r'^\s*Is integrated with host: Yes"', line)
|
||||||
|
if match:
|
||||||
|
gpu["discrete"] = False
|
||||||
|
continue
|
||||||
|
|
||||||
return gpus
|
return gpus
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user