mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-21 14:50:36 +08:00
move benchmarks to separate directory
Summary: Move benchmarks to a separate directory as tests/ is getting big. Reviewed By: nikhilaravi Differential Revision: D32885462 fbshipit-source-id: a832662a494ee341ab77d95493c95b0af0a83f43
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a6508ac3df
commit
a0e2d2e3c3
38
tests/benchmarks/bm_main.py
Executable file
38
tests/benchmarks/bm_main.py
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from os.path import dirname, isfile, join
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# pyre-ignore[16]
|
||||
if len(sys.argv) > 1:
|
||||
# Parse from flags.
|
||||
# pyre-ignore[16]
|
||||
file_names = [
|
||||
join(dirname(__file__), n) for n in sys.argv if n.startswith("bm_")
|
||||
]
|
||||
else:
|
||||
# Get all the benchmark files (starting with "bm_").
|
||||
bm_files = glob.glob(join(dirname(__file__), "bm_*.py"))
|
||||
file_names = sorted(
|
||||
f for f in bm_files if isfile(f) and not f.endswith("bm_main.py")
|
||||
)
|
||||
|
||||
# Forward all important path information to the subprocesses through the
|
||||
# environment.
|
||||
os.environ["PATH"] = sys.path[0] + ":" + os.environ.get("PATH", "")
|
||||
os.environ["LD_LIBRARY_PATH"] = (
|
||||
sys.path[0] + ":" + os.environ.get("LD_LIBRARY_PATH", "")
|
||||
)
|
||||
os.environ["PYTHONPATH"] = ":".join(sys.path)
|
||||
for file_name in file_names:
|
||||
subprocess.check_call([sys.executable, file_name])
|
||||
Reference in New Issue
Block a user