コード例 #1
0
ファイル: test_performance.py プロジェクト: mario007/renmas
from renmas.samplers import RegularSampler, RandomSampler
from renmas.samplers import Sample
import time

rnd = RandomSampler(10, 100, n=10)

sample = Sample()

start = time.clock()
while True:
    sam = rnd.get_sample(sample)
    if sam is None: break
end = time.clock()
print(end - start)
コード例 #2
0
    uint32 have

    #CODE

    mov eax, sam 
    call get_sample
    mov dword [have], eax
    #END
"""


def print_sample(ds, name):
    x, y, temp1, temp2 = ds[name + ".xyxy"]
    print("ASM =   ", "(", ds[name + ".ix"], x, ") (", ds[name + ".iy"], y,
          ") have =", ds["have"])


if __name__ == "__main__":

    runtime = Runtime()

    rnd = RandomSampler(25, 20, n=2)
    rnd.tile(10, 10, 3, 3)
    rnd.get_sample_asm(runtime, "get_sample")

    assembler = util.get_asm()
    mc = assembler.assemble(ASM)
    ds = runtime.load("test", mc)

    print_random(rnd, runtime, ds)
コード例 #3
0
ファイル: test_performance.py プロジェクト: mario007/renmas
from renmas.samplers import RegularSampler, RandomSampler
from renmas.samplers import Sample
import time


rnd = RandomSampler(10, 100, n=10)


sample = Sample()

start = time.clock()
while True:
    sam = rnd.get_sample(sample)
    if sam is None:
        break
end = time.clock()
print(end - start)
コード例 #4
0
ファイル: test_random.py プロジェクト: mario007/renmas
ASM += util.structs("sample") + """
    sample sam 
    uint32 have

    #CODE

    mov eax, sam 
    call get_sample
    mov dword [have], eax
    #END
"""

def print_sample(ds, name):
    x, y, temp1, temp2 = ds[name + ".xyxy"]
    print("ASM =   ", "(",ds[name+".ix"], x, ") (", ds[name+".iy"], y, ") have =", ds["have"])

if __name__ == "__main__":
    
    runtime = Runtime()

    rnd = RandomSampler(25, 20, n=2)
    rnd.tile(10, 10, 3, 3)
    rnd.get_sample_asm(runtime, "get_sample")

    assembler = util.get_asm()
    mc = assembler.assemble(ASM)
    ds = runtime.load("test", mc)

    print_random(rnd, runtime, ds)