utils

utils#

Module: fridom.framework.utils

Classes, Functions, and Variables

I_AM_MAIN_RANK

bool(x) -> bool

MPI_AVAILABLE

bool(x) -> bool

mpi_barrier()

Barrier synchronization for MPI.

get_mpi_size()

Get the number of MPI processes.

get_my_rank()

Get the rank of the current MPI process.

print_bar([char])

Print a bar to the log file.

print_job_init_info()

Print the job starting time and the number of MPI processes.

humanize_length(value)

Format a length in human readable format [mm, cm, m, km].

humanize_time(value)

Format a time in human readable format.

humanize_number(value, unit)

Format a number in human readable format.

chdir_to_submit_dir()

Change the current working directory to the directory where the job was submitted.

stdout_is_file()

Check if the standard output is a file.

SliceableAttribute(slicer)

Class to make an object sliceable.

modify_array(arr, where, value)

Return a new array with the modifications.

random_array(shape[, seed])

Create a random array.

array_is_constant(arr)

Check if an array is constant.

to_numpy(obj[, memo, _nil])

Creates a deep copy of an object with all arrays converted to numpy.

to_seconds(t)

Convert a time to seconds.

jaxjit(fun, *args, **kwargs)

Decorator for JAX JIT compilation.

jaxify(cls[, dynamic])

Add JAX pytree support to a class (for jit compilation).

inspect_jitted_function(func, args)

Inspect if a jit compiled function has communication operations.

free_memory()

This function deletes all live buffers in the JAX backend.

skip_on_doc_build(func)

Skip a function when building the documentation.

cache_figure(func[, name, force_recompute, dpi])

Cache a figure to disk, if it exists return the image from disk.

Utility functions and classes for the FRIDOM framework.