From 04299b9644ce509fb2048cd2782d5b4edfd4885b Mon Sep 17 00:00:00 2001 From: Ashton Wiersdorf Date: Mon, 14 Oct 2024 23:49:00 -0600 Subject: [PATCH] Finish naming migration --- README.md | 10 +++++----- src/Config.jl | 14 +++++++------- src/TrackedFloats.jl | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ec9ab00..784d8a8 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This tool may be useful for debugging those sorts of issues. ## Usage - 1. Call `using TrackedFloats`; you may want to include functions like `enable_nan_injection` or `tf_config_logger` or the like. (See below for more details.) + 1. Call `using TrackedFloats`; you may want to include functions like `tf_enable_nan_injection` or `tf_config_logger` or the like. (See below for more details.) 2. Add additional customization to logging and injection. 3. Wrap as many of your inputs in `TrackedFloatN` as you can. @@ -169,16 +169,16 @@ TrackedFloats can *inject* `NaN`s at random points in your program to help you f ```julia # Inject 2 NaNs -enable_nan_injection(2) +tf_enable_nan_injection(2) # Inject 2 NaNs, except when in the function "nope" in "way.jl" -enable_nan_injection(n_inject=2, functions=[FunctionRef("nope", "way.jl")]) +tf_enable_nan_injection(n_inject=2, functions=[FunctionRef("nope", "way.jl")]) # Enable recording of injections -record_injection("tf_recording") # this is just the file basename; will have timestamp prepended +tf_record_injection("tf_recording") # this is just the file basename; will have timestamp prepended # Enable recording playback -replay_injection("20230530T145830-tf_recording.txt") +tf_reply_injection("20230530T145830-tf_recording.txt") ``` Keyword arguments for `tf_config_injector`: diff --git a/src/Config.jl b/src/Config.jl index 15b014f..3988927 100644 --- a/src/Config.jl +++ b/src/Config.jl @@ -320,12 +320,12 @@ a keyword argument to `tf_config_logger`. tf_exclude_stacktrace(exclusions = [:prop]) = tf_config.log.exclusions = exclusions """ - enable_nan_injection(n_inject::Int) + tf_enable_nan_injection(n_inject::Int) Turn on NaN injection and injection `n_inject` NaNs. Does not modify odds, function and library lists, or recording/replay state. - enable_nan_injection(; odds::Int = 10, n_inject::Int = 1, functions::Array{FunctionRef} = [], libraries::Array{String} = []) + tf_enable_nan_injection(; odds::Int = 10, n_inject::Int = 1, functions::Array{FunctionRef} = [], libraries::Array{String} = []) Turn on NaN injection. Optionally configure the odds for injection, as well as the number of NaNs to inject, and the functions/libraries in which to inject @@ -370,26 +370,26 @@ function enable_injection(; odds::Int = 10, n_inject::Int = 1, value::Any = NaN, end """ - disable_nan_injection() + tf_disable_nan_injection() Turn off NaN injection. -If you want to re-enable NaN injection after calling `disable_nan_injection`, -consider using the one-argument form of `enable_nan_injection(n_inject::Int)`. +If you want to re-enable NaN injection after calling `tf_disable_nan_injection`, +consider using the one-argument form of `tf_enable_nan_injection(n_inject::Int)`. """ tf_disable_nan_injection() = tf_config.inj.active = false tf_disable_inf_injection() = tf_config.inj.active = false disable_injection() = tf_config.inj.active = false """ - record_injection(recording_file::String="tf_recording") + tf_record_injection(recording_file::String="tf_recording") Turn on recording. """ tf_record_injection(recording_file::String="tf_recording") = tf_config.inj.record = recording_file """ - replay_injection(replay_file::String) + tf_reply_injection(replay_file::String) Sets the injector to read from a replay file. diff --git a/src/TrackedFloats.jl b/src/TrackedFloats.jl index 9796449..2b35b79 100644 --- a/src/TrackedFloats.jl +++ b/src/TrackedFloats.jl @@ -3,7 +3,6 @@ module TrackedFloats export FtConfig, tf_init, TrackedFloat16, TrackedFloat32, TrackedFloat64, FunctionRef export LoggerConfig, tf_config_logger, tf_exclude_stacktrace, tf_print_log, tf_flush_logs export InjectorConfig, tf_config_injector, tf_enable_nan_injection, tf_disable_nan_injection, tf_enable_inf_injection, tf_disable_inf_injection, tf_record_injection, tf_replay_injection -# migration: start again with adding tf_ to enable_nan_injection export SessionConfig, tf_config_session include("SharedStructs.jl") # Structures used in multiple places throughout TrackedFloats