From 7dbcc26582ebee080d67abccccf6e2b601c3bc43 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Mon, 6 Mar 2023 06:52:28 -0800 Subject: [PATCH] fix up external tests --- test/external/external_osx_profiling.py | 16 ++++++---------- test/external/external_test_llvm.py | 14 +------------- test/models/test_efficientnet.py | 1 - 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/test/external/external_osx_profiling.py b/test/external/external_osx_profiling.py index af8014cc4f..83cb2677b8 100644 --- a/test/external/external_osx_profiling.py +++ b/test/external/external_osx_profiling.py @@ -1,7 +1,6 @@ -from tinygrad.runtime.opencl import CLProgram, CL, CLBuffer +from tinygrad.runtime.ops_gpu import CLProgram, CL, CLBuffer import time - N = 1000000 a = CLBuffer(N*4) b = CLBuffer(N*4) @@ -11,16 +10,16 @@ prg = CLProgram("test", """__kernel void test(__global float *a, __global float int idx = get_global_id(0); a[idx] = b[idx] + c[idx]; }""") -prg.clprg(CL().cl_queue, [N,], None, a._cl, b._cl, c._cl) +prg.clprg(CL.cl_queue, [N,], None, a._cl, b._cl, c._cl) t1 = time.monotonic_ns() -e1 = prg.clprg(CL().cl_queue, [N,], None, a._cl, b._cl, c._cl) -CL().cl_queue.finish() # type: ignore +e1 = prg.clprg(CL.cl_queue, [N,], None, a._cl, b._cl, c._cl) +CL.cl_queue.finish() # type: ignore t2 = time.monotonic_ns() time.sleep(3) t3 = time.monotonic_ns() -e2 = prg.clprg(CL().cl_queue, [N,], None, a._cl, b._cl, c._cl) -CL().cl_queue.finish() # type: ignore +e2 = prg.clprg(CL.cl_queue, [N,], None, a._cl, b._cl, c._cl) +CL.cl_queue.finish() # type: ignore t4 = time.monotonic_ns() print(e1.profile.queued) @@ -40,6 +39,3 @@ print(e1.profile.start) print(e1.profile.end) print(e2.profile.start) print(e2.profile.end) - -import pdb -pdb.set_trace() diff --git a/test/external/external_test_llvm.py b/test/external/external_test_llvm.py index 8280ee743d..e332d27a52 100644 --- a/test/external/external_test_llvm.py +++ b/test/external/external_test_llvm.py @@ -2,7 +2,7 @@ import unittest import numpy as np from tinygrad.ops import LazyOp, BinaryOps, ReduceOps -from accel.llvm.ops_llvm import LLVMBuffer +from tinygrad.runtime.ops_llvm import LLVMBuffer class TestLLVM(unittest.TestCase): def test_add(self): @@ -44,17 +44,5 @@ class TestLLVM(unittest.TestCase): ret = LLVMBuffer((1,1)).exec_ast(ast) print(ret.toCPU()) - - if __name__ == "__main__": unittest.main() - - """ - ast = LazyOp(BinaryOps.ADD, (a,b)) - ast = LazyOp(ReduceOps.SUM, (ast,), (1,1)) - ret = LLVMBuffer((4,4)).exec_ast(ast) - print(ret.toCPU()) - """ - - - diff --git a/test/models/test_efficientnet.py b/test/models/test_efficientnet.py index fcee5a05b2..709cec9ae6 100644 --- a/test/models/test_efficientnet.py +++ b/test/models/test_efficientnet.py @@ -14,7 +14,6 @@ def _load_labels(): labels_filename = pathlib.Path(__file__).parent / 'efficientnet/imagenet1000_clsidx_to_labels.txt' return ast.literal_eval(labels_filename.read_text()) - _LABELS = _load_labels() def preprocess(img, new=False):