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

Add polars #18906

Merged
merged 30 commits into from
Jun 7, 2022
Merged

Add polars #18906

merged 30 commits into from
Jun 7, 2022

Conversation

Maxyme
Copy link
Contributor

@Maxyme Maxyme commented May 11, 2022

Checklist

  • Title of this PR is meaningful: e.g. "Adding my_nifty_package", not "updated meta.yaml".
  • License file is packaged (see here for an example).
  • Source is from official source.
  • Package does not vendor other packages. (If a package uses the source of another package, they should be separate packages or the licenses of all packages need to be packaged).
  • If static libraries are linked in, the license of the static library is packaged.
  • Build number is 0.
  • A tarball (url) rather than a repo (e.g. git_url) is used in your recipe (see here for more details).
  • GitHub users listed in the maintainer section have posted a comment confirming they are willing to be listed there.
  • When in trouble, please check our knowledge base documentation before pinging a team.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found some lint.

Here's what I've got...

For recipes/polars:

  • requirements: host: python>=3.7 must contain a space between the name and the pin, i.e. python >=3.7
  • requirements: run: python>=3.7 must contain a space between the name and the pin, i.e. python >=3.7
  • requirements: run: numpy>=1.16.0 must contain a space between the name and the pin, i.e. numpy >=1.16.0
  • requirements: run: typing_extensions>=4.0.0 must contain a space between the name and the pin, i.e. typing_extensions >=4.0.0

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found some lint.

Here's what I've got...

For recipes/polars:

  • Non noarch packages should have python requirement without any version constraints.
  • Non noarch packages should have python requirement without any version constraints.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found it was in an excellent condition.

@dhirschfeld
Copy link
Member

Super excited to see this! It seems like it's a very awkward one to compile for conda-forge though 😬.

If Windows is being particularly difficult perhaps this can be merged without Windows support and then debug it on the feedstock?

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found some lint.

Here's what I've got...

For recipes/polars:

  • There are too few lines. There should be one empty line at the end of the file.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found it was in an excellent condition.

@Maxyme
Copy link
Contributor Author

Maxyme commented May 12, 2022

@dhirschfeld, just updated to skip windows builds for now, I think it will be quite simple to fix in a future PR. Thanks for the comment.

@dhirschfeld
Copy link
Member

Seems like it can't find the python executable, which is odd since you explicitly specify --interpreter=%PYTHON% to the maturin command.

--- stderr 
error: failed to run the Python interpreter at C:\bld\polars_1652374306242\_build_env\python.exe: The system cannot find the file specified. (os error 2) 
warning: build failed, waiting for other jobs to finish... 
💥 maturin failed 
Caused by: Failed to build a native library through cargo 
Caused by: Cargo build finished with "exit code: 101": `cargo rustc --manifest-path Cargo.toml --message-format json --release --lib -- -C codegen-units=16 -C lto=thin -C target-cpu=native -C link-arg=-s` 

Maybe the selector means python isn't being installed in the build env? 🤔

      - python                              # [build_platform != target_platform]

Anyway, easy enough to test that theory out in the feedstock....

@Maxyme Maxyme marked this pull request as ready for review May 13, 2022 01:43
@timkpaine timkpaine mentioned this pull request May 13, 2022
9 tasks
Copy link

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

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

Awesome initiative! I've left a few comments regarding how we build the binary.


export PATH=${SRC_DIR}/rust-nightly-install/bin:$PATH

maturin build --no-sdist --release --strip --manylinux off --interpreter="${PYTHON}" --rustc-extra-args="-C codegen-units=16 -C lto=thin -C target-cpu=native"

Choose a reason for hiding this comment

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

We should not be compiling for native target CPU. That would mean the binary is unusable for CPU's that don't share the same features.

For pypi we set:

export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma'

This is a reasonable default.

Next, we also should not set the codegen-units nor thin lto. This creates a binary that would be slower than what we produce for pypi.

So I would propose skipping the whole --rustc-extra-args="-C codegen-units=16 -C lto=thin -C target-cpu=native" and setting:

export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma'

Copy link
Member

@timkpaine timkpaine May 13, 2022

Choose a reason for hiding this comment

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

we may have to modify this once the feedstock is created for mac arm builds since both the x86 and arm builds will use build.sh

Copy link
Member

Choose a reason for hiding this comment

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

We don't enable avx by default on conda-forge binaries. So, please remove RUSTFLAGS.

