Skip to content

Commit

Permalink
Harmonize and add docs for --math-mode (#53818)
Browse files Browse the repository at this point in the history
The behavior was changed and the CLI doc was removed
in #41638, though we current still allow users to
selectively use the `@fastmath` macro.
This adds back the CLI docs and makes a minor
clarification about behavior.

Co-authored-by: Matt Bauman <mbauman@juliahub.com>
  • Loading branch information
sjkelly and mbauman authored Mar 27, 2024
1 parent f413b01 commit 7a62dff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/man/julia.1
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ Control whether inlining is permitted, including overriding @inline declarations
Emit bounds checks always, never, or respect @inbounds declarations

.TP
--math-mode={ieee|user}
Disallow or enable unsafe floating point optimizations (overrides @fastmath declaration)
--math-mode={ieee|user*}
Always follow `ieee` floating point semantics or respect `@fastmath` declarations

.TP
--code-coverage[={none*|user|all}]
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ The following is a complete list of command-line switches available when launchi
|`-g`, `--debug-info={0,1*,2}` |Set the level of debug info generation (level is 2 if `-g` is used without a level) ($)|
|`--inline={yes\|no}` |Control whether inlining is permitted, including overriding `@inline` declarations|
|`--check-bounds={yes\|no\|auto*}` |Emit bounds checks always, never, or respect `@inbounds` declarations ($)|
|`--math-mode={ieee,fast}` |Disallow or enable unsafe floating point optimizations (overrides `@fastmath` declaration)|
|`--math-mode={ieee\|user*}` |Always follow `ieee` floating point semantics or respect `@fastmath` declarations|
|`--code-coverage[={none*\|user\|all}]` |Count executions of source lines (omitting setting is equivalent to `user`)|
|`--code-coverage=@<path>` |Count executions but only in files that fall under the given file path/directory. The `@` prefix is required to select this option. A `@` with no path will track the current directory.|
|`--code-coverage=tracefile.info` |Append coverage information to the LCOV tracefile (filename supports format tokens).|
Expand Down
3 changes: 2 additions & 1 deletion src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ static const char opts[] =
#ifdef USE_POLLY
" --polly={yes*|no} Enable or disable the polyhedral optimizer Polly (overrides @polly declaration)\n"
#endif
" --math-mode={ieee|user*} Always follow `ieee` floating point semantics or respect `@fastmath` declarations\n\n"

// instrumentation options
" --code-coverage[={none*|user|all}]\n"
Expand Down Expand Up @@ -782,7 +783,7 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
else if (!strcmp(optarg,"user"))
jl_options.fast_math = JL_OPTIONS_FAST_MATH_DEFAULT;
else
jl_errorf("julia: invalid argument to --math-mode (%s)", optarg);
jl_errorf("julia: invalid argument to --math-mode={ieee|user} (%s)", optarg);
break;
case opt_worker:
jl_options.worker = 1;
Expand Down

0 comments on commit 7a62dff

Please sign in to comment.