From 6b92a523e159691daa717d55d3b65e9fd0880567 Mon Sep 17 00:00:00 2001 From: Bo Qiao Date: Thu, 16 Jun 2022 21:05:07 +0800 Subject: [PATCH] Pylint --- python/taichi/lang/misc.py | 5 ++++- tests/python/test_parallel_range_for.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python/taichi/lang/misc.py b/python/taichi/lang/misc.py index 60d93fc409bd6..984cb64f7afbc 100644 --- a/python/taichi/lang/misc.py +++ b/python/taichi/lang/misc.py @@ -589,7 +589,10 @@ def _block_dim(dim): def _block_dim_adaptive(block_dim_adaptive): """Enable/Disable backends set block_dim adaptively. """ - get_runtime().prog.config.cpu_block_dim_adaptive = block_dim_adaptive + if get_runtime().prog.config.arch != cpu: + _logging.warn('Adaptive block_dim is supported on CPU backend only') + else: + get_runtime().prog.config.cpu_block_dim_adaptive = block_dim_adaptive def loop_config(*, diff --git a/tests/python/test_parallel_range_for.py b/tests/python/test_parallel_range_for.py index eb61cf13d2a5c..45339b905059c 100644 --- a/tests/python/test_parallel_range_for.py +++ b/tests/python/test_parallel_range_for.py @@ -71,7 +71,7 @@ def foo() -> ti.i32: assert foo() == 50 -@test_utils.test() +@test_utils.test(arch=[ti.cpu]) def test_loop_config_block_dim_adaptive(): n = 4096 val = ti.field(ti.i32, shape=(n))