示例#1
0
        times["gather cl.Array -> np.ndarray"] = \
            timer(lambda: mpi.gather_array(queue, subdata, data_h, 0), ntime=ntime)
        times["gather np.ndarray -> cl.Array"] = \
            timer(lambda: mpi.gather_array(queue, sub_h, data, 0), ntime=ntime)
        times["gather np.ndarray -> np.ndarray"] = \
            timer(lambda: mpi.gather_array(queue, sub_h, data_h, 0), ntime=ntime)

        if mpi.rank == 0:
            print(f"{grid_shape=}, {h=}, {proc_shape=}")
            for key, val in times.items():
                print(f"{key} took {val:.3f} ms")


if __name__ == "__main__":
    from common import parser
    parser.add_argument("--pass_grid_shape", type=bool, default=True)
    args = parser.parse_args()

    test_share_halos(ps.choose_device_and_make_context,
                     grid_shape=args.grid_shape,
                     proc_shape=args.proc_shape,
                     h=args.h,
                     dtype=args.dtype,
                     timing=args.timing,
                     pass_grid_shape=args.pass_grid_shape,
                     _grid_shape=None)
    test_gather_scatter(ps.choose_device_and_make_context,
                        grid_shape=args.grid_shape,
                        proc_shape=args.proc_shape,
                        h=args.h,
                        dtype=args.dtype,
示例#2
0
    from itertools import product
    for (a, input_), (b, output) in product(fx_types.items(),
                                            fk_types.items()):
        t = timer(lambda: fft.dft(input_, output), ntime=ntime)
        if mpi.rank == 0:
            print(f"dft({a}, {b}) took {t:.3f} ms")

    for (a, input_), (b, output) in product(fk_types.items(),
                                            fx_types.items()):
        t = timer(lambda: fft.idft(input_, output), ntime=ntime)
        if mpi.rank == 0:
            print(f"idft({a}, {b}) took {t:.3f} ms")


if __name__ == "__main__":
    from common import parser
    parser.add_argument("--use-fftw", action="store_true")
    args = parser.parse_args()
    if np.product(args.proc_shape) > 1:
        args.use_fftw = True

    test_dft(
        ps.choose_device_and_make_context,
        grid_shape=args.grid_shape,
        proc_shape=args.proc_shape,
        dtype=args.dtype,
        use_fftw=args.use_fftw,
        timing=args.timing,
    )
示例#3
0
    # Warn if any imports did not finish
    unfinished = status - set(['FINISHED'])
    if len(unfinished):
        log.yaml('Warning, some meshes', unfinished)


def main(arg, versions):
    # Open the scene
    bpy.ops.common.start(blend=arg.blend)

    # Import the meshes
    pather.unlink(arg)
    import_all(versions, arg)
    pather.unlink(arg)

    # Stop the scene
    bpy.ops.common.stop(blend=arg.blend, output=arg.output)


if __name__ == "__main__":
    describe = 'Import mesh files.'
    filename = os.path.basename(__file__)
    # Get argument parser
    cmd = parser.setup(filename, describe)
    parser.add_argument(cmd, 'tmp')
    # Get most recent version
    versions = semver.all()
    semver.setup(versions)
    # Run everything safely
    err.wrap(cmd, main, versions)
示例#4
0
    scene.frame_end = task_end
    # Add task to path
    task_file = '{:010d}'.format(task)
    task_out = os.path.join(arg.output, task_file)

    print(task_out, task_start, task_end)
    return
    # Stop the scene
    bpy.ops.common.stop(**{
        'output': arg.output,
        'movie': True,
    })


if __name__ == "__main__":
    describe = 'Set up the scene.'
    filename = os.path.basename(__file__)
    # Get argument parser
    items = [
        'blend',
        'output',
    ]
    cmd = parser.setup(filename, describe, items)
    parser.add_argument(cmd, 'task')
    parser.add_argument(cmd, 'runs')
    # Get most recent version
    versions = semver.all()
    semver.setup(versions)
    # Run everything safely
    err.wrap(cmd, main, versions)
示例#5
0
文件: scroll.py 项目: afcarl/3dxp
            mover.slice_w_z(p, w_z, 0)

    register(handle_frame)
    # Stop the scene
    bpy.ops.common.stop(**{
        'blend': arg.blend,
        'output': arg.output,
        'movie': True,
    })


if __name__ == "__main__":
    describe = 'Set up the scene.'
    filename = os.path.basename(__file__)
    # Get argument parser
    items = [
        'blend',
        'output',
        'um/VOL',
        'um/XYZ',
    ]
    cmd = parser.setup(filename, describe, items)
    parser.add_argument(cmd, 'zspan')
    parser.add_argument(cmd, 'zps')
    parser.add_argument(cmd, 'fps')
    # Get most recent version
    versions = semver.all()
    semver.setup(versions)
    # Run everything safely
    err.wrap(cmd, main, versions)