Conda-forge.github.io: OpenMP on Windows

Created on 4 Mar 2021  路  5Comments  路  Source: conda-forge/conda-forge.github.io

On Linux and macOS packages are built to allow OpenMP to be selected at runtime (see docs). Though it doesn't appear we have considered Windows. Admittedly am not a Windows expert, but my guess is this is due to Windows including its own (albeit somewhat dated) OpenMP implementation. As some folks are now investigating using LLVM OpenMP on Windows and Microsoft is looking at improving their OpenMP offering, it may be worth discussing how we handle OpenMP on Windows and how we integrate that into how OpenMP is handled in conda-forge more generally.

Discussion

Most helpful comment

I have no thoughts on windows. Everything is hard and weird to me.

All 5 comments

cc @beckermr @ax3l (who may have thoughts here 馃檪)

I have no thoughts on windows. Everything is hard and weird to me.

Thanks to @isuruf's help, I am driving really well with clang-cl in https://github.com/conda-forge/warpx-feedstock

The trick lies in using the MSVC interface of clang, so we don't have issues with flag-forwarding from dependencies, and for CMake building with Ninja and the according linker from LLVM:

cmake -S . -B build  ^
        -G "Ninja"                            ^
        -DCMAKE_C_COMPILER=clang-cl           ^
        -DCMAKE_CXX_COMPILER=clang-cl         ^
        -DCMAKE_LINKER=lld-link               ^
        -DCMAKE_NM=llvm-nm

my meta.yaml:

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - clang         # [win]
    - lld           # [win]
    - cmake >=3.15.0
    - libgomp       # [linux]
    - llvm-openmp   # [osx or win]
    - make          # [unix]
    - ninja         # [win]

We probably need to coordinate with the intel-openmp package that is present but does not seem to be used by packages yet.

Generally, using OpenMP on Windows for scientific codes is interesting on my end, because it's an easy path to parallelism for multi-core systems that users deploy on (easier than using MPI).

If the LLVM OpenMP on Windows takes on steam, I would probably like to deploy through it. But clang-cl + LLVM OpenMP works just as well for now.

That said, I am very much a Linux person and my Windows knowledge touches as far as setting PATH to .dlls and driving CMake :D

I thought both of those OpenMP implementations used the same API, which should let us just build against the LLVM one and let users select between the 2. Though could be wrong about that

My CMake find_package(OpenMP) error was pretty concrete on CXX though, could be possible that we were just missing to build or configure a component or so for intel-openmp:

CMake Error at D:/bld/warpx_1614885902861/_build_env/Library/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

prachi237 picture prachi237  路  3Comments

Cadair picture Cadair  路  5Comments

westurner picture westurner  路  3Comments

jakirkham picture jakirkham  路  3Comments

scopatz picture scopatz  路  4Comments