~magnusmorton/delayrepay

c41ab9c277cf844cc1de6d490d2b5c472ea57a54 — Magnus Morton 6 months ago ff42318
removed more benchmarks
4 files changed, 0 insertions(+), 138 deletions(-)

D tests/bench_decl.py
D tests/bench_raw.py
D tests/benche2e.py
D tests/benchfft.py
D tests/bench_decl.py => tests/bench_decl.py +0 -50
@@ 1,50 0,0 @@
import sys
import importlib
import timeit

pkg = sys.argv[1]
np = importlib.import_module(pkg)


LAPTOP_MAX = 83361790

DELAY_MAX = 210000000

size = DELAY_MAX
data = np.random.random((size,))

kern = np.ElementwiseKernel(
    'T x',
    'T z',
    '''
    T s = sin(x);
    T c = cos(x);
    z = s * c
    ''',
    'kern1234'
)


kern2 = np.ElementwiseKernel(
    'T x',
    'T z',
    '''
    z = sin(x) * cos(x)
    ''',
    'kern12345'
)
def func():
    kern(data)
    np.cuda.Device().synchronize()

def func2():
    kern2(data)
    np.cuda.Device().synchronize()

#then = perf_counter()
print(min(timeit.repeat(func, repeat=500,number=1)))
#now = perf_counter()

print(min(timeit.repeat(func2, repeat=500,number=1)))

#rint(f"time: {now-then}")

D tests/bench_raw.py => tests/bench_raw.py +0 -47
@@ 1,47 0,0 @@
import sys
import importlib
import timeit

pkg = sys.argv[1]
np = importlib.import_module(pkg)


LAPTOP_MAX = 83361790

DELAY_MAX = 210000000

size = LAPTOP_MAX
data = np.random.random((size,))

kern = np.ElementwiseKernel(
    'T x',
    'T z',
    '''
    T s = sin(x);
    T c = cos(x);
    T l = s * s;
    T r = c * c;
    z = l + r;
    ''',
    'kern1234'
)


# kern = np.ElementwiseKernel(
#     'T x',
#     'T z',
#     '''
#     z = sin(x) * sin(x) + cos(x) * cos(x)
#     ''',
#     'kern12345'
# )
def func():
    kern(data)
    np.cuda.Device().synchronize()


#then = perf_counter()
print(min(timeit.repeat(func, repeat=100,number=1)))
#now = perf_counter()

#rint(f"time: {now-then}")

D tests/benche2e.py => tests/benche2e.py +0 -16
@@ 1,16 0,0 @@
import sys
import importlib
import timeit

pkg = sys.argv[1]
np = importlib.import_module(pkg)


LAPTOP_MAX = 83361790

SPA_MAX = 153000000

size = LAPTOP_MAX
data = np.random.random((size,))

print(np.sin(data) ** 2 + np.cos(data) ** 2)

D tests/benchfft.py => tests/benchfft.py +0 -25
@@ 1,25 0,0 @@
import sys
import importlib
import timeit

pkg = sys.argv[1]
np = importlib.import_module(pkg)


LAPTOP_MAX = 8336179

SPA_MAX = 153000000

size = LAPTOP_MAX
data = np.random.random((size,))

def func():
     temp = np.exp(2j * np.pi * data)
     print(temp)
     np.fft.fft(temp)



print(min(timeit.repeat(func, repeat=100, number=1)))

#rint(f"time: {now-then}")