Add rule to makefile time-gen and time.py file
parent
5ae4e0a28d
commit
8113f714de
@ -0,0 +1,56 @@
|
|||||||
|
import numpy as np
|
||||||
|
#from tests.utils.gen_sample import generate
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from FFTMA import gen
|
||||||
|
import time
|
||||||
|
|
||||||
|
def generate(N):
|
||||||
|
start_time = time.time()
|
||||||
|
nx, ny, nz = N,N,N
|
||||||
|
dx, dy, dz = 1.0, 1.0, 1.0
|
||||||
|
seed= 1548762 #rdi(10000,99999)
|
||||||
|
var=1
|
||||||
|
vario=2
|
||||||
|
alpha=1
|
||||||
|
lcx=2
|
||||||
|
lcy=4
|
||||||
|
lcz=16
|
||||||
|
ap1x=1
|
||||||
|
ap1y=0
|
||||||
|
ap1z=0
|
||||||
|
ap2x=0
|
||||||
|
ap2y=1
|
||||||
|
ap2z=0
|
||||||
|
|
||||||
|
v1 = (var, vario, alpha, lcx, lcy, lcz, ap1x, ap1y, ap1z, ap2x, ap2y, ap2z)
|
||||||
|
variograms = [v1]
|
||||||
|
|
||||||
|
mean=15.3245987
|
||||||
|
variance=3.5682389
|
||||||
|
typ=3
|
||||||
|
|
||||||
|
k = gen(nx, ny, nz, dx, dy, dz, seed, variograms, mean, variance, typ)
|
||||||
|
|
||||||
|
duration = time.time() - start_time
|
||||||
|
return k, duration
|
||||||
|
|
||||||
|
N=int(sys.argv[1])
|
||||||
|
SAMPLE_SIZE=100
|
||||||
|
|
||||||
|
def time_measurement(n, sample_size):
|
||||||
|
sample = []
|
||||||
|
|
||||||
|
print(f"SAMPLE_SIZE = {SAMPLE_SIZE}")
|
||||||
|
for i in range(sample_size):
|
||||||
|
_, duration = generate(n)
|
||||||
|
print(i)
|
||||||
|
sample.append(duration)
|
||||||
|
|
||||||
|
npsample = np.array(sample)
|
||||||
|
|
||||||
|
print(f"AVG: {np.mean(npsample)} seconds")
|
||||||
|
print(f"MEDIAN: {np.median(npsample)} seconds")
|
||||||
|
|
||||||
|
time_measurement(N, SAMPLE_SIZE)
|
Loading…
Reference in New Issue