Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default(none) clause in some OpenMP for-loops #5903

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

mvieth
Copy link
Member

@mvieth mvieth commented Dec 16, 2023

clang 17 complains that in these loops, some variables do not have an explicitly defined data sharing attribute, e.g. Eigen::Dynamic (which is a const int).
Explicitly defining it as shared would be weird since the use of Eigen::Dynamic is not obvious in those loops, and would also likely lead to problems with other compilers because const variables are implicitly shared (at least in OpenMP versions < 4.0), and defining them explicitly as shared leads to compiler errors (see also http://jakascorner.com/blog/2016/07/omp-default-none-and-const.html).
Removing default(none) solves the problem. Generally, the use of default(none) is recommended while writing the code because it forces the programmer to think about whether each variable should be shared or private, but since the code is already finished, removing default(none) should have no downsides.

Also: install libomp-dev to make OpenMP available for Clang on CI

clang 17 complains that in these loops, some variables do not have an explicitly defined data sharing attribute, e.g. `Eigen::Dynamic` (which is a `const int`).
Explicitly defining it as shared would be weird since the use of `Eigen::Dynamic` is not obvious in those loops, and would also likely lead to problems with other compilers because const variables are implicitly shared (at least in OpenMP versions < 4.0), and defining them explicitly as shared leads to compiler errors (see also http://jakascorner.com/blog/2016/07/omp-default-none-and-const.html).
Removing default(none) solves the problem. Generally, the use of default(none) is recommended while writing the code because it forces the programmer to think about whether each variable should be shared or private, but since the code is already finished, removing default(none) should have no downsides.
@mvieth mvieth merged commit 1b383d9 into PointCloudLibrary:master Dec 18, 2023
18 checks passed
@mvieth mvieth deleted the clang17_default_none branch December 18, 2023 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Meta-information for changelog generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants