Skip to content

netcdf: multiple improvements#2377

Merged
tgamblin merged 1 commit intospack:developfrom
aprokop:netcdf_improve
Nov 24, 2016
Merged

netcdf: multiple improvements#2377
tgamblin merged 1 commit intospack:developfrom
aprokop:netcdf_improve

Conversation

@aprokop
Copy link
Copy Markdown
Contributor

@aprokop aprokop commented Nov 21, 2016

  • Added 'dap' and 'cdmremote' variants
    This is based on work in netcdf: Turn off DAP support by deafult. #2324 with the following motivation:
    Turn off DAP support by deafult. DAP requires curl, which has issues
    with circular dependencies. For 95% of NetCDF users that do not need
    DAP, turning it off avoides this rats nest of problems.
  • Added 'parallel-netcdf' variant
    To support work with parallel-netcdf
  • Added 'shared' and 'static' build separation


if '+dap' in spec or '+cdmremote' in spec:
# Make sure Netcdf links against Spack's curl, otherwise
# otherwise it may pick up system's curl, which can give link
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

two otherwise

Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

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

All the changes but the introduction of static look fine to me.

variant('mpi', default=True, description='Enables MPI parallelism')
variant('hdf4', default=False, description='Enable HDF4 support')
variant('shared', default=True, description='Enable shared library')
variant('static', default=True, description='Enable static library')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the only package that uses the static variant, and if I am not wrong we decided a while ago to use just shared. Anyhow: what would be the semantic of

spack install netcdf~shared~static

that is now allowed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i agree with @alalazo , either build static always, or build static when ~shared.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@davydden @alalazo Is an overall Spack guidance for packages for shared/static builds documented somewhere?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aprokop i don't think so. I create an issue for this #2380

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aprokop I thought it was, but sadly I cannot find it. What all the other packages do is to build both shared and static libraries when +shared and just static when ~shared.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

@citibeth citibeth left a comment

Choose a reason for hiding this comment

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

I'm concerned about depending on parallel-netcdf. What version of NetCDF are you building here? The latest version of NetCDF4 does not seem to have a configure flag named --enable-pnetcdf.

http://www.unidata.ucar.edu/software/netcdf/netcdf-4/newdocs/netcdf-install/Configure.html

AFAIK, Argonne's pnetcdf is now obsolete with NetCDF4.

@adamjstewart
Copy link
Copy Markdown
Member

@citibeth If you download the latest version, 4.1.1.1, it does indeed have the --enable-pnetcdf flag available. I didn't know that it depended on parallel-netcdf though.

@citibeth
Copy link
Copy Markdown
Member

@citibeth If you download the latest version, 4.1.1.1, it does indeed have the --enable-pnetcdf flag available. I didn't know that it depended on parallel-netcdf though.

Thanks, good detective work. Like you, without further evidence I'm still dubious that netcdf 4 would depend on parallel-netcdf.

@aprokop
Copy link
Copy Markdown
Contributor Author

aprokop commented Nov 22, 2016

I'm concerned about depending on parallel-netcdf. What version of NetCDF are you building here? The latest version of NetCDF4 does not seem to have a configure flag named --enable-pnetcdf.

Oh, I did not even realize that. I'm building netcdf 4.3.3.1, and was told by a person of the code that it needs both --enable-pnetcdf and –enable-netcdf-4.

I will try to dig deeper to figure out when pnetcdf option is available.

@aprokop
Copy link
Copy Markdown
Contributor Author

aprokop commented Nov 22, 2016

@adamjstewart If you download the latest version, 4.1.1.1

Did you mean 4.4.1.1?

According to this, the --enable-pnetcdf option appeared in 4.2.2.1.

Couple quick questions:

  1. Is one supposed to hide a spec variant if it does not do anything for a particular spec version?
  2. Is it possible to combine statement in when clause? Something like this:
    depends_on("parallel-netcdf", when='+parallel-netcdf' && '@4.2.1.1:')

Or do I have to do the if?

@adamjstewart
Copy link
Copy Markdown
Member

Did you mean 4.4.1.1?

Yep, my bad

Is one supposed to hide a spec variant if it does not do anything for a particular spec version?

I don't think there is currently a way to make a variant unavailable for a certain version, although you can raise an error if someone tries to use it on a version where it is unavailable. See python+ucs4 for an example.

Is it possible to combine statement in when clause? Something like this:

   depends_on("parallel-netcdf", when='+parallel-netcdf' && '@4.2.1.1:')

Yep, it would look like this:

depends_on('parallel-netcdf', when='@4.2.1.1:+parallel-netcdf')

@aprokop
Copy link
Copy Markdown
Contributor Author

aprokop commented Nov 22, 2016

Updated PR:

  • Got rid of static variant
    The current spec always enables static
  • If ~shared, add -fPIC flag
    This would have to be changed when Adding pic_flag property to compilers #2375 is merged
  • Update the requirement for parallel-netcdf variant
  • Fixed double otherwise misprint

I had to add -fPIC to CFLAGS instead of CPPFLAGS as the netcdf configure has this:

  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>

depends_on("[email protected]:")
depends_on("[email protected]:", when='+dap')
depends_on("[email protected]:", when='+cdmremote')
if spec.satisfies('@4.2.2.1:'):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

spec is not defined in this context. You'll need to try my suggestion of putting the version in when.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@adamjstewart Well spotted!

- Added 'dap' and 'cdmremote' variants
  This is based on work in spack#2324 with the following motivation:
      Turn off DAP support by deafult.  DAP requires curl, which has issues
      with circular dependencies.  For 95% of NetCDF users that do not need
      DAP, turning it off avoides this rats nest of problems.
- Added 'parallel-netcdf' variant
  To support work with parallel-netcdf
- Added 'shared' and 'static' build separation
@aprokop
Copy link
Copy Markdown
Contributor Author

aprokop commented Nov 22, 2016

Updated PR with @adamjstewart comments on when.

# PnetCDF support
if '+parallel-netcdf' in spec:
config_args.append('--enable-pnetcdf')
config_args.append('CC=%s' % spec['mpi'].mpicc)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens when someone tries to build netcdf+parallel-netcdf~mpi?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess I don't know. The simplest way would be to prohibit parallel-netcdf without mpi, but again I don't know if it makes sense.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, out of curiosity, what exactly is the difference between netcdf+mpi and netcdf+parallel-netcdf? I've never used either, but my users regularly use serial netcdf and parallel-netcdf.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The simplest way would be to prohibit parallel-netcdf without mpi

i would say thrown an error if someone tries to do it.

@citibeth
Copy link
Copy Markdown
Member

Something in me is not comfortable with a variant having a dash in it.
Could we rename +parallel-netcdf --> +pnetcdf? Would also rename the
package similarly. This would not be inappropriate, since the library
calls itself both:

https://trac.mcs.anl.gov/projects/parallel-netcdf

The difference is... pnetcdf is a reimplementation of the NetCDF-3 file
format for parallel. It is from Argonne National Lab and completely
different and separate from the NetCDF effort at Unidata.

NetCDF4 is no longer a format itself; it is a front-end on top of an HDF5
backend --- and a NetCDF3 backend for compatibility. The recent change
pointed to above allows one to use pnetcdf as a backend as well.

If building a new project, I would use NetCDF4+HDF5, since HDF5 also offers
parallel capabilities, and its file format has a lot of useful features not
found in the NetCDF3 format supported by pnetcdf.

On Tue, Nov 22, 2016 at 3:03 PM, Adam J. Stewart [email protected]
wrote:

@adamjstewart commented on this pull request.

In var/spack/repos/builtin/packages/netcdf/package.py:

@@ -131,10 +151,18 @@ def install(self, spec, prefix):
LDFLAGS.append("-L%s/lib" % spec['szip'].prefix)
LIBS.append("-l%s" % "sz")

  •    # PnetCDF support
    
  •    if '+parallel-netcdf' in spec:
    
  •        config_args.append('--enable-pnetcdf')
    
  •        config_args.append('CC=%s' % spec['mpi'].mpicc)
    

Also, out of curiosity, what exactly is the difference between netcdf+mpi
and netcdf+parallel-netcdf? I've never used either, but my users
regularly use serial netcdf and parallel-netcdf.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2377, or mute the thread
https://github.com/notifications/unsubscribe-auth/AB1cd0Ur9MQLSzwqlISIsMqL-hx7gfRTks5rA0qmgaJpZM4K4w-g
.

@citibeth
Copy link
Copy Markdown
Member

Does the --enable-pnetcdf option require MPI directly? Meaning... does
NetCDF make MPI calls directly in that case? Or does it just use MPI
through pnetcdf, in which case we don't have to do anything?

On Tue, Nov 22, 2016 at 3:28 PM, Denis Davydov [email protected]
wrote:

@davydden commented on this pull request.

In var/spack/repos/builtin/packages/netcdf/package.py:

@@ -131,10 +151,18 @@ def install(self, spec, prefix):
LDFLAGS.append("-L%s/lib" % spec['szip'].prefix)
LIBS.append("-l%s" % "sz")

  •    # PnetCDF support
    
  •    if '+parallel-netcdf' in spec:
    
  •        config_args.append('--enable-pnetcdf')
    
  •        config_args.append('CC=%s' % spec['mpi'].mpicc)
    

The simplest way would be to prohibit parallel-netcdf without mpi

i would say thrown an error if someone tries to do it.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2377, or mute the thread
https://github.com/notifications/unsubscribe-auth/AB1cd_QZRMeWULj5zT7b953eLFpSC9xHks5rA1CLgaJpZM4K4w-g
.

@adamjstewart
Copy link
Copy Markdown
Member

I agree with renaming the variant to pnetcdf, since that's what the actual configure flag looks like. As for the name of the parallel-netcdf package, I'm indifferent.

@aprokop
Copy link
Copy Markdown
Contributor Author

aprokop commented Nov 22, 2016

Does the --enable-pnetcdf option require MPI directly? Meaning... does
NetCDF make MPI calls directly in that case? Or does it just use MPI
through pnetcdf, in which case we don't have to do anything?

I'm actually not sure any more. Looking at the old spec, +mpi adds --enable-parallel4 config option, but for instance 4.3.3.1 does not have it (I think it only appeared in 4.4).

Few interesting bits of information from here:

  • The dependencies of netcdf are only these:
    • HDF5 1.8.9 or later (for netCDF-4 support)
    • zlib 1.2.5 or later (for netCDF-4 compression)
    • curl 7.18.0 or later (for DAP remote access client support)
  • But in the Building with parallel support section it says to use mpicc to compile netcdf when used with pnetcdf or with parallel HDF5

So, I think it does need MPI when compiling with +pnetcdf or with ^hdf5+mpi. I'm less sure now of whether I need the

config_args.append('CC=%s' % spec['mpi'].mpicc)

line as I only needed that for static builds, and I have not checked for shared.

In summary, a) I will rename the variant to pnetcdf; b) I'll make sure +pnetcdf requires +mpi and leave it at that; and c) I will also check whether it works without explicit mpicc.

One of the remaining questions I have: it seems that pnetcdf and hdf5 alternatives to each other?
If true, then logic of mpi, hdf5+mpi and pnetcdf becomes even more convoluted. Personally, I'm not sure which combinations would be OK.

Regarding the parallel-netcdf package renaming, I have no opinion.

@citibeth
Copy link
Copy Markdown
Member

Consider using the netcdf cmake build instead of autotools. Cmake knows
how to set pic flags for different compilers.
On Nov 22, 2016 2:42 PM, "Andrey Prokopenko" [email protected]
wrote:

Updated PR:

I had to add -fPIC to CFLAGS instead of CPPFLAGS as the netcdf configure
has this:

CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2377 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB1cd-RadPyb9GbwqvwakEmVIPja6WCQks5rA0WAgaJpZM4K4w-g
.

@aprokop
Copy link
Copy Markdown
Contributor Author

aprokop commented Nov 22, 2016

Consider using the netcdf cmake build instead of autotools. Cmake knows
how to set pic flags for different compilers.

Would not that require to completely redo the whole spec?

@adamjstewart
Copy link
Copy Markdown
Member

adamjstewart commented Nov 22, 2016

We've discussed CMake vs. Autotools for the NetCDF package before: #400 (comment)

We decided to stick with Autotools because it can build older versions of NetCDF. I also don't see any problems with the current Autotools build.

@davydden
Copy link
Copy Markdown
Member

I would keep 'parallel-netcdf' as package name as it is self-explanatory, whereas pnetcdf to me sounds close to python namings (i.e. py-netcdf).

@tgamblin
Copy link
Copy Markdown
Member

@aprokop @citibeth: how about parallel for the variant name? We've used this on some other packages. I'm sometimes not a fan of it because parallel can mean MPI, OpenMP, pthreads, or whatever, but there is really only one type of parallel NetCDF and I think the concept of parallel I/O, at least in HPC, is fairly well understood. Decent compromise?

@citibeth
Copy link
Copy Markdown
Member

citibeth commented Nov 24, 2016 via email

@tgamblin
Copy link
Copy Markdown
Member

Going with parallel-netcdf as I'm leaning more towards that now that I see it's the same name as the dependency (so I think it is clearer). If people feel strongly please submit a new PR and we can debate the name.

@tgamblin tgamblin merged commit 8f0b91e into spack:develop Nov 24, 2016
citibeth pushed a commit to citibeth/spack that referenced this pull request Dec 4, 2016
- Added 'dap' and 'cdmremote' variants
  This is based on work in spack#2324 with the following motivation:
      Turn off DAP support by deafult.  DAP requires curl, which has issues
      with circular dependencies.  For 95% of NetCDF users that do not need
      DAP, turning it off avoides this rats nest of problems.
- Added 'parallel-netcdf' variant
  To support work with parallel-netcdf
- Added 'shared' and 'static' build separation
@aprokop aprokop deleted the netcdf_improve branch December 7, 2016 17:28
@skosukhin skosukhin mentioned this pull request Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants