-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
pnfft: new package #2646
pnfft: new package #2646
Conversation
from spack import * | ||
|
||
|
||
class Pnfft(AutotoolsPackage): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given those extra steps you do in install
, i think it should be plain Package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Nfft and Pfft packages also derive from AutotoolsPackage
and basically have package files identical to this one. Fftw derives from Package
, and it's got only slightly more extra code. So it's a bit inconsistent already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the simple answer is that, IMHO, they both should not use AutotoolsPackage
because they have custom implementation of install
anyway. Look at hdf5
for a good example where def configure_args(self):
is implemented in derived class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, changed it on all three packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from minor issue
@@ -25,7 +25,7 @@ | |||
from spack import * | |||
|
|||
|
|||
class Nfft(AutotoolsPackage): | |||
class Nfft(Package): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being moved from AutotoolsPackage
BACK to Package
? Without a good reason, that would seem to be the wrong direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we are overriding install
, see @davydden's comment, and for consistency with the fftw package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@citibeth in other words, AutotoolsPackage
package is NOT used here at all, the installation is still done via custom install()
as opposed to overriding def configure_args(self):
which is used in AutotoolsPackage
.
|
||
configure(*options) | ||
make() | ||
if self.run_tests: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be using Spack functionality for (1) AutotoolsPackage
and (2) running tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because we need to run the entire build process three times if float and long_double are enabled.
make("check") | ||
make("install") | ||
|
||
if '+float' in spec['fftw']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repetitive code her should be eliminated. Only the configure()
statement needs to go inside the if
block. (Although all this might go away with AutotoolsPackage
).
More importantly... I see that this is taking options from the dependencies and propagating them UP the DAG. It looks like a neat idea to me. @adamjstewart is this kosher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all applies to the nfft, pfft and fftw packages too as they use the same code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repetitive code her should be eliminated
one could do that by defining a custom function and calling it with options
(first parameter) and long double|float|...
as a second one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but my opinion is that this is not that important, so I vote to leave it as is.
three-dimensional nonequispaced FFTs.""" | ||
|
||
homepage = "https://www-user.tu-chemnitz.de/~potts/workgroup/pippig/software.php.en#pnfft" | ||
url = "https://www-user.tu-chemnitz.de/~potts/workgroup/pippig/software/pnfft-1.0.7-alpha.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now extra spaces after url
(PEP-8 compliance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's a problem. Every package has spaces after url. That's how spack create initializes them.
I see... I looked back at @tgamblin How about the alternative of having
I really feel that doing three separate builds in one package is against the spirit of Spack, and could cause problems down the line. Moving to one build will simplify FFTW --- and also simplify things that depend on FFTW (such as As for forwarding variants up the DAG in this PR... the more I think about it, the more I think we should not do it, at least not here. AFAIK, this would be the fisrt Spack package to work that way, all others forward variants top-down. Whatever the merits of this type of forwrading, it's better to just follow the way things have been done before. Putting these two suggestions together,
This would be simplified even further with #2386 |
I suppose it all boils down to this
I don't know much about packages which use some part of the code is using p.s. the situation is opposite to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the changes from AutotoolsPackage to Package. If you're not taking advantage of separate build phases, AutotoolsPackage is basically identical.
I don't mind variant forwarding up the dag. I think I've seen this once before. It's very clever, and a much better solution than trying to forward variants down the dag with our current broken logic.
I'm on the fence about whether to run configure/make/make install multiple times in the same package. It would make life easier if it only did things once and we could use AutotoolsPackage. It depends on how useful the resulting build is. I can see why someone would want to support all 3 in one library.
FFTW docs confirm that it is possible:
http://www.fftw.org/doc/Precision.html Consequently, I am not in favour of splitting |
OK, that's a convincing argument. So we're stuck with the crazy triple-build...
But it might not be in the future. My feeling is... if it uses Autotools, we should extend
In that case, should we be moving our other stuff to forward up the DAG? If we're going to make a change in policy, we should do it in a public way, not buried inside an obscure PR. However... I'm not so sure it's a good idea. There's an analog here with autotools/cmake. Suppose I have feature Another reason to not start casually forwarding variants up is that the variant is then undocumented. When you say Also... forwarding variants up only works if the forwarding comes from only one dependency. The Another problem is that (as done here), this trick only works for one level. If something depends on For all those reasons... let's please not go down this path until / unless we've thought it through and developed appropriate support for it. Whatever the pros/cons of the existing approach, there is no reason (that I can see) that would prevent this package from just following the established pattern. |
Ok, I have switched it back now and also made that change to the fftw package.
Let me add some background information about PFFT, NFFT and PNFFT: these are all (more or less) thin wrappers around FFTW. In an alternate universe, they might have been part of FFTW. Therefore, it makes no sense to build the [P|N|PN]FFT with flags other than those FFTW was built with. So even if forwarding the variant is not a good idea in general, it seems like a reasonable thing to do here.
In that case, it would need to check for
Strictly speaking, we have already gone down that path. The nfft and pfft packages already do exactly the same. |
Let's see what @tgamblin thinks.
…On Tue, Dec 20, 2016 at 2:58 PM, Michael Kuron ***@***.***> wrote:
But it might not be in the future. My feeling is... if it uses Autotools,
we should extend AutotoolsPackage, even if that's a NOP for now.
Ok, I have switched it back now and also made that change to the fftw
package.
In that case, should we be moving our other stuff to forward up the DAG?
Let me add some background information about PFFT, NFFT and PNFFT: these
are all (more or less) thin wrappers around FFTW. In an alternate universe,
they might have been *part* of FFTW. Therefore, it makes no sense to
build the [P|N|PN]FFT with flags other than those FFTW was built with. So
even if this is not a good idea in general, it seems like a reasonable
thing to do here.
Another problem is that (as done here), this trick only works for one
level. If something depends on nfft, it cannot check for 'float' in
spec['nfft'].
In that case, it would need to check for 'float' in spec['fftw'].
For all those reasons... let's please not go down this path until / unless
we've thought it through and developed appropriate support for it.
Strictly speaking, we have already gone down that path. The nfft and pfft
packages already do exactly the same.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2646 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd1InaA8m2XQ6CnnyINmIC3lr7mMCks5rKDNNgaJpZM4LRl5H>
.
|
As far as variant forwarding up the DAG goes, @tgamblin himself recommended this approach here: #491 (comment) |
Thanks for digging that up!
@davydden @becker33
I'd also like to see what he thinks about it now; especially after recent
discussions/designs on universal variants (bottom-up; #2492) and variant
forwarding (top-down; #2594). I feel we're in an in-between state where we
know there's a problem but don't know which solution(s) we wish to take.
…On Wed, Dec 21, 2016 at 12:54 PM, Adam J. Stewart ***@***.***> wrote:
As far as variant forwarding up the DAG goes, @tgamblin
<https://github.com/tgamblin> himself recommended this approach here: #491
(comment) <#491 (comment)>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2646 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd3taf9Q5q1uEQh5Kk6QgsD1Kf_z2ks5rKWfigaJpZM4LRl5H>
.
|
I am not opposed for forwarding variants up the DAG for bindings and other libraries that serve as wrapper layers. The key point of distinction for me is that no one uses pnfft or another wrapper without understanding that it in turn depends on fftw. I would not want to see the same forwarding applied to dealii and one of its many dependencies, because I would be concerned about that being hidden from the user. In general, I prefer variants to be forwarded down the DAG because that allows variants to be specified at the root level from the command line, which I think is the most intuitive interface. However, I don't think that this preference should be taken as rigid even if we agree unanimously, because for any heuristic there will invariably be cases in which the opposite is the most intuitive way to do things. |
Or override other phase methods to set them to `pass`? I really think if
it uses Autotools, it should subclass `AutotoolsPackage`. There are other
goodies we want to add, and removing the superclass will disable this.
…On Fri, Mar 24, 2017 at 3:04 PM, Adam J. Stewart ***@***.***> wrote:
***@***.**** requested changes on this pull request.
One last request, everything else looks good to me.
------------------------------
In var/spack/repos/builtin/packages/fftw/package.py:
> @@ -25,7 +25,7 @@
from spack import *
-class Fftw(Package):
+class Fftw(AutotoolsPackage):
This change should be undone. Otherwise, the package will run ./configure
and make before getting to the install() method.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2646 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd295n2EG_ziiFOkNjRZdtmkNWe7nks5rpBOkgaJpZM4LRl5H>
.
|
I don't think there's an easy way to convert either of these packages to |
How about:
```
def configure(self, spec, prefix):
pass
def build(self, spec, prefix):
pass
```
…On Fri, Mar 24, 2017 at 3:09 PM, Adam J. Stewart ***@***.***> wrote:
I don't think there's an easy way to convert either of these packages to
AutotoolsPackage. The problem is that AutotoolsPackage runs ./configure,
make, and make install. These packages run these steps 3 separate times. spack
build pnfft wouldn't even make sense in that context.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2646 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cdzDZbemv8mBNJwId0QVXyHG0aeqSks5rpBT-gaJpZM4LRl5H>
.
|
@citibeth What would be the benefit of that...? |
For example... we are contemplating putting a standardized `+shared/static`
and `+debug/run` variant onto `CMakePackage`. Then we get that
functionality across the board, rather than having to implement it again
and again on each package.
If there is anything that Autotools-based packages do across-the-board,
then we will want to implement that functionality in `AutotoolsPackage` as
well.
The superclass is, first and foremost, a declaration that "this package is
built with Autotools." Then Spack can do all sorts of things, including
running `make`, `make install`, etc, that are standard for Autootools-based
packages. The superclass has semantic meaning, it is *not* just a
"shortcut" on writing `install()` methods.
If a package is non-standard in one way, then the semantically correct
thing to do is to say "this package uses Autotools, except that these
things are different." That's what overriding `configure()` and `build()`
say in this case.
…On Fri, Mar 24, 2017 at 3:14 PM, Adam J. Stewart ***@***.***> wrote:
@citibeth <https://github.com/citibeth> What would be the benefit of
that...?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2646 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd_x57edE6kLxZzEdG7q-Mi7powVxks5rpBYggaJpZM4LRl5H>
.
|
shrugs I guess I'm fine with it using |
I see that |
Yes, that sounds like a better idea to me.
…On Fri, Mar 24, 2017 at 6:00 PM, Michael Kuron ***@***.***> wrote:
I see that class AutotoolsPackage contains phases = ['autoreconf',
'configure', 'build', 'install']. Would it make sense to replace that
with phases = ['autoreconf', 'install'] in the FFTW-derived packages?,
instead of passing on the non-implemented phases?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2646 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd1ae8Vw-wQbL1qCpKOGyR_0WEEzPks5rpD0EgaJpZM4LRl5H>
.
|
Ok, done. |
@mkuron I don't think the commands |
These commands cannot behave as expected since these packages do not allow separation of the build phases. The commands will just configure/build the double-precision version. |
@mkuron If the packages are such that you can build them out of source, I think the cleanest solution will be reordering the operations, i.e. do all the |
I am not sure of that. We have multiple calls to |
Separate out-of-source builds sound like a good idea. Will try that and update the pull request if it works. |
Ok, seems to be working. Please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this works, I like this design much better! Can you confirm that you can build all of these packages with all variants enabled?
# Base options | ||
options = [ | ||
'--prefix={0}'.format(prefix), | ||
'--enable-shared', | ||
'--enable-threads' | ||
] | ||
] + self.configure_args() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.configure_args()
will only contain --prefix
, right? That means it will be duplicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, the default configure()
adds --prefix
to configure_args()
. I still think we don't need this call if we know it's empty.
@@ -102,29 +103,56 @@ def install(self, spec, prefix): | |||
float_options.append('--enable-sse2') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't comment on lines that you didn't change, but there's an autoreconf
call up above. Might want to move that to the autoreconf
stage.
with working_dir('quad'): | ||
make("install") | ||
|
||
def check(self, spec, prefix): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this between build()
and install()
since that's when it runs.
|
||
# Build float/long double/quad variants | ||
# Build double/float/long double/quad variants | ||
with working_dir('double', create=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like double is the only one that isn't optional. Maybe we should make this one a variant too just for uniformity?
I addressed your comments and looked over all my changes again. I've successfully tested a representative sample of variants of FFTW along with NFFT. As PFFT and PNFFT have otherwise identical package files, those will also work. |
I'm sure this could be simplified further with a list of variants and for loops that declare the variants, check to see if they're activate, create a working directory, and run make. But I'm satisfied with the way things are now. Does anyone else have any requests or is this good to merge? |
@mkuron @adamjstewart If it is fine with you, I can take care of further simplifications in another PR. |
* 'develop' of https://github.com/LLNL/spack: pnfft: new package (spack#2646)
* pnfft: new package * Convert some packages with overridden install from AutotoolsPackage to Package * pnfft: fix URL * Switch FFTW-derived packages back to AutotoolsPackage * Disable unneeded build phases in FFTW and derived packages * Separate build phases for FFTW and derived packages * Fix broken merge * fftw: pfft_patches for 3.3.6 * fftw: address @adamjstewart’s review comments
* pnfft: new package * Convert some packages with overridden install from AutotoolsPackage to Package * pnfft: fix URL * Switch FFTW-derived packages back to AutotoolsPackage * Disable unneeded build phases in FFTW and derived packages * Separate build phases for FFTW and derived packages * Fix broken merge * fftw: pfft_patches for 3.3.6 * fftw: address @adamjstewart’s review comments
* pnfft: new package * Convert some packages with overridden install from AutotoolsPackage to Package * pnfft: fix URL * Switch FFTW-derived packages back to AutotoolsPackage * Disable unneeded build phases in FFTW and derived packages * Separate build phases for FFTW and derived packages * Fix broken merge * fftw: pfft_patches for 3.3.6 * fftw: address @adamjstewart’s review comments
* pnfft: new package * Convert some packages with overridden install from AutotoolsPackage to Package * pnfft: fix URL * Switch FFTW-derived packages back to AutotoolsPackage * Disable unneeded build phases in FFTW and derived packages * Separate build phases for FFTW and derived packages * Fix broken merge * fftw: pfft_patches for 3.3.6 * fftw: address @adamjstewart’s review comments
PNFFT is a library for parallel non-equispaced FFTs and kind of combines #2255 (parallel FFT) and #2612 (non-equispaced FFT).