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

MB-61719: Windows requires index variable in an OpenMP for to be signed #34

Closed
wants to merge 1 commit into from

Conversation

@abhinavdangeti
Copy link
Member Author

It seems we can get around this issue by using clang instead of msvc.

for (size_t i = 0; i < nx_p; i += NX_POINTS_PER_LOOP) {
// use signed instead of size_t because of C3016 error on windows:
// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c3016
for (ssize_t i = 0; i < nx_p; i += (ssize_t)NX_POINTS_PER_LOOP) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works if ssize_t is defined and available (it is non standard)
pls refer to facebook/faiss commit facebookresearch#2889
that fixed the same issue in another file

}

for (size_t i = nx_p; i < nx; i++) {
for (ssize_t i = nx_p; i < (ssize_t)nx; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not required to add any changes to this line as
pragma omp for only applies to the immediate next for loop (which is the one above)
this for loop is not under openmp

@abhinavdangeti
Copy link
Member Author

We won't be needing this anymore, as we're pivoting to using clang to compile windows builds - which fixes the compilation error called out.

@abhinavdangeti abhinavdangeti deleted the win_size_t branch September 6, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants