FEniCS / ffcx

Next generation FEniCS Form Compiler for finite element forms
https://fenicsproject.org
Other
140 stars 39 forks source link

Add Windows CI #689

Closed jhale closed 1 month ago

jhale commented 2 months ago
jhale commented 1 month ago

@minrk Could you try this one on Conda? The thing that might be 'difficult' here is the use of CFFI.

Edit: I have a question; will our end users need to install MSVC, or is there a possibility option to use clang on Windows via CFFI?

minrk commented 1 month ago

is there a possibility option to use clang on Windows via CFFI?

clang is available on Windows, though I've never used it, so don't know what the implications would be. I believe if you use msvc, it would means folks need to install a compiler outside of conda. I think clang should avoid this, but there may still be an SDK requirement, I'm not sure.

Question is: what packages would need to use clang:

It's going to take me a bit to figure out testing beyond basix on conda-forge, since the dependency means the unreleased builds need to be published somewhere that's not the conda-forge default channel, so downstream can depend on them.

jhale commented 1 month ago

is there a possibility option to use clang on Windows via CFFI?

clang is available on Windows, though I've never used it, so don't know what the implications would be. I believe if you use msvc, it would means folks need to install a compiler outside of conda. I think clang should avoid this, but there may still be an SDK requirement, I'm not sure.

Question is: what packages would need to use clang:

  • all fenics packages (basix, dolfinx)?
  • none, just the runtime requirement?

It's going to take me a bit to figure out testing beyond basix on conda-forge, since the dependency means the unreleased builds need to be published somewhere that's not the conda-forge default channel, so downstream can depend on them.

I took a look at how FFCx is currently using cffi.compile() and on Windows MSVC is the only option without implementing our own JIT compiler wrappers (which I don't want to do, unless it is absolutely necessary) - so users will need to install MSVC. Most of our users will be covered by the Community License anyway.

This issue (how can I use a different compiler with cffi?) is discussed here:

https://foss.heptapod.net/pypy/cffi/-/issues/560

Our only runtime dependency on a compiler is when using CFFI via FFCx, but it is an important core feature and cannot be skipped.

https://github.com/conda-forge/cffi-feedstock/blob/main/recipe/meta.yaml

You can see here there is no runtime dependency on a C compiler, so it must be assumed provided by the system.

jhale commented 1 month ago

On the last point, @chrisrichardson has a Windows machine setup for development, so perhaps we could work together to try a conda build locally?

minrk commented 1 month ago

That's possible. I'm going to try to download the artifacts from unmerged conda-forge CI and upload them to my channel, which should work, but there seems to be a hiccup with downloading the artifacts right now.

minrk commented 1 month ago

I asked, and even with clang, users would need Windows SDKs to compile, so there would be little benefit to depending on clang instead of msvc.

jhale commented 1 month ago

Thanks! I read the thread - we can revisit clang as an option at a later date. For now MSVC2022 using cl.exe will be the only officially supported options on Windows.

jhale commented 1 month ago

Just to clarify a few points from https://conda.discourse.group/t/runtime-requirement-for-c-compiler-on-windows/614/3

minrk commented 1 month ago

Thanks! That clarifies things.

jhale commented 1 month ago

Great. This patch is now ready for final review and preliminary testing in Conda.

minrk commented 1 month ago

Haven't quite worked out all the kinks in getting basix from my channel into conda-forge CI, but so far looks like ffcx (d3ecb540f2a9761f09dfac6576f41300da06b7a6) works fine on Windows in conda-forge with no modifications.

minrk commented 1 month ago

All tests pass on conda on Windows without any special handling: https://github.com/conda-forge/fenics-ffcx-feedstock/pull/7

Windows folks should be able to test installation with conda with:

conda install -c conda-forge -c minrk/label/fenics-windows fenics-ffcx=0.9.0.dev
jhale commented 1 month ago

This is now ready to merge.