예제 #1
0
def test_memleak():
    log.info("test_memleak()")
    from pycuda import driver
    #use the first device for this test
    start_free_memory = None
    for i in range(100):
        d = driver.Device(0)
        context = d.make_context(flags=driver.ctx_flags.SCHED_AUTO
                                 | driver.ctx_flags.MAP_HOST)
        if start_free_memory is None:
            start_free_memory, _ = driver.mem_get_info()
        free_memory, total_memory = driver.mem_get_info()
        log.info("%s%% free_memory: %s MB, total_memory: %s MB",
                 str(i).rjust(3), free_memory / 1024 / 1024,
                 total_memory / 1024 / 1024)
        context.pop()
        context.detach()
        w = random.randint(16, 128) * 8
        h = random.randint(16, 128) * 8
        n = random.randint(2, 10)
        test_encoder(encoder_module,
                     options={},
                     dimensions=[(w, h)],
                     n_images=n)

    d = driver.Device(0)
    context = d.make_context(flags=driver.ctx_flags.SCHED_AUTO
                             | driver.ctx_flags.MAP_HOST)
    end_free_memory, _ = driver.mem_get_info()
    context.pop()
    context.detach()
    log.info("memory lost: %s MB",
             (start_free_memory - end_free_memory) / 1024 / 1024)
예제 #2
0
def test_memleak():
    log.info("test_memleak()")
    from pycuda import driver
    #use the first device for this test
    start_free_memory = None
    for i in range(100):
        d = driver.Device(0)
        context = d.make_context(flags=driver.ctx_flags.SCHED_AUTO | driver.ctx_flags.MAP_HOST)
        if start_free_memory is None:
            start_free_memory, _ = driver.mem_get_info()
        free_memory, total_memory = driver.mem_get_info()
        log.info("%s%% free_memory: %s MB, total_memory: %s MB", str(i).rjust(3), free_memory/1024/1024, total_memory/1024/1024)
        context.pop()
        context.detach()
        w = random.randint(16, 128)*8
        h = random.randint(16, 128)*8
        n = random.randint(2, 10)
        test_encoder(encoder_module, options={}, dimensions=[(w, h)], n_images=n)

    d = driver.Device(0)
    context = d.make_context(flags=driver.ctx_flags.SCHED_AUTO | driver.ctx_flags.MAP_HOST)
    end_free_memory, _ = driver.mem_get_info()
    context.pop()
    context.detach()
    log.info("memory lost: %s MB", (start_free_memory-end_free_memory)/1024/1024)
예제 #3
0
def test_reconfigure():
    def reconfigure_cb(encoder):
        frame_no = encoder.get_info().get("frames", 0)
        newq = min(100, max(0, (frame_no * 30) % 110))
        log.info("reconfigure frame %i: set new quality: %s", frame_no, newq)
        encoder.set_encoding_quality(newq)
    test_encoder(encoder_module, n_images=5, after_encode_cb=reconfigure_cb)
예제 #4
0
파일: test_nvenc.py 프로젝트: ljmljz/xpra
def test_reconfigure():
    def reconfigure_cb(encoder):
        frame_no = encoder.get_info().get("frames", 0)
        newq = min(100, max(0, (frame_no * 30) % 110))
        log.info("reconfigure frame %i: set new quality: %s", frame_no, newq)
        encoder.set_encoding_quality(newq)
    test_encoder(encoder_module, n_images=5, after_encode_cb=reconfigure_cb)
예제 #5
0
def test_encode_all_GPUs():
    cuda_devices = encoder_module.get_cuda_devices()
    log("")
    log.info("test_parallel_encode() will test one encoder on each of %s sequentially" % cuda_devices)
    TEST_DIMENSIONS = [(32, 32)]
    for device_id, info in cuda_devices.items():
        options = {"cuda_device" : device_id}
        log("")
        log("**********************************")
        log("**********************************")
        log.info("testing on  %s : %s" % (device_id, info))
        test_encoder(encoder_module, options, TEST_DIMENSIONS)
    log("")
예제 #6
0
def test_encode_all_GPUs():
    cuda_devices = encoder_module.get_cuda_devices()
    log("")
    log.info("test_parallel_encode() will test one encoder on each of %s sequentially" % cuda_devices)
    TEST_DIMENSIONS = [(256, 256)]
    for device_id, info in cuda_devices.items():
        options = {"cuda_device" : device_id}
        log("")
        log("**********************************")
        log("**********************************")
        log.info("testing on  %s : %s" % (device_id, info))
        test_encoder(encoder_module, options, TEST_DIMENSIONS)
    log("")
예제 #7
0
def test_encode_all_GPUs():
    from xpra.codecs.nvenc import encoder as encoder_module   #@UnresolvedImport
    cuda_devices = encoder_module.get_cuda_devices()
    print("")
    print("test_parallel_encode() will test one encoder on each of %s sequentially" % cuda_devices)
    TEST_DIMENSIONS = [(32, 32)]
    for device_id, info in cuda_devices.items():
        options = {"cuda_device" : device_id}
        print("")
        print("**********************************")
        print("**********************************")
        print("testing on  %s : %s" % (device_id, info))
        test_encoder(encoder_module, options, TEST_DIMENSIONS)
    print("")
예제 #8
0
def test_enc_ffmpeg():
    print("test_enc_ffmpeg()")
    from xpra.codecs.enc_ffmpeg import encoder  #@UnresolvedImport
    test_encoder(encoder)
예제 #9
0
def test_enc_xvid():
    print("test_enc_xvid()")
    from xpra.codecs.enc_xvid import encoder #@UnresolvedImport
    test_encoder(encoder)
    test_performance(encoder)
예제 #10
0
def test_encode_one():
    log("")
    log("test_nvenc()")
    test_encoder(encoder_module)
    log("")
예제 #11
0
 def do_test_context_leak():
     N = 50
     info = threading.current_thread()
     for i in range(N):
         log.info("%s of %s (%s)", i, N, info)
         test_encoder(encoder_module)
예제 #12
0
def test_encode_one():
    log("")
    log("test_nvenc()")
    test_encoder(encoder_module)
    log("")
예제 #13
0
 def do_test_context_leak():
     N = 50
     info = threading.current_thread()
     for i in range(N):
         log.info("%s of %s (%s)", i, N, info)
         test_encoder(encoder_module)
예제 #14
0
def test_encode_one():
    log("test_encode_one()")
    test_encoder(encoder_module)
예제 #15
0
def test_nvenc():
    print("test_nvenc()")
    from xpra.codecs.enc_x264 import encoder #@UnresolvedImport
    test_encoder(encoder)
예제 #16
0
def test_encode_one():
    log("test_encode_one()")
    test_encoder(encoder_module)
예제 #17
0
def test_enc_xvid():
    print("test_enc_xvid()")
    from xpra.codecs.xvid import encoder  #@UnresolvedImport
    test_encoder(encoder)
    test_performance(encoder)
예제 #18
0
def test_encode_one():
    from xpra.codecs.nvenc import encoder as encoder_module   #@UnresolvedImport
    print("")
    print("test_nvenc()")
    test_encoder(encoder_module)
    print("")