Configuring Dedalus numerics, logging, and runtime behavior
Dedalus provides extensive configuration options for controlling numerics, logging, parallelism, and output behavior. Configuration is managed through Python’s standard ConfigParser interface.
[logging]# Available levels: {debug, info, warning, error, critical}# Log level for non-root processes (rank > 0)nonroot_level = warning# Log level for stdout handler# Use 'none' to disablestdout_level = info# Log level for file handler# Use 'none' to disablefile_level = none# Log filename base (expands to <filename>_p0.log, etc)filename = logs/dedalus
Basic Logging
File Logging
Debug Mode
Quiet Mode
from dedalus.tools.config import configimport logging# Console output only (default)config['logging']['stdout_level'] = 'info'config['logging']['file_level'] = 'none'
from dedalus.tools.config import config# Save logs to filesconfig['logging']['file_level'] = 'debug'config['logging']['filename'] = 'logs/my_simulation'# Creates: logs/my_simulation_p0.log, logs/my_simulation_p1.log, ...
from dedalus.tools.config import config# Verbose output for debuggingconfig['logging']['stdout_level'] = 'debug'config['logging']['nonroot_level'] = 'info' # See all ranks
from dedalus.tools.config import config# Minimal outputconfig['logging']['stdout_level'] = 'warning'config['logging']['nonroot_level'] = 'error'
[parallelism]# Default transpose library (fftw, mpi)TRANSPOSE_LIBRARY = fftw# Place MPI Barriers before each transpose callSYNC_TRANSPOSES = False# Transpose multiple fields together when possibleGROUP_TRANSPOSES = True
FFTW Transposes
Recommended for most systemsUses FFTW’s MPI transpose routines.
TRANSPOSE_LIBRARY = fftw
MPI Transposes
Alternative implementationUses direct MPI all-to-all communication.
[matrix construction]# Put BC rows at the top of the matrixBC_TOP = False# Put tau columns at the left of the matrixTAU_LEFT = False# Interleave component modesINTERLEAVE_COMPONENTS = False# Store expanded LHS matrices# Speeds up IVP matrix factorization at the expense of extra memorySTORE_EXPANDED_MATRICES = False
Set STORE_EXPANDED_MATRICES = True if you have sufficient memory and want faster timestepping at the cost of higher memory usage.
[memory]# Store output fields for all operatorsSTORE_OUTPUTS = True# Cache operator evaluation for repeated use in expression graphSTORE_LAST_DEFAULT = True
Disabling STORE_OUTPUTS or STORE_LAST_DEFAULT will reduce memory usage but may significantly slow down simulations.
[analysis]# Default filehandler mode (overwrite, append)FILEHANDLER_MODE_DEFAULT = overwrite# Default filehandler parallel output method (gather, virtual, mpio)FILEHANDLER_PARALLEL_DEFAULT = virtual# Force filehandlers to touch a tmp file on each node# This works around NFS caching issuesFILEHANDLER_TOUCH_TMPFILE = False
overwrite (default)
append
FILEHANDLER_MODE_DEFAULT = overwrite
Each simulation run deletes previous output and starts fresh.
FILEHANDLER_MODE_DEFAULT = append
Continue writing to existing output files. Useful for restarting simulations.
See Output Format for details on parallel I/O modes.
[profiling]# Default profile setting for solvers# This saves accumulated profiling data using cProfilePROFILE_DEFAULT = False# Default parallel profile setting for solvers# This saves per-process and accumulated profiling dataPARALLEL_PROFILE_DEFAULT = False# Profile directory base (expands to <PROFILE_DIRECTORY>/runtime.prof, etc)PROFILE_DIRECTORY = profiles
Enable profiling for performance analysis:
from dedalus.tools.config import configconfig['profiling']['PROFILE_DEFAULT'] = 'True'config['profiling']['PROFILE_DIRECTORY'] = 'my_profiles'# After simulation, analyze with:# python -m cProfile -s cumulative my_profiles/runtime.prof
from dedalus.tools.config import config# Reduce memory usageconfig['matrix construction']['STORE_EXPANDED_MATRICES'] = 'False'config['memory']['STORE_OUTPUTS'] = 'False' # Warning: May slow downconfig['analysis']['FILEHANDLER_PARALLEL_DEFAULT'] = 'gather' # Less disk space
from dedalus.tools.config import configimport logginglogger = logging.getLogger(__name__)# Print specific settinglogger.info(f"Transform library: {config['transforms']['DEFAULT_LIBRARY']}")logger.info(f"Transpose library: {config['parallelism']['TRANSPOSE_LIBRARY']}")# Print all settings in a sectionfor key, value in config['logging'].items(): logger.info(f"{key} = {value}")