Skip to content

Commit

Permalink
Merge pull request #62 from duggalsu/benchmark_scripts
Browse files Browse the repository at this point in the history
Benchmark scripts
  • Loading branch information
duggalsu authored Feb 7, 2024
2 parents 5945004 + 2ea4d1b commit b4c4eca
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/Dockerfile.image_vec_rep_resnet
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ WORKDIR /app
COPY ./core/operators/image_vec_rep_resnet_requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --user -r requirements.txt
COPY . /app
RUN chmod +x image_vec_operator_profile_memray.sh
RUN chmod +x image_vec_operator_profile_pyinstrument.sh
CMD tail -f /dev/null
2 changes: 2 additions & 0 deletions src/api/Dockerfile.vid_vec_rep_resnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ RUN pip install --no-cache-dir --user -r requirements.txt
COPY . /app
RUN chmod +x video_vec_operator_cprofile.sh
RUN chmod +x video_vec_operator_time.sh
RUN chmod +x video_vec_operator_profile_memray.sh
RUN chmod +x video_vec_operator_profile_pyinstrument.sh
CMD tail -f /dev/null
15 changes: 15 additions & 0 deletions src/api/image_vec_operator_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from PIL import Image
from core.operators import image_vec_rep_resnet


def profile_code():
image_vec_rep_resnet.initialize(param=None)
image_path = r"core/operators/sample_data/text.png"
image = Image.open(image_path)
example_image_obj = {"image": image}
image_vec_rep_resnet.run(example_image_obj)
print("Image vec profiler complete!")


if __name__ == "__main__":
profile_code()
4 changes: 4 additions & 0 deletions src/api/image_vec_operator_profile_memray.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
python -m memray run -o image_vec_rep_resnet.$current_time.bin image_vec_operator_profile.py
tail -f /dev/null
4 changes: 4 additions & 0 deletions src/api/image_vec_operator_profile_pyinstrument.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
pyinstrument -r speedscope -o speedscope_image_vec_rep_resnet.$current_time.json image_vec_operator_profile.py
tail -f /dev/null
12 changes: 12 additions & 0 deletions src/api/video_vec_operator_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from core.operators import vid_vec_rep_resnet


def profile_code():
file_path = {"path": r"core/operators/sample_data/sample-cat-video.mp4"}
vid_vec_rep_resnet.initialize(param=None)
vid_vec_rep_resnet.run(file_path)
print("Video vec profiler complete!")


if __name__ == "__main__":
profile_code()
4 changes: 4 additions & 0 deletions src/api/video_vec_operator_profile_memray.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
python -m memray run -o vid_vec_rep_resnet.$current_time.bin video_vec_operator_profile.py
tail -f /dev/null
4 changes: 4 additions & 0 deletions src/api/video_vec_operator_profile_pyinstrument.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
pyinstrument -r speedscope -o speedscope_vid_vec_rep_resnet.$current_time.json video_vec_operator_profile.py
tail -f /dev/null

0 comments on commit b4c4eca

Please sign in to comment.