Skip to content
Merged
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
11 changes: 10 additions & 1 deletion .github/workflows/docker-push-vidvec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ jobs:
workdir: src/api/
dockerfile: Dockerfile.vid_vec_rep_resnet
tags: ${{ steps.vars.outputs.sha_short }}
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
- uses: elgohr/Publish-Docker-Github-Action@main
with:
username: tattletech
password: ${{ secrets.DOCKER_PASSWORD }}
name: tattletech/feluda-operator-vidvec
workdir: src/api/
dockerfile: Dockerfile.vid_vec_rep_resnet.graviton
tags: ${{ steps.vars.outputs.sha_short }}
platforms: linux/arm64

# - name: deploy to cluster
# uses: steebchen/kubectl@v2.0.0
Expand Down
62 changes: 31 additions & 31 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ services:
cap_add:
- IPC_LOCK

queue:
image: rabbitmq:3.8.7-management
container_name: rabbitmq
hostname: rabbit
volumes:
- ./.docker/rabbitmq/data:/var/lib/rabbitmq
- ./.docker/rabbitmq/logs:/var/log/rabbitmq
environment:
RABBITMQ_ERLANG_COOKIE: "secret-cookie"
RABBITMQ_DEFAULT_USER: "admin"
RABBITMQ_DEFAULT_PASS: "Admin123"
ports:
- 5672:5672
- 15672:15672
# queue:
# image: rabbitmq:3.8.7-management
# container_name: rabbitmq
# hostname: rabbit
# volumes:
# - ./.docker/rabbitmq/data:/var/lib/rabbitmq
# - ./.docker/rabbitmq/logs:/var/log/rabbitmq
# environment:
# RABBITMQ_ERLANG_COOKIE: "secret-cookie"
# RABBITMQ_DEFAULT_USER: "admin"
# RABBITMQ_DEFAULT_PASS: "Admin123"
# ports:
# - 5672:5672
# - 15672:15672

api:
container_name: feluda_api
Expand All @@ -57,8 +57,8 @@ services:
depends_on:
store:
condition: service_started
queue:
condition: service_started
# queue:
# condition: service_started

indexer:
container_name: feluda_indexer
Expand All @@ -71,22 +71,22 @@ services:
depends_on:
store:
condition: service_started
queue:
condition: service_started
# queue:
# condition: service_started

reporter:
container_name: feluda_reporter
build:
context: ./src/api
dockerfile: Dockerfile
target: debug
env_file: ./src/api/development.env
command: tail -f /dev/null
depends_on:
store:
condition: service_started
queue:
condition: service_started
# reporter:
# container_name: feluda_reporter
# build:
# context: ./src/api
# dockerfile: Dockerfile
# target: debug
# env_file: ./src/api/development.env
# command: tail -f /dev/null
# depends_on:
# store:
# condition: service_started
# queue:
# condition: service_started

#networks:
# default:
Expand Down
14 changes: 7 additions & 7 deletions src/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# FROM jrottenberg/ffmpeg:4.0-scratch AS ffmpeg

FROM python:3.11-slim@sha256:637774748f62b832dc11e7b286e48cd716727ed04b45a0322776c01bc526afc3 AS base
FROM python:3.11-slim-bullseye AS base
# COPY --from=ffmpeg / /
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y \
--no-install-recommends gcc build-essential \
--no-install-recommends libgl1-mesa-glx libglib2.0-0 \
&& apt-get purge -y --auto-remove \
gcc build-essential \
libgl1-mesa-glx libglib2.0-0 \
# && apt-get install -y \
# --no-install-recommends gcc build-essential \
# --no-install-recommends libgl1-mesa-glx libglib2.0-0 \
# && apt-get purge -y --auto-remove \
# gcc build-essential \
# libgl1-mesa-glx libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
ENV PATH=/root/.local/bin:$PATH
RUN pip install --no-cache-dir --upgrade pip
Expand Down
22 changes: 0 additions & 22 deletions src/api/Dockerfile.vid_vec_rep_resnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ WORKDIR /app
COPY ./core/operators/vid_vec_rep_resnet_requirements.txt /app/core/operators/vid_vec_rep_resnet_requirements.txt
RUN pip install --no-cache-dir --user -r /app/core/operators/vid_vec_rep_resnet_requirements.txt

