Skip to content

Commit

Permalink
refactor: benchmark test sh file (#64)
Browse files Browse the repository at this point in the history
* refactor: benchmark test sh file

* ci: dockerfile udpate for benchmark.sh

* chore: echo statements for benchmark file
  • Loading branch information
aatmanvaidya authored Feb 8, 2024
1 parent 04c92f4 commit 37e768a
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/api/Dockerfile.vid_vec_rep_resnet
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ COPY ./video_vec_operator_profile_pyinstrument.sh /app/video_vec_operator_profil
RUN chmod +x video_vec_operator_profile_memray.sh
RUN chmod +x video_vec_operator_profile_pyinstrument.sh

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

CMD tail -f /dev/null
11 changes: 11 additions & 0 deletions src/api/benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

./video_vec_operator_time.sh
echo "test 1 done"
./video_vec_operator_cprofile.sh
echo "test 2 done"
./video_vec_operator_profile_memray.sh
echo "test 3 done"
./video_vec_operator_profile_pyinstrument.sh
echo "test 4 done"
tail -f /dev/null
3 changes: 1 addition & 2 deletions src/api/image_vec_operator_profile_memray.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env 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
python -m memray run -o image_vec_rep_resnet.$current_time.bin image_vec_operator_profile.py
3 changes: 1 addition & 2 deletions src/api/image_vec_operator_profile_pyinstrument.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env 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
pyinstrument -r speedscope -o speedscope_image_vec_rep_resnet.$current_time.json image_vec_operator_profile.py
1 change: 1 addition & 0 deletions src/api/video_vec_operator_cprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def profile_code():
stats = pstats.Stats(profiler, stream=result_stream).sort_stats('cumulative')
stats.print_stats()
print(result_stream.getvalue())
print("Video vec c-profiler complete!")

if __name__ == "__main__":
profile_code()
3 changes: 1 addition & 2 deletions src/api/video_vec_operator_cprofile.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
python video_vec_operator_cprofile.py > output_cprofile.txt
tail -f /dev/null
python video_vec_operator_cprofile.py > output_cprofile.txt
3 changes: 1 addition & 2 deletions src/api/video_vec_operator_profile_memray.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env 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
python -m memray run -o vid_vec_rep_resnet.$current_time.bin video_vec_operator_profile.py
3 changes: 1 addition & 2 deletions src/api/video_vec_operator_profile_pyinstrument.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env 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
pyinstrument -r speedscope -o speedscope_vid_vec_rep_resnet.$current_time.json video_vec_operator_profile.py
1 change: 1 addition & 0 deletions src/api/video_vec_operator_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def find_time():
end_time = time.time()
duration = end_time - start_time
print(f"Time taken - {duration}")
print("Video vec time profile complete!")

if __name__ == "__main__":
find_time()
5 changes: 3 additions & 2 deletions src/api/video_vec_operator_time.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
python video_vec_operator_time.py > output_time.txt
tail -f /dev/null
#!/usr/bin/env bash

python video_vec_operator_time.py > output_time.txt

0 comments on commit 37e768a

Please sign in to comment.