예제 #1
0
파일: 2d_1block.py 프로젝트: hyln9/sailfish
def run_benchmark(boundary_split=True, suffix=""):
    settings = {"mode": "benchmark", "max_iters": 1000, "every": 500, "blocks": 1, "quiet": True}

    mem_size = 2 ** 32 - 2 ** 28  # assume 4G - 256M memory size
    node_cost = (2 * 9 + 4) * 4  # node cost in bytes
    fmt = ["%d", "%d", "%d", "%.6e", "%.6e", "%.6e", "%.6e"]

    def test_sizes(sizes):
        for w, h in sizes:
            print "Testing {0} x {1}...".format(w, h)
            settings.update({"lat_nx": int(w), "lat_ny": int(h)})
            ctrl = LBSimulationController(LDCSim, LBGeometry2D, settings)
            timing_infos, blocks = ctrl.run()
            summary.append(util.summarize(timing_infos, blocks))
            timings.append(timing_infos)

    summary = []
    timings = []
    h = np.logspace(6, 15, 10, base=2).astype(np.uint32)
    w = mem_size / node_cost / h / 2
    sizes = [(x, y) for x, y in zip(w, h)]
    test_sizes(sizes)
    np.savetxt("2d_1block_x{0}.dat".format(suffix), summary, fmt)
    util.save_timing("2d_1block_x{0}.timing".format(suffix), timings)

    print "---"

    summary = []
    timings = []
    w = np.logspace(10, 17, 8, base=2).astype(np.uint32) - 4
    h = mem_size / node_cost / w / 2
    sizes = [(x, y) for x, y in zip(w, h)]
    test_sizes(sizes)
    np.savetxt("2d_1block_y{0}.dat".format(suffix), summary, fmt)
    util.save_timing("2d_1block_y{0}.timing".format(suffix), timings)
예제 #2
0
def run_benchmark(boundary_split=True, suffix=''):
    settings = {
            'mode': 'benchmark',
            'max_iters': 1000,
            'every': 500,
            'blocks': 2,
            'quiet': True,
            'gpus': [0,1],
            'bulk_boundary_split': boundary_split,
        }

    mem_size = 2**32 - 2**28        # assume 4G - 256M memory size
    node_cost = (2 * 9 + 4) * 4     # node cost in bytes
    fmt = ['%d', '%d', '%d', '%.6e', '%.6e', '%.6e', '%.6e']

    def test_sizes(sizes, geo_cls):
        for w, h in sizes:
            print 'Testing {0} x {1}...'.format(w, h)
            settings.update({'lat_nx': int(w), 'lat_ny': int(h)})
            ctrl = LBSimulationController(LDCSim, geo_cls, settings)
            timing_infos, blocks = ctrl.run()
            summary.append(util.summarize(timing_infos, blocks))
            timings.append(timing_infos)

    summary = []
    timings = []
    h = np.logspace(6, 15, 10, base=2).astype(np.uint32)
    w = mem_size / node_cost / h
    sizes = [(x, y) for x, y in zip(w, h)]
    test_sizes(sizes, BenchmarkXConnGeometry)
    np.savetxt('2d_2blocks_x{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('2d_2blocks_x{0}.timing'.format(suffix), timings)

    print '---'

    summary = []
    timings = []
    w = np.logspace(10, 17, 8, base=2).astype(np.uint32) - 4
    h = mem_size / node_cost / w
    sizes = [(x, y) for x, y in zip(w, h)]
    test_sizes(sizes, BenchmarkYConnGeometry)
    np.savetxt('2d_2blocks_y{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('2d_2blocks_y{0}.timing'.format(suffix), timings)
예제 #3
0
def run_benchmark(boundary_split=True, suffix=''):
    settings = {
        'mode': 'benchmark',
        'max_iters': 1000,
        'every': 500,
        'blocks': 2,
        'quiet': True,
        'gpus': [0, 1],
        'bulk_boundary_split': boundary_split,
    }

    mem_size = 2**32 - 2**28  # assume 4G - 256M memory size
    node_cost = (2 * 9 + 4) * 4  # node cost in bytes
    fmt = ['%d', '%d', '%d', '%.6e', '%.6e', '%.6e', '%.6e']

    def test_sizes(sizes, geo_cls):
        for w, h in sizes:
            print 'Testing {0} x {1}...'.format(w, h)
            settings.update({'lat_nx': int(w), 'lat_ny': int(h)})
            ctrl = LBSimulationController(LDCSim, geo_cls, settings)
            timing_infos, blocks = ctrl.run()
            summary.append(util.summarize(timing_infos, blocks))
            timings.append(timing_infos)

    summary = []
    timings = []
    h = np.logspace(6, 15, 10, base=2).astype(np.uint32)
    w = mem_size / node_cost / h
    sizes = [(x, y) for x, y in zip(w, h)]
    test_sizes(sizes, BenchmarkXConnGeometry)
    np.savetxt('2d_2blocks_x{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('2d_2blocks_x{0}.timing'.format(suffix), timings)

    print '---'

    summary = []
    timings = []
    w = np.logspace(10, 17, 8, base=2).astype(np.uint32) - 4
    h = mem_size / node_cost / w
    sizes = [(x, y) for x, y in zip(w, h)]
    test_sizes(sizes, BenchmarkYConnGeometry)
    np.savetxt('2d_2blocks_y{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('2d_2blocks_y{0}.timing'.format(suffix), timings)
예제 #4
0
def run_benchmark(boundary_split=True, suffix=''):
    settings = {
            'mode': 'benchmark',
            'max_iters': 1000,
            'every': 500,
            'blocks': 2,
            'quiet': True,
            'grid': 'D3Q19',
            'gpus': [0, 1],
            'bulk_boundary_split': boundary_split,
        }

    fmt = ['%d', '%d', '%d', '%d', '%.6e', '%.6e', '%.6e', '%.6e']

    mem_size = 2**32 - 2**29        # assume 4G - 256M of memory
    node_cost = (2 * 19 + 4) * 4    # node cost in bytes

    def test_sizes(sizes, geo_cls):
        for w, h, d in sizes:
            print 'Testing {0} x {1} x {2}...'.format(w, h, d)
            settings.update({'lat_nx': int(w), 'lat_ny': int(h), 'lat_nz': int(d)})
            ctrl = LBSimulationController(LDCSim, geo_cls, settings)
            timing_infos, blocks = ctrl.run()
            summary.append(util.summarize(timing_infos, blocks))
            timings.append(timing_infos)

    summary = []
    timings = []

    # 'h' x 'd' is the connection surface
    #####################################
    w = np.uint32(range(2, 18, 2)) * 64 - 4
    h = np.uint32([128] * len(w))
    d = mem_size / node_cost / w / h
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]

    test_sizes(sizes, BenchmarkXConnGeometry)
    np.savetxt('3d_2blocks_x_v1{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_x_v1{0}.timing'.format(suffix), timings)

    # Same as above, but the 'z' dimension is varied.  Should give the same
    # results as when the 'y' dimension is varied.
    d = np.uint32([128] * len(w))
    h = mem_size / node_cost / w / d
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]
    summary = []
    timings = []

    test_sizes(sizes, BenchmarkXConnGeometry)
    np.savetxt('3d_2blocks_x_v2{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_x_v2{0}.timing'.format(suffix), timings)

    # 'w' x 'd' is the connection surface
    #####################################
    d = np.uint32([128] * len(w))
    h = mem_size / node_cost / w / d
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]
    summary = []
    timings = []

    test_sizes(sizes, BenchmarkYConnGeometry)
    np.savetxt('3d_2blocks_y{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_y{0}.timing'.format(suffix), timings)

    # 'w' x 'h' is the connection surface
    #####################################
    h = np.uint32([128] * len(w))
    d = mem_size / node_cost / w / h
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]
    summary = []
    timings = []

    test_sizes(sizes, BenchmarkZConnGeometry)
    np.savetxt('3d_2blocks_z{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_z{0}.timing'.format(suffix), timings)
