Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions benchmark_edge_pipelines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ basedir="$(realpath "$(dirname -- "$0")")"
Timestamp="$(date "+%Y%m%d-%H%M%S")"
System="$(lscpu | grep "Model name" | grep -v "BIOS" | sed -n 's/^Model name://p' | sed 's/.*Intel/Intel/g')"

IS_EMT=false
if [ -f /etc/os-release ]; then
os_name=$(grep -i '^NAME=' /etc/os-release | head -n 1 | cut -d= -f2- | tr -d '"')
if echo "$os_name" | grep -qi "Edge Microvisor Toolkit"; then
IS_EMT=true
fi
fi

if [ "$IS_EMT" = true ]; then
DOCKER_IMAGE="intel/dlstreamer:custom"
else
DOCKER_IMAGE="intel/dlstreamer:latest"
fi

# Target per-stream fps and margin of error
# Example: 0.95 == 95% of target. 30 * 0.95 = 28.5 fps
# Example: 1.00 == 100% of target. 30 * 1.00 = 30.0 fps
Expand Down Expand Up @@ -310,7 +324,7 @@ if [[ ${#Commands[@]} -gt 1 ]]; then
echo "[ Info ] Container: ${ContainerName}"
echo ""
echo "[ Info ] Pipeline Template: ${PipelineTemplates[$i]}"
ThisDockerCommand=("${DockerCommand[@]}" --name "${ContainerName}" intel/dlstreamer:latest)
ThisDockerCommand=("${DockerCommand[@]}" --name "${ContainerName}" "${DOCKER_IMAGE}")

# Run the pipelines
# shellcheck disable=SC2086
Expand All @@ -325,7 +339,7 @@ else
echo "[ Info ] Container: ${ContainerName}"
echo ""
echo "[ Info ] Pipeline Template: ${PipelineTemplates[0]}"
ThisDockerCommand=("${DockerCommand[@]}" --name "${ContainerName}" intel/dlstreamer:latest)
ThisDockerCommand=("${DockerCommand[@]}" --name "${ContainerName}" "${DOCKER_IMAGE}")

# Run the pipelines
# shellcheck disable=SC2086
Expand Down
13 changes: 13 additions & 0 deletions display_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ basedir="$(realpath "$(dirname -- "$0")")"
. "${basedir}/utils/helper_functions.sh"
Timestamp="$(date "+%Y%m%d-%H%M%S")"

IS_EMT=false
if [ -f /etc/os-release ]; then
os_name=$(grep -i '^NAME=' /etc/os-release | head -n 1 | cut -d= -f2- | tr -d '"')
if echo "$os_name" | grep -qi "Edge Microvisor Toolkit"; then
IS_EMT=true
fi
fi

if [ "$IS_EMT" = true ]; then
echo "[ Info ] Skipping display pipeline on Edge Microvisor Toolkit (no desktop environment)"
exit 0
fi

# Initialize parameters
PipelineConfig="none"

Expand Down
2 changes: 1 addition & 1 deletion media-downloader/download_and_encode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ download_pexels() {
(( $# == 2 )) || { echo "[ Error ] download_pexels <url> <out>"; exit 1; }
local url="$1" out="$2"
rm -f "${out}.part"
wget -q --show-progress --tries=5 --timeout=30 -L \
wget -q --tries=5 --timeout=30 \
-O "${out}.part" "${url}"
mv -f "${out}.part" "${out}"
}
Expand Down
2 changes: 1 addition & 1 deletion model-conversion/convert_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ download_raw() {
mkdir -p "$(dirname -- "${out}")"
echo "[ Download ] ${url} -> ${out}"
rm -f "${out}.part"
wget -q --show-progress --tries=5 --timeout=30 -L -O "${out}.part" "${url}"
wget -q --tries=5 --timeout=30 -O "${out}.part" "${url}"
mv -f "${out}.part" "${out}"
}

Expand Down
65 changes: 65 additions & 0 deletions setup/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
FROM intel/dlstreamer:latest

USER root

# Proxy configuration
ARG YOUR_HTTP_PROXY
ARG YOUR_HTTPS_PROXY
ARG YOUR_NO_PROXY

# Set proxy environment variables
ENV http_proxy=${YOUR_HTTP_PROXY}
ENV https_proxy=${YOUR_HTTPS_PROXY}
ENV HTTP_PROXY=${YOUR_HTTP_PROXY}
ENV HTTPS_PROXY=${YOUR_HTTPS_PROXY}
ENV no_proxy=${YOUR_NO_PROXY}
ENV NO_PROXY=${YOUR_NO_PROXY}

# Change the default shell to bash
SHELL ["/bin/bash", "-c"]

# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive


# Update and install common tools
RUN apt-get update && \
apt-get install -y \
sudo \
curl \
vim \
wget \
gnupg \
ca-certificates \
libtbb12 \
gcc \
g++ \
make \
automake \
cmake \
autoconf \
lsb-release \
pciutils \
&& rm -rf /var/lib/apt/lists/*

RUN echo '#!/bin/bash' > /usr/local/bin/sudo && \
echo 'exec "$@"' >> /usr/local/bin/sudo && \
chmod +x /usr/local/bin/sudo

# Copy driver installation scripts
COPY drivers/install_gpu_driver.sh /tmp/install_gpu_driver.sh
COPY drivers/install_npu_driver.sh /tmp/install_npu_driver.sh

# Make scripts executable
RUN chmod +x /tmp/install_gpu_driver.sh /tmp/install_npu_driver.sh

# Install GPU driver
RUN echo "[ Info ] Installing GPU driver..." && \
/tmp/install_gpu_driver.sh || echo "[ Warning ] GPU driver installation failed or not applicable"

# Install NPU driver
RUN echo "[ Info ] Installing NPU driver..." && \
/tmp/install_npu_driver.sh || echo "[ Warning ] NPU driver installation failed or not applicable"

# Clean up installation scripts
RUN rm -f /tmp/install_gpu_driver.sh /tmp/install_npu_driver.sh
177 changes: 145 additions & 32 deletions setup/install_prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
# Configuration
REINSTALL_GPU_DRIVER='no'
REINSTALL_NPU_DRIVER='no'

#
IS_EMT=false
# Show help message
show_help() {
cat <<EOF
Expand Down Expand Up @@ -85,24 +86,44 @@
fi

# Detect Ubuntu version
ubuntu_version=$(lsb_release -rs)
case "$ubuntu_version" in
24.04|22.04)
echo "[ Info ] Ubuntu $ubuntu_version detected"
;;
*)
echo -e "${RED}[ Error ]${NC} Unsupported Ubuntu version: $ubuntu_version"
if command -v lsb_release &> /dev/null; then
ubuntu_version=$(lsb_release -rs)
case "$ubuntu_version" in
24.04|22.04)
echo "[ Info ] Ubuntu $ubuntu_version detected"
;;
*)
echo -e "${RED}[ Error ]${NC} Unsupported Ubuntu version: $ubuntu_version"
exit 1
;;
esac
else
if [ -f /etc/os-release ]; then
os_name=$(grep -i '^NAME=' /etc/os-release | head -n 1 | cut -d= -f2- | tr -d '"')
if echo "$os_name" | grep -qi "Edge Microvisor Toolkit"; then
IS_EMT=true
echo "[ Info ] Edge Microvisor Toolkit detected"
else
echo -e "${RED}[ Error ]${NC} Unsupported OS: $os_name"
exit 1
fi
else
echo -e "${RED}[ Error ]${NC} Unable to detect OS (missing lsb_release and /etc/os-release)"
exit 1
;;
esac
fi
fi

# Get CPU information
cpu_model_name=$(lscpu | grep "Model name:" | awk -F: '{print $2}' | xargs)
echo "[ Info ] CPU: $cpu_model_name"
echo ""

update_package_lists() {
timeout --foreground $APT_UPDATE_TIMEOUT $SUDO_PREFIX apt-get update 2>&1
if [ "$IS_EMT" = true ]; then
timeout --foreground $APT_UPDATE_TIMEOUT $SUDO_PREFIX tdnf makecache 2>&1
else
timeout --foreground $APT_UPDATE_TIMEOUT $SUDO_PREFIX apt-get update 2>&1
fi
local update_exit_code=$?

if [ $update_exit_code -eq 124 ]; then
Expand All @@ -118,7 +139,11 @@
local log_file
log_file=$(mktemp)

timeout --foreground $APT_GET_TIMEOUT $SUDO_PREFIX apt-get install -y --allow-downgrades "$@" 2>&1 | tee "$log_file"
if [ "$IS_EMT" = true ]; then
timeout --foreground $APT_GET_TIMEOUT $SUDO_PREFIX tdnf install -y "$@" 2>&1 | tee "$log_file"
else
timeout --foreground $APT_GET_TIMEOUT $SUDO_PREFIX apt-get install -y --allow-downgrades "$@" 2>&1 | tee "$log_file"
fi
local status=${PIPESTATUS[0]}

if [[ $status -eq 124 ]]; then
Expand Down Expand Up @@ -156,6 +181,23 @@

# Docker install function
install_docker() {
if [ "$IS_EMT" = true ]; then
if command -v docker &> /dev/null; then
echo "[ Info ] Docker preinstalled on Edge Microvisor Toolkit"
if command -v systemctl &> /dev/null; then
$SUDO_PREFIX systemctl enable docker
$SUDO_PREFIX systemctl start docker
else
echo -e "${RED}[ Error ]${NC} systemctl not available to start Docker service"
exit 1
fi
return 0
else
echo -e "${RED}[ Error ]${NC} Docker not found on Edge Microvisor Toolkit"
exit 1
fi
fi

if command -v docker &> /dev/null; then
local docker_version
docker_version=$(docker --version 2>/dev/null | awk '{print $3}' | tr -d ',')
Expand Down Expand Up @@ -190,6 +232,11 @@

# GPU compute driver installation (optional)
install_gpu_driver() {
if [ "$IS_EMT" = true ]; then
echo "[ Info ] Skipping GPU driver install on Edge Microvisor Toolkit"
return 0
fi

if [ "$REINSTALL_GPU_DRIVER" = "yes" ]; then
echo ""
echo -e "${GREEN}[ GPU Driver Installation ]${NC}"
Expand All @@ -203,6 +250,11 @@

# NPU compute driver installation (optional)
install_npu_driver() {
if [ "$IS_EMT" = true ]; then
echo "[ Info ] Skipping NPU driver install on Edge Microvisor Toolkit"
return 0
fi

if [ "$REINSTALL_NPU_DRIVER" = "yes" ]; then
echo ""
echo -e "${GREEN}[ NPU Driver Installation ]${NC}"
Expand All @@ -227,26 +279,41 @@

echo ""
echo "[ Info ] Installing essential packages..."
$SUDO_PREFIX apt --fix-broken install -y -qq
install_packages \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release \
software-properties-common \
build-essential \
cmake \
git \
wget \
python3-dev \
python3-pip \
python3-venv \
ffmpeg \
cpuid\
vainfo \
clinfo \
intel-gpu-tools
if [ "$IS_EMT" = true ]; then
install_packages \
ca-certificates \
curl \
gnupg \
build-essential \
cmake \
git \
wget \
python3-pip \
cpuid \
mesa-libGL \
intel-gpu-tools
else
$SUDO_PREFIX apt --fix-broken install -y -qq
install_packages \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release \
software-properties-common \
build-essential \
cmake \
git \
wget \
python3-dev \
python3-pip \
python3-venv \
ffmpeg \
cpuid\
vainfo \
clinfo \
intel-gpu-tools
fi

echo ""
install_docker
Expand All @@ -264,6 +331,52 @@
need_to_logout=1
fi
fi
build_container() {
echo ""
echo -e "${GREEN}[ Info ]${NC} Building custom dlstreamer container for EMT"

local http_proxy_value="${http_proxy:-${HTTP_PROXY:-}}"
local https_proxy_value="${https_proxy:-${HTTPS_PROXY:-}}"
local no_proxy_value="${no_proxy:-${NO_PROXY:-}}"

if [ -z "$http_proxy_value" ]; then
echo -e "${RED}[ Error ]${NC} http_proxy/HTTP_PROXY not set"
exit 1
fi

if [ -z "$https_proxy_value" ]; then
echo -e "${RED}[ Error ]${NC} https_proxy/HTTPS_PROXY not set"
exit 1
fi

if [ -z "$no_proxy_value" ]; then
echo -e "${RED}[ Error ]${NC} no_proxy/NO_PROXY not set"
exit 1
fi

$SUDO_PREFIX docker build \
--build-arg YOUR_HTTP_PROXY="$http_proxy_value" \
--build-arg YOUR_HTTPS_PROXY="$https_proxy_value" \
--build-arg YOUR_NO_PROXY="$no_proxy_value" \
--no-cache \
-t intel/dlstreamer:custom .

if [ $? -ne 0 ]; then

Check warning on line 364 in setup/install_prerequisites.sh

View workflow job for this annotation

GitHub Actions / shellcheck-scan-pr

[shellcheck] reported by reviewdog 🐶 Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. Raw Output: ./setup/install_prerequisites.sh:364:10: info: Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. (ShellCheck.SC2181)
echo -e "${RED}[ Error ]${NC} Container image build failed"
exit 1
fi
}

if [ "$IS_EMT" = true ]; then
echo ""
echo -e "${GREEN}==================================================${NC}"
echo -e "${GREEN} Docker Container Build${NC}"
echo -e "${GREEN}==================================================${NC}"
echo ""
build_container
fi



echo ""
echo -e "${GREEN}==================================================${NC}"
Expand Down