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

pythonPackages.fipy: init at 3.3 #65035

Merged
merged 5 commits into from Jul 28, 2019
Merged

pythonPackages.fipy: init at 3.3 #65035

merged 5 commits into from Jul 28, 2019

Conversation

wd15
Copy link
Contributor

@wd15 wd15 commented Jul 18, 2019

Motivation for this change

Add the FiPy PDE solver, see https://www.ctcms.nist.gov/fipy/

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@wd15 wd15 requested a review from FRidh as a code owner July 18, 2019 17:53
@wd15
Copy link
Contributor Author

wd15 commented Jul 18, 2019

@costrouc: here is the new PR to replace #64643. Let me know what else I need to do.

Copy link
Contributor

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

Is it possible to rebase the commits? At the moment the commit for fipy is before its dependency pyamg. Also within the commits there is another python module added and removed again. Not sure this matters in the long run but would be nice to clean up.

pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
, fetchPypi
, numpy
, setuptools
, blas
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason this can't be parsed in as openblas to avoid having to pass in { blas = pkgs.openblas } in the callPackage statement?

Copy link
Member

Choose a reason for hiding this comment

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

This is so that in the future someone could provide mkl, atlas, blas instead. We do a similar thing with numpy

Copy link
Contributor

Choose a reason for hiding this comment

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

fair enough

@@ -4044,6 +4046,10 @@ in {

pyspread = callPackage ../development/python-modules/pyspread { };

pysparse = callPackage ../development/python-modules/pysparse {
blas = pkgs.openblas;
Copy link
Contributor

Choose a reason for hiding this comment

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

not familiar with this package, but i would at the very least keep the aliasing consistent

Suggested change
blas = pkgs.openblas;
openblas = pkgs.openblas;

Copy link
Member

Choose a reason for hiding this comment

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

I mentioned this in a previous comment. What if we would like to use mkl in the future? blas is more consistent. (also atlas and blas are options as well)

Copy link
Contributor

Choose a reason for hiding this comment

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

you can have additional flags such as:

, pkgs
, withBlas ?  false
, withMKL ? false
....

and then later on:

buildInputs = [
...
] ++ lib.optional withBlas pkgs.openblas
++ lib.optional withMKL pkgs.mkl;

but, you can set them to be true when calling the package

fipy = callPackage .... { withMKL = true; }

really just depends on how to you want to structure injecting those options.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/tensorflow/default.nix
is a good example as it conditionally enables CudaSupport. And does an "intelligent" look-up of what instruction sets are available for a given architecture.

I'm not sure if you're trying to set a framework to use, or choose between many.

@costrouc
Copy link
Member

@wd15 please change the title of the PR to pythonPackages.fipy: init at 3.3

@costrouc
Copy link
Member

PR builds for me

Result of nix-review pr 65035 1

7 package were build:
  • python27Packages.fipy
  • python27Packages.pyamg
  • python27Packages.pysparse
  • python27Packages.scikit-fmm
  • python37Packages.fipy
  • python37Packages.pyamg
  • python37Packages.scikit-fmm

@wd15 wd15 changed the title Python fipy init pythonPackages.fipy: init at 3.3 Jul 18, 2019
@alexarice
Copy link
Contributor

I would name the maintainer commit "Add wd15 to maintainers.nix" and put it before any of the others

@alexarice
Copy link
Contributor

I think it's not usual to merge master into your branch either

@wd15 wd15 force-pushed the python-fipy-init branch 2 times, most recently from 0c426d1 to 1eb6142 Compare July 18, 2019 21:20
@smaret
Copy link
Member

smaret commented Jul 18, 2019

python27Packages.pysparse fails to build on Darwin with the following error:

builder for '/nix/store/ywgvqx50gz794d6zz6i29md2qz2pr7wf-python2.7-pysparse-1.1.1-dev.drv' failed with exit code 1; last 10 log lines:
      self.calc_info()
    File "/nix/store/0kfl9gvfhazc0m8yak0k4pnr535ww11n-python2.7-numpy-1.16.4/lib/python2.7/site-packages/numpy/distutils/system_info.py", line 1700, in calc_info
      lib = self.has_cblas(info)
    File "/nix/store/0kfl9gvfhazc0m8yak0k4pnr535ww11n-python2.7-numpy-1.16.4/lib/python2.7/site-packages/numpy/distutils/system_info.py", line 1743, in has_cblas
      extra_postargs=info.get('extra_link_args', []))
    File "/nix/store/m96dlplafzcpmy8sbvgkq4r5ny55w4gg-python-2.7.16/lib/python2.7/distutils/ccompiler.py", line 700, in link_executable
      debug, extra_preargs, extra_postargs, None, target_lang)
    File "/nix/store/m96dlplafzcpmy8sbvgkq4r5ny55w4gg-python-2.7.16/lib/python2.7/distutils/unixccompiler.py", line 205, in link
      raise LinkError, msg
  distutils.errors.LinkError: Command "clang /private/var/folders/r2/zwnv7zsd4bd99mqkn4mhqxn800034l/T/nix-build-python2.7-pysparse-1.1.1-dev.drv-0/tmpsvlr5e/private/var/folders/r2/zwnv7zsd4bd99mqkn4mhqxn800034l/T/nix-build-python2.7-pysparse-1.1.1-dev.drv-0/tmpsvlr5e/source.o -L/usr/lib -lblas -o /private/var/folders/r2/zwnv7zsd4bd99mqkn4mhqxn800034l/T/nix-build-python2.7-pysparse-1.1.1-dev.drv-0/tmpsvlr5e/a.out" failed with exit status 1

@wd15 wd15 changed the title pythonPackages.fipy: init at 3.3 [WIP] pythonPackages.fipy: init at 3.3 Jul 18, 2019
@wd15
Copy link
Contributor Author

wd15 commented Jul 18, 2019

@alexarice: commits should be clean now

Copy link
Contributor

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

Looks good apart from darwin issues

@costrouc
Copy link
Member

@wd15 remove the [WIP] tag. Looks like this PR ready to go (aside from the darwin issue). If you want you could set platforms = platforms.linux; in meta to limit builds to only linux. Not sure if you have confirmed support for osx


propagatedBuildInputs = [
numpy
blas
Copy link
Member

Choose a reason for hiding this comment

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

Does it need to link to the same blas as is used by numpy? There is the numpy.blas attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, yes it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now using numpy.blas

@wd15
Copy link
Contributor Author

wd15 commented Jul 23, 2019

@costrouc, I just need to make one more change. I need to remove Gmsh as a dependency on Darwin as it doesn't seem to build and after than have @smaret retest. I updated the PySparse version since smaret review and checked that it built on Darwin so I'll ping smaret to retest once that is done.

@wd15 wd15 changed the title [WIP] pythonPackages.fipy: init at 3.3 pythonPackages.fipy: init at 3.3 Jul 23, 2019
@wd15
Copy link
Contributor Author

wd15 commented Jul 23, 2019

@smaret, thanks for your previous test. I've updated the PySparse build to a more recent version, which built for me on Darwin. Could you try again?

@jonringer
Copy link
Contributor

I feel like that brokepip.patch is a little heavy at 22k lines...

@wd15
Copy link
Contributor Author

wd15 commented Jul 24, 2019

@jonringer, I can fix that. I should just apply the patch and use the GitHub repository.

@wd15 wd15 changed the title pythonPackages.fipy: init at 3.3 [WIP] pythonPackages.fipy: init at 3.3 Jul 24, 2019
@wd15 wd15 changed the title [WIP] pythonPackages.fipy: init at 3.3 pythonPackages.fipy: init at 3.3 Jul 24, 2019
@wd15
Copy link
Contributor Author

wd15 commented Jul 24, 2019

@jonringer, large patch is gone

@smaret
Copy link
Member

smaret commented Jul 24, 2019

@smaret, thanks for your previous test. I've updated the PySparse build to a more recent version, which built for me on Darwin. Could you try again?

PR builds on Darwin for python27. I get an error while building python37.tkinter but that's most likely probably unrelated to this PR. Looks good to me.

@costrouc
Copy link
Member

Result of nix-review pr 65035 1

7 package were build:
  • python27Packages.fipy
  • python27Packages.pyamg
  • python27Packages.pysparse
  • python27Packages.scikit-fmm
  • python37Packages.fipy
  • python37Packages.pyamg
  • python37Packages.scikit-fmm

nix review passes! LGTM

@FRidh FRidh merged commit 92e1376 into NixOS:master Jul 28, 2019
@wd15 wd15 deleted the python-fipy-init branch August 27, 2019 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants