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

netcdf4:init at 1.5.1.2 #67338

Closed
wants to merge 14 commits into from
Closed

netcdf4:init at 1.5.1.2 #67338

wants to merge 14 commits into from

Conversation

mamueller
Copy link

@mamueller mamueller commented Aug 23, 2019

#67337
Generalized the expression to be able to create a version with parallel
IO. If the function is called with netcdf-mpi, hdf5-mpi and mpi4py
it now produces a version that can access netcdf4 files in parallel.
I tested this with a small python script that uses parallel IO.
This should probably go to the original testsuite of the package which
is disabled in the nix expression I started with.
So I did not touch this part.
The patch is necessary since the original setup.py does not find
the parallel version of the netcdf although it is there since it
inspects the header file with a pattern that is propably only present in
the newest version. I made a pullrequest to the upstream maintainers to
generelize the pattern so that the patch will no longer be needed.

Motivation for this change
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.
Notify maintainers

cc @

@lsix
Copy link
Member

lsix commented Aug 24, 2019

Looks good to me (overall), I'll give it a try when possible (it might take time).

Did you try to see if the tests can be re-enabled?

@lsix
Copy link
Member

lsix commented Aug 24, 2019

The commits should be renamed:

netcdf4:init at 1.5.1.2 -> pythonPackages.netcdf4: enable parallel IO support or something like that.

I would also say that your second commit (introducing netcdffortran-mpi) could deserve its own PR, since it is independent (about another package, not dependent on the python netcdf binding).

inherit mpi;
};
meta = with stdenv.lib; {
description = "Interface to netCDF library (versions 3 and 4) with support for parallel IO";
Copy link
Member

Choose a reason for hiding this comment

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

I do not think the description should change from the previous implementation.

@lsix
Copy link
Member

lsix commented Aug 24, 2019

And by the way, thanks for your first PR to nixpkgs and welcome in the community !

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

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

Please undo the indentation change that is not needed.

pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
version = "1.5.1.2";
, numpy, zlib, netcdf, hdf5, curl, libjpeg, cython, cftime
,mpi4py ? null, openssh ? null}:
assert (mpi4py!= null) ->
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert (mpi4py!= null) ->
assert (mpi4py != null) ->


disabled = isPyPy;
let
mpiSupport = (mpi4py!=null);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mpiSupport = (mpi4py!=null);
mpiSupport = (mpi4py != null);

@veprbl
Copy link
Member

veprbl commented Dec 27, 2019

@mamueller Are you interested in finishing this?

@mamueller
Copy link
Author

mamueller commented Dec 31, 2019 via email

@veprbl
Copy link
Member

veprbl commented Dec 31, 2019

@mamueller You need to rebase your changes on top of our master branch to fix the merge conflict. Since we already updated to version 1.5.3, you should not need your parallel4Detection.patch anymore [1]. Also, you would need to address the review comments above.

[1] Unidata/netcdf4-python@43ba3e5

@mamueller
Copy link
Author

mamueller commented Jan 2, 2020 via email

@mamueller
Copy link
Author

Sorry for the late response.
I just had a little time to work on it and updated to the new netcdf4 version.
Even (most) tests run now.
With some strange things that I cannot figure out as described in my commit message.
I am not sure how to address the request by FRidh, because I am still (very) new to nix and not too familiar with the stdenv. I think it will be a one liner.
Hopefully the pullrequest goes through now.
Cheers and thanks for the friendly welcome.
Markus

mamueller and others added 4 commits June 8, 2020 18:25
Now also the tests run except one that is skipped by the patch.
The behavior of the tests is puzzeling to me in two ways:
1. If I drop into nix-shell (even  with --pure ) and call genericBuild
   all tests run but if I use nix-build the test fails.
   (If you look at the test you see that it tries to load a remote url.
   I have no clue why this works in the shell and not in nix-build)

2. A similar thing happens with py.test:
   It works in the nix-shell but fails with nix-build but here the test
   suite does not even start.
   I used unittest instead which leads to only one test failing (which
   is now skipped by the patch)
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

@mamueller Yes there are a few things you missed from previous review. This is looking better (style-wise), but there are still few rough edges to fix. Please see my comments below.

pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved

checkInputs = [ pytest ];
#patches=[./skipDapTest.patch];
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this.

pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
HDF5_DIR= lib.getDev hdf5;
NETCDF4_DIR="${netcdf}";
CURL_DIR="${curl.dev}";
JPEG_DIR="${libjpeg.dev}";
Copy link
Member

Choose a reason for hiding this comment

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

