Skip to content

Commit a071533

Browse files
committed
Add opt-in flag for debug mode in unit tests.
1 parent 4dc7a6d commit a071533

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

.github/workflows/generic.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
TI_ENABLE_METAL: "0"
3333
TI_ENABLE_OPENGL: "0"
3434
TI_ENABLE_VULKAN: "0"
35+
TI_DEBUG: "0"
3536

3637
runs-on: ${{ matrix.OS }}
3738
if: github.event_name != 'release'
@@ -112,7 +113,7 @@ jobs:
112113
113114
- name: Run unit tests
114115
run: |
115-
pytest -v --logical --forked -m required ./tests
116+
pytest -v --logical --dev --forked -m required ./tests
116117
117118
- name: Save Updated Taichi Kernel Cache
118119
if: always()

.github/workflows/production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
bash -c "
6868
pip install --extra-index-url https://pypi.nvidia.com/ omniverse-kit && \
6969
pip install -e '.[dev,render,usd]' && \
70-
pytest -v --forked ./tests
70+
pytest -v --dev --forked ./tests
7171
"
7272
7373
- name: Run benchmarks

genesis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def init(
213213
arch=ti_arch,
214214
# Debug mode was buggy and causing segfault prior to v1.7.4
215215
# Add a (hidden) mechanism to forceable disable taichi debug mode as it is still a bit experimental
216-
debug=debug and ti.__version__ >= (1, 7, 4) and (os.environ.get("TI_DEBUG", 1) == "0"),
216+
debug=debug and ti.__version__ >= (1, 7, 4) and (os.environ.get("TI_DEBUG") != "0"),
217217
check_out_of_bound=debug,
218218
# force_scalarize_matrix=True for speeding up kernel compilation
219219
# Turning off 'force_scalarize_matrix' is causing numerical instabilities ('nan') on MacOS

tests/conftest.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def pytest_addoption(parser):
148148
"--logical", action="store_true", default=False, help="Consider logical cores in default number of workers."
149149
)
150150
parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.")
151+
parser.addoption("--dev", action="store_true", default=False, help="Enable genesis debug mode.")
151152

152153

153154
@pytest.fixture(scope="session")
@@ -276,13 +277,8 @@ def initialize_genesis(request, backend, taichi_offline_cache):
276277
from genesis.utils.misc import ALLOCATE_TENSOR_WARNING
277278

278279
logging_level = request.config.getoption("--log-cli-level")
279-
if backend == gs.cpu:
280-
precision = "64"
281-
debug = True
282-
else:
283-
# Disabling debug mode on GPU because we are likely needing maximum performance, notably for benchmarks
284-
precision = "32"
285-
debug = False
280+
debug = request.config.getoption("--dev")
281+
precision = "64" if backend == gs.cpu else "32"
286282

287283
try:
288284
if not taichi_offline_cache:

0 commit comments

Comments
 (0)