### AWS Graviton Optimization ###
# Graviton3(E) (e.g. c7g, c7gn and Hpc7g instances) supports BF16 format for ML acceleration. This can be enabled in oneDNN by setting the below environment variable
ENV DNNL_DEFAULT_FPMATH_MODE=BF16

# Enable primitive caching to avoid the redundant primitive allocation
# latency overhead. Please note this caching feature increases the
# memory footprint. Tune this cache capacity to a lower value to
# reduce the additional memory requirement.
ENV LRU_CACHE_CAPACITY=1024

# Enable Transparent huge page allocations from PyTorch C10 allocator
ENV THP_MEM_ALLOC_ENABLE=1

# Make sure the openmp threads are distributed across all the processes for multi process applications to avoid over subscription for the vcpus. For example if there is a single application process, then num_processes should be set to '1' so that all the vcpus are assigned to it with one-to-one mapping to omp threads
# RUN num_vcpus=8
# RUN num_processes=1
# RUN temp = $((1 > ($num_vcpus/$num_processes) ? 1 : ($num_vcpus/$num_processes)))
ENV OMP_NUM_THREADS=1
ENV OMP_PROC_BIND=false
ENV OMP_PLACES=cores
###

COPY ./core/operators/vid_vec_rep_resnet.py /app/core/operators/vid_vec_rep_resnet.py

COPY ./core/operators/sample_data/sample-cat-video.mp4 /app/core/operators/sample_data/sample-cat-video.mp4
Expand Down
67 changes: 67 additions & 0 deletions src/api/Dockerfile.vid_vec_rep_resnet.graviton
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM python:3.11-slim-bullseye AS base
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y \
--no-install-recommends gcc build-essential \
--no-install-recommends libgl1-mesa-glx libglib2.0-0 \
&& apt-get purge -y --auto-remove \
gcc build-essential \
libgl1-mesa-glx libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
ENV PATH=/root/.local/bin:$PATH

RUN pip install --no-cache-dir --upgrade pip
WORKDIR /app
COPY ./core/operators/vid_vec_rep_resnet_requirements.txt /app/core/operators/vid_vec_rep_resnet_requirements.txt
RUN pip install --no-cache-dir --user -r /app/core/operators/vid_vec_rep_resnet_requirements.txt

### AWS Graviton Optimization ###

# Graviton3(E) (e.g. c7g, c7gn and Hpc7g instances) supports BF16 format for ML acceleration. This can be enabled in oneDNN by setting the below environment variable
ENV DNNL_DEFAULT_FPMATH_MODE=BF16

# Enable primitive caching to avoid the redundant primitive allocation
# latency overhead. Please note this caching feature increases the
# memory footprint. Tune this cache capacity to a lower value to
# reduce the additional memory requirement.
ENV LRU_CACHE_CAPACITY=1024

# Enable Transparent huge page allocations from PyTorch C10 allocator
ENV THP_MEM_ALLOC_ENABLE=1

# Make sure the openmp threads are distributed across all the processes for multi process applications to avoid over subscription for the vcpus. For example if there is a single application process, then num_processes should be set to '1' so that all the vcpus are assigned to it with one-to-one mapping to omp threads
# RUN num_vcpus=8
# RUN num_processes=1
# RUN temp = $((1 > ($num_vcpus/$num_processes) ? 1 : ($num_vcpus/$num_processes)))
ENV OMP_NUM_THREADS=1
ENV OMP_PROC_BIND=false
ENV OMP_PLACES=cores
###

COPY ./core/operators/vid_vec_rep_resnet.py /app/core/operators/vid_vec_rep_resnet.py

