-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72bd171
commit f43646b
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from multiprocessing import Process | ||
from multiprocessing import cpu_count | ||
from core.operators import vid_vec_rep_resnet | ||
import time | ||
|
||
|
||
def find_time(): | ||
file_path = {"path": r"core/operators/sample_data/sample-cat-video.mp4"} | ||
start_time = time.time() | ||
vid_vec_rep_resnet.run(file_path) | ||
end_time = time.time() | ||
duration = end_time - start_time | ||
print(f"Time taken - {duration}") | ||
print("Video vec time profile complete!") | ||
|
||
|
||
N = 1 | ||
total_cores = cpu_count() | ||
|
||
print("number of cpus: ", cpu_count()) | ||
print("distribute test on", int(total_cores / N), "cores") | ||
|
||
processes = [] | ||
|
||
vid_vec_rep_resnet.initialize(param=None) | ||
|
||
for core in range(int(total_cores / N)): | ||
proc = Process(target=find_time) | ||
processes.append(proc) | ||
proc.start() | ||
|
||
for proc in processes: | ||
proc.join() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
python video_vec_operator_multicore.py > output_multicore.txt | ||
tail -f /dev/null |