-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run_loop_fusion_test.py: added basic automation and comparison
test_loop_fusion.py: Cleaned up format
- Loading branch information
1 parent
9eb72b4
commit 3563f68
Showing
2 changed files
with
43 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import io | ||
import subprocess | ||
import time | ||
from contextlib import redirect_stdout | ||
|
||
|
||
def main(): | ||
cwd = os.getcwd() | ||
subprocess.run(["rm", "-rf", "pk_cpp"], cwd=cwd) | ||
|
||
try: | ||
del os.environ["PK_LOOP_FUSE"] | ||
except Exception as e: | ||
print("TRIED DELETING ENV VARIABLE, BUT FAILED:\n", e) | ||
|
||
result_vanilla = subprocess.run(["python", "test_loop_fusion.py"], cwd=cwd, capture_output=True, text=True) | ||
|
||
# get output | ||
vanilla_out = result_vanilla.stdout | ||
|
||
# Again but with env variable | ||
os.environ["PK_LOOP_FUSE"] = "1" | ||
# remove old compilations | ||
subprocess.run(["rm", "-rf", "pk_cpp"], cwd=cwd) | ||
|
||
print("rerunning... ") | ||
result_fused = subprocess.run(["python", "test_loop_fusion.py"], cwd=cwd, capture_output=True, text=True) | ||
|
||
fused_out = result_fused.stdout | ||
|
||
if vanilla_out != fused_out: | ||
print("[X] MISMATCHED OUTPUTS:") | ||
print("\t[-] WITHOUT FUSION:") | ||
print(vanilla_out) | ||
print("\n\t[+] WITH FUSION:") | ||
print(fused_out) | ||
|
||
if __name__ == "__main__": | ||
main() |
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