How to use the pyuvsim.profiling.prof function in pyuvsim

To help you get started, we’ve selected a few pyuvsim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / uvsim.py View on Github external
# above will need to stay until this issue is resolved (see profiling.py).
        task_inds = np.array(list(summed_task_dict.keys()))
        bl_inds = task_inds[:, 0] % Nbls
        time_inds = (task_inds[:, 0] - bl_inds) // Nbls
        Ntimes_loc = np.unique(time_inds).size
        Nbls_loc = np.unique(bl_inds).size
        Nfreqs_loc = np.unique(task_inds[:, 2]).size
        axes_dict = {
            'Ntimes_loc': Ntimes_loc,
            'Nbls_loc': Nbls_loc,
            'Nfreqs_loc': Nfreqs_loc,
            'Nsrcs_loc': Nsky_parts,
            'prof_rank': prof.rank
        }

        with open(prof.meta_file, 'w') as afile:
            for k, v in axes_dict.items():
                afile.write("{} \t {:d}\n".format(k, int(v)))

    # All the sources in this summed list are foobar-ed
    # Source are summed over but only have 1 name
    # Some source may be correct
    summed_local_task_list = list(summed_task_dict.values())
    # Tasks contain attributes that are not pickle-able.
    # Remove everything except uvdata_index and visibility_vector
    for task in summed_local_task_list:
        del task.time
        del task.freq
        del task.freq_i
        del task.sources
        del task.baseline
        del task.telescope
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / uvsim.py View on Github external
count.next()
        if rank == 0 and not quiet:
            pbar.update(count.current_value())

    comm.Barrier()
    count.free()
    if rank == 0 and not quiet:
        pbar.finish()

    if rank == 0 and not quiet:
        print("Calculations Complete.", flush=True)

    # If profiling is active, save meta data:
    from .profiling import prof     # noqa
    if hasattr(prof, 'meta_file'):  # pragma: nocover
        # Saving axis sizes on current rank (local) and for the whole job (global).
        # These lines are affected by issue 179 of line_profiler, so the nocover
        # above will need to stay until this issue is resolved (see profiling.py).
        task_inds = np.array(list(summed_task_dict.keys()))
        bl_inds = task_inds[:, 0] % Nbls
        time_inds = (task_inds[:, 0] - bl_inds) // Nbls
        Ntimes_loc = np.unique(time_inds).size
        Nbls_loc = np.unique(bl_inds).size
        Nfreqs_loc = np.unique(task_inds[:, 2]).size
        axes_dict = {
            'Ntimes_loc': Ntimes_loc,
            'Nbls_loc': Nbls_loc,
            'Nfreqs_loc': Nfreqs_loc,
            'Nsrcs_loc': Nsky_parts,
            'prof_rank': prof.rank
        }
github RadioAstronomySoftwareGroup / pyuvsim / scripts / run_param_pyuvsim.py View on Github external
args.paramsfile = os.path.join('.', args.paramsfile)

t0 = pytime.time()

pyuvsim.uvsim.run_uvsim(args.paramsfile, quiet=args.quiet)

if args.profile:
    dt = pytime.time() - t0
    maxrss = pyuvsim.mpi.get_max_node_rss()
    rtime = str(timedelta(seconds=dt))
    if isinstance(maxrss, float):
        print('\tRuntime: {} \n\tMaxRSS: {:.3f} GiB'.format(
            rtime, maxrss
        ))
    if hasattr(pyuvsim.profiling.prof, 'meta_file'):
        with open(pyuvsim.profiling.prof.meta_file, 'a') as afile:
            afile.write("Runtime \t {}\nMaxRSS \t {:.3f}\n".format(rtime, maxrss))
            afile.write("Date/Time \t {}".format(str(datetime.now())))
github RadioAstronomySoftwareGroup / pyuvsim / scripts / run_param_pyuvsim.py View on Github external
if not os.path.isdir(os.path.dirname(args.paramsfile)):
    args.paramsfile = os.path.join('.', args.paramsfile)

t0 = pytime.time()

pyuvsim.uvsim.run_uvsim(args.paramsfile, quiet=args.quiet)

if args.profile:
    dt = pytime.time() - t0
    maxrss = pyuvsim.mpi.get_max_node_rss()
    rtime = str(timedelta(seconds=dt))
    if isinstance(maxrss, float):
        print('\tRuntime: {} \n\tMaxRSS: {:.3f} GiB'.format(
            rtime, maxrss
        ))
    if hasattr(pyuvsim.profiling.prof, 'meta_file'):
        with open(pyuvsim.profiling.prof.meta_file, 'a') as afile:
            afile.write("Runtime \t {}\nMaxRSS \t {:.3f}\n".format(rtime, maxrss))
            afile.write("Date/Time \t {}".format(str(datetime.now())))