From 7456830b921ab26cc9b9a10353c959cf12922130 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 9 Sep 2025 10:52:34 -0400 Subject: [PATCH 1/2] STAN_OPENCL implies STANCFLAGS=--use-opencl, avoid duplicates --- cmdstanpy/compilation.py | 1 + test/test_compiler_opts.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmdstanpy/compilation.py b/cmdstanpy/compilation.py index ee4a5665..f1fd6a47 100644 --- a/cmdstanpy/compilation.py +++ b/cmdstanpy/compilation.py @@ -189,6 +189,7 @@ def validate_stanc_opts(self) -> None: self._cpp_options = {'STAN_OPENCL': 'TRUE'} else: self._cpp_options['STAN_OPENCL'] = 'TRUE' + ignore.append(key) elif key.startswith('O'): if has_o_flag: get_logger().warning( diff --git a/test/test_compiler_opts.py b/test/test_compiler_opts.py index 02a57a92..980808a7 100644 --- a/test/test_compiler_opts.py +++ b/test/test_compiler_opts.py @@ -135,7 +135,8 @@ def test_opts_stanc_opencl() -> None: stanc_opts['use-opencl'] = 'foo' opts = CompilerOptions(stanc_options=stanc_opts) opts.validate() - assert opts.compose() == ['STANCFLAGS+=--use-opencl', 'STAN_OPENCL=TRUE'] + # cmdstan STAN_OPENCL implies STANCFLAGS+=--use-opencl + assert opts.compose() == ['STAN_OPENCL=TRUE'] def test_opts_stanc_ignore() -> None: From bd4ba506f7e699629d8052e307b94b1cc571c668 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 9 Sep 2025 11:04:44 -0400 Subject: [PATCH 2/2] Update other test --- test/test_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_model.py b/test/test_model.py index 9eadb036..8cdb9628 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -155,11 +155,11 @@ def test_stanc_options() -> None: stanc_opts = model.stanc_options assert stanc_opts[f'O{optim}'] assert stanc_opts['allow-undefined'] - assert stanc_opts['use-opencl'] assert stanc_opts['name'] == 'foo' cpp_opts = model.cpp_options assert cpp_opts['STAN_OPENCL'] == 'TRUE' + assert not stanc_opts.get('use-opencl') with pytest.raises(ValueError): bad_opts = {'X': True}