Skip to content

Commit

Permalink
[CLI] Add TI_ADVANCED_OPTIMIZATION config env var (#1212)
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate authored Jun 12, 2020
1 parent 4d427a2 commit ea30eec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/global_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Backends
Compilation
***********

- Disable advanced optimization to save compile time & possible erros: ``ti.core.toggle_advanced_optimization(False)``.
- Disable advanced optimization to save compile time & possible erros: ``ti.core.toggle_advanced_optimization(False)`` or ``export TI_ADVANCED_OPTIMIZATION=0``.
- To print intermediate IR generated: ``export TI_PRINT_IR=1`` or ``ti.init(print_ir=True)``.
- To print preprocessed Python code: ``export TI_PRINT_PREPROCESSED=1`` or ``ti.init(print_preprocessed=True)``..

Expand Down
4 changes: 4 additions & 0 deletions python/taichi/lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ def environ_config(key, cast=bool_int):
if len(gdb_trigger):
ti.set_gdb_trigger(bool(int(gdb_trigger)))

advanced_optimization = os.environ.get('TI_ADVANCED_OPTIMIZATION', '')
if len(advanced_optimization):
ti.core.toggle_advanced_optimization(bool(int(advanced_optimization)))

# Q: Why not environ_config("arch", ti.core.arch_from_name)?
# A: We need adaptive_arch_select for all.
env_arch = os.environ.get("TI_ARCH")
Expand Down

0 comments on commit ea30eec

Please sign in to comment.