Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmdstanpy/compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion test/test_compiler_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading