Example #1
0
            "read_from_fs": False
        },
        {
            "samples": n_samples,
            "backend": "hub:pytorch",
            "read_from_fs": True
        },
        {
            "samples": n_samples,
            "backend": "tensorflow",
            "read_from_fs": False
        },
        {
            "samples": n_samples,
            "backend": "tensorflow",
            "read_from_fs": True
        },
        {
            "samples": n_samples,
            "backend": "hub:tensorflow",
            "read_from_fs": False
        },
        {
            "samples": n_samples,
            "backend": "hub:tensorflow",
            "read_from_fs": True
        },
    ]
    logs = [empty_train_hub(**args) for args in params]
    report(logs)
import helper

helper.load_backends()

code = """
(begin
  (define (grow)
    (set! s (string-append "123" s "456" s "789"))
    (set! s (string-append
              (substring s (quotient (string-length s) 2) (string-length s))
              (substring s 0 (+ 1 (quotient (string-length s) 2)))))
    s)
  (define (trial n)
    (do ((i 0 (+ i 1)))
      ((> (string-length s) n) (string-length s))
      (grow))))
"""

def call_trial(vm):
    vm.eval(vm.compile('(define s "abcdef")'))
    scm = vm.eval(vm.compile('(trial 1000000)'))
    assert vm.fromscheme(scm) == 1048566

bm = Benchmark(title="string-append and substring performance", repeat=10)
for backend in helper.BACKENDS:
    vm = helper.VM(backend=backend)
    vm.eval(vm.compile(code))
    bm.measure(backend, call_trial, vm)

helper.report(bm.report())
Example #3
0
from benchmark import Benchmark
import helper

helper.load_backends()

code = """
(define (tak x y z)
  (if (not (< y x))
      z
      (tak (tak (- x 1) y z)
           (tak (- y 1) z x)
           (tak (- z 1) x y))))
"""


def call_tak(vm):
    for case in [(7, (18, 12, 6)), (15, (30, 15, 9)), (10, (33, 15, 9)),
                 (15, (40, 15, 9))]:
        scm = vm.apply(vm.get("tak"), [vm.toscheme(x) for x in case[1]])
        assert vm.fromscheme(scm) == case[0]


bm = Benchmark(title="tak benchmark", repeat=1)
for backend in helper.BACKENDS:
    vm = helper.VM(backend=backend)
    vm.eval(vm.compile(code))
    bm.measure(backend, call_tak, vm)

helper.report(bm.report())
Example #4
0
        "download": t3 - t2,
        "write_to_fs": t1 - t0,
    }


def upload_and_download(samples=30, chunksize=None, name="hub"):
    """
    Uploads dataset into S3 and then downlods using hub package
    """
    ds = generate_dataset([(samples, 256, 256), (samples, 256, 256)],
                          chunksize=1)
    t1 = time.time()
    ds = ds.store(f"{BUCKET}/transfer/upload")
    t2 = time.time()
    ds.store("/tmp/download")
    t3 = time.time()
    return {"name": name, "upload": t2 - t1, "download": t3 - t2}


if __name__ == "__main__":
    samples = 64
    chunksize = None
    import hub

    hub.init(processes=True, n_workers=8, threads_per_worker=1)

    r1 = upload_and_download(samples, chunksize=chunksize)
    r2 = aws_cli_copy(samples, chunksize=chunksize)

    report([r1, r2])
Example #5
0
def send_story_report(story_to_read):
    item = story_to_read
    reported_by = session['username']
    report_reason = request.form["reason"]
    report(item, report_reason, story_to_read, reported_by)
    return redirect(url_for("admin_page"))
Example #6
0
from helper import report
"""
Daily report
- positions
- balance 
- Margin balance
- Unrealized PNL
"""

if __name__ == '__main__':
    report()