Changes to these four lines are not needed.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for your time. I learned a bit about nix (I can now use inherit properly ;-) and also see the point of lib.optionals..)
I have committed all the suggestions and added the remaining outdated ones manually.
I have some remaining questions:

  1. I am sorry for having created such a lot of style problems.
    Is there a linter (or at least a style guide)?
    I am using vim with vim-nix
    For python code I use the python language server integration which is very verbose
    Is there something similar available for nix?
  2. I am a bit unsure about the workflow used to deal with pull requests.
    ( I normally work in a very small group at a research institute where 99.999 % of git usage consists of pull and push and even branches are an exception..., so we are not very professional users..)
    I know what rebasing means and did it twice already for this branch, but I do not know for instance if you would prefer my (many tiny) commits to be squashed into one or if I would make things harder by it...)
    So any suggestions about using git professionally are also welcome.

Thanks again.

Copy link
Member

Choose a reason for hiding this comment

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

@mamueller
Regarding your questions:

  1. There are couple linters that could help. nixpkgs-fmt is one of the most promising ones. There are several other ones: https://github.com/nix-community/nixpkgs-fmt#formatters
    Note that if will format whole file at the time, which may hinder the review process if you mix functional changes with style changes. A typical solution to that is to format the original file in a first commit and then introduce functional changes in subsequent separate commits. It is a bit too late to do that in this PR, but you could try this in the future.

  2. Usually commits are supposed to have one specific idea for a change that is well described in the commit message. So if a PR contains several separate changes, we usually ask for them to be in separate commits. In case of this PR there is only one change (adding mpi support to pythonPackages.netcdf4), so we might just squash everything on merge for you. If you are unsure what to do, look around at other peoples contributions, see what they do.

pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/netcdf4/default.nix Outdated Show resolved Hide resolved
mamueller and others added 7 commits June 12, 2020 11:37
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
py.test test/tst_*.py
cd test
rm tst_dap.py # does not fail in the nix-shell
python -m unittest tst_*.py
Copy link
Member

Choose a reason for hiding this comment

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

${python.interpreter} instead of python. This is a prerequisite for supporting non-CPython interpreters such as PyPy.

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

Noticed there were couple whitespace issues. Also, reposting some previous comments that were not addressed.

buildPythonPackage rec {
pname = "netCDF4";
version = "1.5.3";

disabled = isPyPy;

Copy link
Member

Choose a reason for hiding this comment

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

This change is not needed


buildInputs = [
cython
mpi
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mpi
mpi

];
] ++ lib.optionals mpiSupport [mpi4py mpi openssh];

#patches=[./skipDapTest.patch];
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this

NETCDF4_DIR=netcdf;
CURL_DIR=curl.dev;
JPEG_DIR=libjpeg.dev;
NETCDF4_DIR="${netcdf}";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
NETCDF4_DIR="${netcdf}";
NETCDF4_DIR=netcdf;

CURL_DIR=curl.dev;
JPEG_DIR=libjpeg.dev;
NETCDF4_DIR="${netcdf}";
CURL_DIR="${curl.dev}";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
CURL_DIR="${curl.dev}";
CURL_DIR=curl.dev;

JPEG_DIR=libjpeg.dev;
NETCDF4_DIR="${netcdf}";
CURL_DIR="${curl.dev}";
JPEG_DIR="${libjpeg.dev}";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
JPEG_DIR="${libjpeg.dev}";
JPEG_DIR=libjpeg.dev;

@FRidh
Copy link
Member

FRidh commented Jul 4, 2020

closes #67340.

This was linked to issues Jul 4, 2020
Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

assuming other reviews are addressed

https://github.com/NixOS/nixpkgs/pull/67338
1 package built:
netcdffortran-mpi

cc @bhipple for mpi conventions

netcdffortran-mpi = appendToName "mpi" (netcdffortran.override {
hdf5 = hdf5-mpi;
netcdf = netcdf-mpi;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't done anything with mpi, but the direction we went with blas/lapack was to have 1 variable at the top level specifying your variant, and then an overlay can -- in one place -- consistently override everything to be the right flavor.

This ensures you don't end up with two incoherent flavors of something like numpy in your stack. CC @matthewbauer not sure if we should do something similar for mpi.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, i did get them mixed up. But I think we should have similar conventions between blas and mpi.

@SuperSandro2000 SuperSandro2000 marked this pull request as draft November 29, 2020 01:40
@stale
Copy link

stale bot commented Jun 3, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 3, 2021
@stale
Copy link

stale bot commented Apr 16, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 16, 2022
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.

netcdffortran-mpi no parallel version of netcdf4_py
8 participants