@timkpaine
Copy link
Member

windows looks ok over here:Maxyme#1
will ping again once the builds are confirmed passing

@sugatoray
Copy link
Contributor

@BastianZim @beckermr @bollwyvl Requesting your feedback on the recipe.

The sources for rust-nightly are included in the recipe. Does it require the license(s) to be included for rust-nightly as well? Thank you.

Copy link
Member

@xhochy xhochy left a comment

Choose a reason for hiding this comment

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

Can we instead please update the rust_dev build of the rust conpiler feedstock instead of bundling it here?

@timkpaine
Copy link
Member

timkpaine commented May 15, 2022

@xhochy is there an existing pattern for using the rust_dev build like this? Just keeping in mind that this is the 5th attempt at getting a polars feedstock in and there's a dearth of rust-nightly examples to work from

@xhochy
Copy link
Member

xhochy commented May 15, 2022

@xhochy is there an existing pattern for using the rust_dev build like this?

Add the following to conda_build_config.yaml:

channel_sources:
 - conda-forge/label/rust_dev,conda-forge

You might need to update the rust_dev build in the rust-feedstock to get the latest version there.

Just keeping in mind that this is the 5th attempt at getting a polars feedstock in and there's a dearth of rust-nightly examples to work from

The number of failed PRs should not be a wildcard to dismiss reviews. We want sustainable solutions here.

Comment on lines 5 to 6
# todo: Check +avx when supported in conda-forge
export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+fma'
Copy link
Member

Choose a reason for hiding this comment

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

Remove this so that the default options are used and when conda-forge moves forward, it'll be done automatically.

Choose a reason for hiding this comment

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

Note that we use these feature flags in polars. Or are they moved somewhere else? I am not really familiar with conda feedstocks.

Copy link
Contributor Author

@Maxyme Maxyme May 18, 2022

Choose a reason for hiding this comment

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

@ritchie46 In theory - if I'm correct... and if it compiles, it will use library calls instead of cpu instructions.
I think that we can either compile with these flags and force cpu instruction optimizations for some features and potentially lock out some users, or use default flags, (I don't think conda sets RUSTFLAGS but I could be wrong) and lose some performance at the benefit of allowing more users to use the library (see: https://internals.rust-lang.org/t/policies-around-default-cpu-architecture/9142/5).
Also according to this (https://store.steampowered.com/hwsurvey -> other settings) avx would be supported by 95% of users.

Choose a reason for hiding this comment

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

Yes thats correct but these are reasonable defaults that practically all machines have. The rust defaults are super conservative because they also ship to embedded.

Note that we don't activate avx. That one is not yet broadly supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you be okay going ahead with the defaults and looking at the flags in a separate pr? I can open a new one after this for that purpose. @isuruf ?

@timkpaine
Copy link
Member

ive been duplicating our work in this PR on #18987 so whenever we merge this one if we could do connector-x as well (same deal, rust nightly).

@Maxyme
Copy link
Contributor Author

Maxyme commented May 21, 2022

Small update: this PR is currently blocked by: #19036

@jakirkham
Copy link
Member

Now that PR ( #19036 ) is in would it be possible to drop those changes from here?

@xhochy
Copy link
Member

xhochy commented Jun 3, 2022

@Maxyme Can you rebase and remove all changes that aren't inside recipe/polars? Then we can finally merge :)

Also I'm happy to be added as a maintainer to help with future build troubles if you would like to.

@dhirschfeld
Copy link
Member

Thanks @xhochy for getting this over the line, and making it easier to add new rust recipes! 🎉

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found some lint.

Here's what I've got...

For recipes/polars:

  • There are too few lines. There should be one empty line at the end of the file.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/polars) and found it was in an excellent condition.

- ritchie46
- sugatoray
- xhochy
- dhirschfeld
Copy link
Member

Choose a reason for hiding this comment

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

☝️ I'm happy to be added as a maintainer

@Maxyme
Copy link
Contributor Author

Maxyme commented Jun 3, 2022

@isuruf, ready to merge this!

@timkpaine
Copy link
Member

(applying the same changes to #18987)

@timkpaine
Copy link
Member

moving to #19136

@xhochy xhochy merged commit ec7c7dd into conda-forge:main Jun 7, 2022
@timkpaine
Copy link
Member

🎉 🎉 🎉

@Maxyme Maxyme deleted the add_polars branch June 9, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants