fix up external tests

This commit is contained in:
George Hotz
2023-03-06 06:52:28 -08:00
parent 50012f679b
commit 7dbcc26582
3 changed files with 7 additions and 24 deletions

View File

@@ -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()

View File

@@ -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())
"""

View File

@@ -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):