COPY ./core/operators/sample_data/sample-cat-video.mp4 /app/core/operators/sample_data/sample-cat-video.mp4
COPY ./core/operators/test_vid_vec_rep_resnet.py /app/core/operators/test_vid_vec_rep_resnet.py

COPY ./video_vec_operator_cprofile.py /app/video_vec_operator_cprofile.py
COPY ./video_vec_operator_cprofile.sh /app/video_vec_operator_cprofile.sh
RUN chmod +x video_vec_operator_cprofile.sh

COPY ./video_vec_operator_time.py /app/video_vec_operator_time.py
COPY ./video_vec_operator_time.sh /app/video_vec_operator_time.sh
RUN chmod +x video_vec_operator_time.sh

COPY ./video_vec_operator_profile.py /app/video_vec_operator_profile.py
COPY ./video_vec_operator_profile_memray.sh /app/video_vec_operator_profile_memray.sh
COPY ./video_vec_operator_profile_pyinstrument.sh /app/video_vec_operator_profile_pyinstrument.sh
RUN chmod +x video_vec_operator_profile_memray.sh
RUN chmod +x video_vec_operator_profile_pyinstrument.sh

COPY ./video_vec_operator_multicore.py /app/video_vec_operator_multicore.py
COPY ./video_vec_operator_multicore.sh /app/video_vec_operator_multicore.sh
RUN chmod +x video_vec_operator_multicore.sh

COPY ./benchmark.sh /app/benchmark.sh
RUN chmod +x benchmark.sh

CMD tail -f /dev/null
18 changes: 9 additions & 9 deletions src/api/core/feluda.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from core import config, store
from core.server import Server
from core.operators import Operator
from core.queue import Queue
# from core.queue import Queue
from enum import Enum


Expand All @@ -23,9 +23,9 @@ def __init__(self, configPath):
self.operators = Operator(self.config.operators)
if self.config.store:
self.store = store.get_store(self.config.store)
if self.config.queue:
# print("---> 1", self.config.queue)
self.queue = Queue.make(self.config.queue)
# if self.config.queue:
# # print("---> 1", self.config.queue)
# self.queue = Queue.make(self.config.queue)
if self.config.server:
self.server = Server(self.config.server)

Expand All @@ -43,8 +43,8 @@ def start(self):
self.store.connect()
self.store.optionally_create_index()

if self.queue:
self.queue.connect()
# if self.queue:
# self.queue.connect()

if self.server:
self.server.start()
Expand All @@ -55,9 +55,9 @@ def start_component(self, component_type: ComponentType):
elif component_type == ComponentType.STORE and self.store:
self.store.connect()
self.store.optionally_create_index()
elif component_type == ComponentType.QUEUE and self.queue:
self.queue.connect()
self.queue.initialize()
# elif component_type == ComponentType.QUEUE and self.queue:
# self.queue.connect()
# self.queue.initialize()
else:
raise Exception("Unsupported Component Type")

Expand Down
4 changes: 2 additions & 2 deletions src/api/core/operators/vid_vec_rep_resnet_requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
torch==2.1.2+cpu
torchvision==0.16.2+cpu
torch==2.2.0+cpu
torchvision==0.17.0+cpu
numpy==1.26.3
Pillow==10.2.0
scipy==1.11.4
Expand Down
6 changes: 2 additions & 4 deletions src/api/requirements.in
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
flask==2.3.2
flask_cors==3.0.9
google-cloud==0.34.0
google-cloud-vision==3.5.0
Pillow==10.2.0
elasticsearch==8.11.1
wget==3.2
pika==1.3.2
python-dotenv==1.0.0
boto3==1.34.34
click==8.1.7
pytest==7.4.4
PyYAML==6.0.1
dacite==1.8.1
memray==1.11.0 # dev
pyinstrument==4.6.2
numpy==1.26.3
numpy==1.26.3
requests==2.31.0
Loading