예제 #5
0
def run_benchmark(boundary_split=True, suffix=''):
    settings = {
        'mode': 'benchmark',
        'max_iters': 1000,
        'every': 500,
        'blocks': 2,
        'quiet': True,
        'grid': 'D3Q19',
        'gpus': [0, 1],
        'bulk_boundary_split': boundary_split,
    }

    fmt = ['%d', '%d', '%d', '%d', '%.6e', '%.6e', '%.6e', '%.6e']

    mem_size = 2**32 - 2**29  # assume 4G - 256M of memory
    node_cost = (2 * 19 + 4) * 4  # node cost in bytes

    def test_sizes(sizes, geo_cls):
        for w, h, d in sizes:
            print 'Testing {0} x {1} x {2}...'.format(w, h, d)
            settings.update({
                'lat_nx': int(w),
                'lat_ny': int(h),
                'lat_nz': int(d)
            })
            ctrl = LBSimulationController(LDCSim, geo_cls, settings)
            timing_infos, blocks = ctrl.run()
            summary.append(util.summarize(timing_infos, blocks))
            timings.append(timing_infos)

    summary = []
    timings = []

    # 'h' x 'd' is the connection surface
    #####################################
    w = np.uint32(range(2, 18, 2)) * 64 - 4
    h = np.uint32([128] * len(w))
    d = mem_size / node_cost / w / h
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]

    test_sizes(sizes, BenchmarkXConnGeometry)
    np.savetxt('3d_2blocks_x_v1{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_x_v1{0}.timing'.format(suffix), timings)

    # Same as above, but the 'z' dimension is varied.  Should give the same
    # results as when the 'y' dimension is varied.
    d = np.uint32([128] * len(w))
    h = mem_size / node_cost / w / d
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]
    summary = []
    timings = []

    test_sizes(sizes, BenchmarkXConnGeometry)
    np.savetxt('3d_2blocks_x_v2{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_x_v2{0}.timing'.format(suffix), timings)

    # 'w' x 'd' is the connection surface
    #####################################
    d = np.uint32([128] * len(w))
    h = mem_size / node_cost / w / d
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]
    summary = []
    timings = []

    test_sizes(sizes, BenchmarkYConnGeometry)
    np.savetxt('3d_2blocks_y{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_y{0}.timing'.format(suffix), timings)

    # 'w' x 'h' is the connection surface
    #####################################
    h = np.uint32([128] * len(w))
    d = mem_size / node_cost / w / h
    sizes = [(x, y, z) for x, y, z in zip(w, h, d)]
    summary = []
    timings = []

    test_sizes(sizes, BenchmarkZConnGeometry)
    np.savetxt('3d_2blocks_z{0}.dat'.format(suffix), summary, fmt)
    util.save_timing('3d_2blocks_z{0}.timing'.format(suffix), timings)