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

Wrong openmp flag on Windows #804

Closed
matthew-brett opened this Issue Dec 6, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@matthew-brett
Member

matthew-brett commented Dec 6, 2015

We're testing -fopenmp for Windows, but I think the correct flag for visual studio 2015 is just /openmp : https://msdn.microsoft.com/en-us/library/tt15eb9t.aspx

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Dec 27, 2015

Hi @matthew-brett and many thanks for reporting this issue.

In order to be able to decide between -fopenmp flag and /openmp we need to know the compiler. But it seems it is not so easy to know which compiler is going to be used. This depends on OS, python distribution, which compilers are installed, which are default etc.

An alternative hack would be to do what you did before with creating a small c file were omp.h was imported and then try to roll through the different possible flags until the c file compiles correctly. We could even go further to roll through the different available compilers and report what is available and compile with openmp correctly. Not sure how we can get the available compilers in python correctly. I know that distutils has some functionality about that (with msvc included) but I don't see clang for example if we want to support that too.

Possibly we may need to brainstorm a bit about this @matthew-brett. First of all do you have a good strategy to know which compiler is being used for building the cython modules? So we can set the correct flags? Any other ideas?

@matthew-brett

This comment has been minimized.

Member

matthew-brett commented Dec 28, 2015

We might be able to get away with:

    extbuilder = add_flag_checking(
        build_ext, [[['/arch:SSE2'], [], simple_test_c, 'USING_VC_SSE2'],
            [['-msse2', '-mfpmath=sse'], [], simple_test_c, 'USING_GCC_SSE2'],
            [['-fopenmp'], ['-fopenmp'], omp_test_c, 'HAVE_GCC_OPENMP']],
            [['/openmp'], ['/openmp'], omp_test_c, 'HAVE_VC_OPENMP']], 'dipy')

I can't see any use of the HAVE_OPENMP flags so I guess it doesn't matter that we checking different flags for the same thing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment