Skip to content

Allowing "download install" for petsc#1114

Merged
boegel merged 5 commits intoeasybuilders:developfrom
ComputeCanada:add_download_install_option_for_petsc
Mar 14, 2017
Merged

Allowing "download install" for petsc#1114
boegel merged 5 commits intoeasybuilders:developfrom
ComputeCanada:add_download_install_option_for_petsc

Conversation

@mboisson
Copy link
Copy Markdown
Contributor

When compiling petsc with "--download-" configure options, these are installed in the installation directory in the configure step.

The installation directory should therefore be created (and purged if there was an existing one) BEFORE the configure step. It should also be kept after the configure step (rather than cleaned up before the install step).

This patch enables this when "downloadinstall" is set in the easy config.

Comment thread easybuild/easyblocks/p/petsc.py Outdated
if LooseVersion(self.version) >= LooseVersion("3"):
# make the install dir first if we are doing a download install, then keep it for the rest of the way
if self.cfg["downloadinstall"]:
self.log.info("Creating the installation directory before the configure step because we are doing a download install.")
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.

style nitpicking: this line is too long, should be <= 120 characters...

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.

The new comment line is also shorter.

@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 24, 2017

@mboisson maybe the name of the new easyconfig parameter should be more directly related to what is actually happening, e.g. create_installdir_before_configure

Either that, or enabling downloadinstall should result in automatically adding all the --download-* configuration options (not sure if that's feasible or desirable)

@mboisson
Copy link
Copy Markdown
Contributor Author

Well, it also prevents the install dir from being removed after the configure step, so I'm not sure the new name is better.

Adding all the "--download-*" configuration option is not possible. There are ~300 of those, most of them not frequently used by end users.

@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 24, 2017

@mboisson the fact that the installdir isn't being removed is implied, without that there's little point in creating it early...

I just find it confusing that the downloadinstall has nothing to do with downloading stuff directly...

@mboisson
Copy link
Copy Markdown
Contributor Author

Would it be less confusing if there was a second parameter called
download_packages
in which one would list the packages they want downloaded and then petsc.py would add them to the configure options ?

@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 24, 2017

@mboisson that makes sense, and then you don't need to have downloadinstall anymore, since listing stuff in download_packages would imply that the install dir needs to be created early

@mboisson
Copy link
Copy Markdown
Contributor Author

Allright. I'll modify the PR for that.

@mboisson
Copy link
Copy Markdown
Contributor Author

I ended up adding 3 options
download_packages => --download-X=1
download_packages_shared => --download-X=1 --download-X-shared=1
download_packages_static => --download-X=1 --download-X-shared=0

Comment thread easybuild/easyblocks/p/petsc.py Outdated
for p in self.cfg["download_packages"]:
self.cfg.update('configopts', '--with-download-%s=1' % p)
if self.cfg["download_packages_static"]:
for p in self.cfg["download_packages_static"]:
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.

@mboisson maybe make the default value an empty list [], which avoids the extra if check?

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.

done

Comment thread easybuild/easyblocks/p/petsc.py Outdated
self.cfg.update('configopts', '--with-download-%s=1' % p)
self.cfg.update('configopts', '--with-download-%s-shared=0' % p)
if self.cfg["download_packages_shared"]:
for p in self.cfg["download_packages_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.

no single-letter variables outside of list comprehensions please

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.

changed it for "dep" (and download_deps_* for the lists)

Comment thread easybuild/easyblocks/p/petsc.py Outdated
self.cfg.update('configopts', '--with-download-%s-shared=0' % p)
if self.cfg["download_packages_shared"]:
for p in self.cfg["download_packages_shared"]:
self.cfg.update('configopts', '--with-download-%s=1' % p)
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.

quite a bit of duplicate code here, so how about this (I also renamed to download_deps*, which is shorter and avoids confusion with 'packages' like extra Python packages/extensions, etc...)

for dep in self.cfg['download_deps'] + self.cfg['download_deps_shared'] + self.cfg['download_deps_static']:
    self.cfg.update('configopts', '--with-download-%s=1' % dep)
for dep in self.cfg['download_packages_shared']:
    self.cfg.update('configopts', '--with-download-%s-shared=1' % dep)
for dep in self.cfg['download_packages_static']:
    self.cfg.update('configopts', '--with-download-%s-shared=0' % dep)

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.

Done. I also added a "set" directive to make sure that if dependencies are listed multiple times, they are not included in the configure option multiple times.

Comment thread easybuild/easyblocks/p/petsc.py Outdated
'runtest': ['test', "Make target to test build", BUILD],
'download_packages_static': [None, "Lists the packages that should be downloaded and installed without shared objects", CUSTOM],
'download_packages_shared': [None, "Lists the packages that should be downloaded and installed with shared objects", CUSTOM],
'download_packages': [None, "Lists the packages that should be downloaded and installed without specifying static or shared (used the default for the package)", CUSTOM],
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.

keep the max. line length of 120 characters in mind please

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.

Shortened the lines

Comment thread easybuild/easyblocks/p/petsc.py Outdated
self.cfg["keeppreviousinstall"] = True
deps = set( self.cfg["download_deps"]
+ self.cfg["download_deps_static"]
+ self.cfg["download_deps_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.

the wrapping makes this a bit messy, and you need to full list of deps in two places, so how about:

        if LooseVersion(self.version) >= LooseVersion("3"):
            deps = self.cfg["download_deps"] + self.cfg["download_deps_static"] + self.cfg["download_deps_shared"]
            if deps:
                # make the install dir first if we are downloading dependencies, then keep it for the rest of the way
                ...
                for dep in set(deps):
                    ...

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.

done

@mboisson
Copy link
Copy Markdown
Contributor Author

I believe all the changes requested have been done.

@boegel boegel modified the milestones: 3.1.2, 3.2.0 Mar 14, 2017
@boegel
Copy link
Copy Markdown
Member

boegel commented Mar 14, 2017

lgtm, doesn't affect existing PETSc easyconfigs, and already tested in the wild (cfr. https://lists.ugent.be/wws/arc/easybuild/2017-03/msg00061.html)

so, going in, thanks @mboisson!

@boegel boegel merged commit 4454c8b into easybuilders:develop Mar 14, 2017
@mboisson mboisson deleted the add_download_install_option_for_petsc branch March 14, 2017 15:41
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.

2 participants