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

espressopp: package for the ESPResSo++ software #2602

Merged
merged 5 commits into from
Jan 6, 2017

Conversation

junghans
Copy link
Contributor

This commit add a package for the ESPResSo++
simulation software.

homepage = "https://espressopp.github.io"
url = "https://github.com/espressopp/espressopp/archive/v1.9.3.zip"

version('master', git='https://github.com/espressopp/espressopp.git', branch='master')
Copy link
Member

Choose a reason for hiding this comment

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

rename master to develop, otherwise master < 1.9.3 in version comparisons

Copy link

@fedepad fedepad Dec 16, 2016

Choose a reason for hiding this comment

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

Done!

depends_on("cmake@2.8:", type='build')
depends_on("mpi", type=('build', 'link', 'run'))
depends_on("boost@:1.61.0+serialization+filesystem+system+python+mpi", when='@master', type=('build', 'link', 'run'))
depends_on("boost@1.56.0+python+mpi+filesystem+system+serialization", when='@1.9.3', type=('build', 'link', 'run'))
Copy link
Member

Choose a reason for hiding this comment

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

other versions don't depend on boost? Why is it specific 1.56.0?


depends_on("cmake@2.8:", type='build')
depends_on("mpi", type=('build', 'link', 'run'))
depends_on("boost@:1.61.0+serialization+filesystem+system+python+mpi", when='@master', type=('build', 'link', 'run'))
Copy link
Member

Choose a reason for hiding this comment

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

something wrong with 1.62.0? if you support it, then don't constrain the version at all.

Copy link

Choose a reason for hiding this comment

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

Because at the time I wrote it wasn't tested with 1.62; will check now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

@junghans I guess for the master branch I can remove the version restriction right? Can you confirm that with 1.62 works fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1.9.3 is two years old! So I would say, just drop all versions below 1.9.4 and all boost restrictions with it.

Copy link

Choose a reason for hiding this comment

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

Done! I just put a restriction on the latest cmake, as I remember the system FindBoost.cmake in earlier versions wasn't updated to cover the case boost 1.62.

url = "https://github.com/espressopp/espressopp/archive/v1.9.3.zip"

version('master', git='https://github.com/espressopp/espressopp.git', branch='master')
version('1.9.3', git='https://github.com/espressopp/espressopp.git', tag='v1.9.3')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually we could add 1.9.4, too.

Copy link

@fedepad fedepad Dec 16, 2016

Choose a reason for hiding this comment

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

Done!

@fedepad
Copy link

fedepad commented Dec 16, 2016

I rebased, squashed the commits and pushed. Hope it's ok.

variant('dg', default=False, description='Build developer guide')
variant('tests', default=False, description='Run the tests')

depends_on("cmake@3.7.1:", type='build')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think cmake>=2.8 is enough.

depends_on("boost+serialization+filesystem+system+python+mpi", when='@1.9.4:', type=('build', 'link', 'run'))
extends("python")
depends_on("python@2:")
depends_on("py-mpi4py@2.0.0", when='@1.9.4:', type=('build', 'link', 'run'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the develop version the dependency is back to mpi4py>=1.3.1.

# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################

Copy link
Member

Choose a reason for hiding this comment

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

i don't think you need those two lines, i would suggest removing both

Copy link

Choose a reason for hiding this comment

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

It would be three lines actually, as the whole sentence starts one line above these two...
BTW, I see those lines in other packages, e.g. yaml-cpp, adios, just to mention two.
Just let me know what to do in this case, I can throw away those three lines or keep them ;)

Copy link

Choose a reason for hiding this comment

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

What do we do with this?

options.append('-DCMAKE_BUILD_TYPE:STRING=Debug')
else:
options.append('-DCMAKE_BUILD_TYPE:STRING=Release')
options.extend(std_cmake_args)
Copy link
Member

Choose a reason for hiding this comment

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

i think you need to put std_cmake_args in front, otherwise IIRC cmake will pick up CMAKE_BUILD_TYPE from there instead of those you are setting above.

Copy link
Member

Choose a reason for hiding this comment

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

@adamjstewart @alalazo This package should be subclassing CMakePackage and not writing its own install() method. Please grep for CMakePackage in the repository for other examples.

Copy link

Choose a reason for hiding this comment

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

I know about CMakePackage , but at the time I wrote it (a while ago) CMakePackage was kind of broken and almost no package using Cmake had implemented that way. I could turn into that ;)

Copy link
Member

Choose a reason for hiding this comment

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

Things have evolved. CMakePackage is now preferred, and we are (slowly) converting old stuff to it.

Copy link

Choose a reason for hiding this comment

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

Ok, good to know, thanks! Then I will convert to that!

options.extend(std_cmake_args)
with working_dir('build', create=True):
cmake('..', *options)
make("clean")
Copy link
Member

Choose a reason for hiding this comment

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

out of curiosity, why do you need this?

Copy link
Member

Choose a reason for hiding this comment

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

That issue will probably jsut go away once this converts to CMakePackage.

make("ug-pdf", parallel=False)
if '+dg' in spec:
make("doc", parallel=False)
if '+tests' in spec:
Copy link
Member

Choose a reason for hiding this comment

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

remove test variant and use self.run_tests: instead. The reasons is that running tests does not change the installed package per-se, it's not really a variant in this sense. It's just an option. see #2605

Copy link

Choose a reason for hiding this comment

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

Agree it's not a variant per se. At the time I was confused how to reproduce that step and that was the hack I used. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Has the self.run_tests stuff made it into the docs yet?

Copy link
Member

Choose a reason for hiding this comment

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

Has the self.run_tests stuff made it into the docs yet?

apparently not.


depends_on("cmake@3.7.1:", type='build')
depends_on("mpi", type=('build', 'link', 'run'))
depends_on("boost+serialization+filesystem+system+python+mpi", when='@1.9.4:', type=('build', 'link', 'run'))
Copy link
Member

Choose a reason for hiding this comment

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

i don't think you need boost as run dependency. You link against it and that's it. Same with mpi above and fftw below.

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

Choose a reason for hiding this comment

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

Agree. In one my previous version I didn't have ('build', 'link', 'run') everywhere but as you said. I will revert back to that!

Copy link
Member

Choose a reason for hiding this comment

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

i don't think you need boost as run dependency. You link against it and that's it.

I suppose we could remove 'run' from a lot of our dependencies.

Same with mpi above

How is MPI not a run dependency, when you need mpirun to launch it?

Copy link
Member

Choose a reason for hiding this comment

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

How is MPI not a run dependency, when you need mpirun to launch it?

you don't need it per-se. Anything that is build with MPI can be run as ./executable with single mpi core.

Copy link
Member

Choose a reason for hiding this comment

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

True in theory. But I would say that in practice, MPI is a run dependency. We don't build with MPI just to run single-core.

Copy link
Member

Choose a reason for hiding this comment

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

@citibeth I of course agree, but I am not sure this is the intended usage, from docu

“run”: the project is used by the project at runtime. The package will be added to PATH and PYTHONPATH.

so it looks like it will matter only for spack load espressopp, but no packages so far declare mpi as run dependency.

@tgamblin @mathstuf : don't remember who added dependency types, but could you comment on run 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.

run is only 100% necessary when the code does exec("mpiexec") or similar. Other than that, I'd put it as a "does one usually use via mpiexec or not?" question where the threshold for "usually" is really low.

depends_on("mpi", type=('build', 'link', 'run'))
depends_on("boost+serialization+filesystem+system+python+mpi", when='@1.9.4:', type=('build', 'link', 'run'))
extends("python")
depends_on("python@2:")
Copy link
Member

Choose a reason for hiding this comment

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

Does this work with Python3, or only Python2? If just Python2, it should be depends_on('python@2:2.7').

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this package builds a Python extension?? If so, is the extension REQUIRED for this package to work? Or are there viable use cases in which you can run this software without the extension? If the latter, then you need to add a +python variant, default it to false, and do something like this:

    extends('python', when='+python')
    depends_on('python@3:', when='+python')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It only works with python2 and builds a python module, which includes a shared object.

Copy link
Member

Choose a reason for hiding this comment

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

Is Espresso++ still useful without the Python module? If so, +python should be a variant, for those who wish to use the non-Python parts of it without building a Python stack.

Copy link

Choose a reason for hiding this comment

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

Doesn't work at the moment with Python3.
Doesn't depends_on("python@2:") already cover for that (Any version of the Python2)?

Copy link

Choose a reason for hiding this comment

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

Yes, it builds a python extension which is required when one runs the scripts, so I think what's there in now for this it's ok.

Copy link
Member

Choose a reason for hiding this comment

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

depends_on("python@2:") requires any version of python from 2.0 to current. You want something like depends_on("python@2:2.7.13") (the last python2 version).

url = "https://github.com/espressopp/espressopp/archive/v1.9.4.zip"

version('develop', git='https://github.com/espressopp/espressopp.git', branch='master')
version('1.9.4', git='https://github.com/espressopp/espressopp.git', tag='v1.9.4')
Copy link
Member

Choose a reason for hiding this comment

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

Versioned releases need to have a stable checksum. You can either: (a) specify a specific git hash (which will never change) instead of a git tag (which could conceivably change, even if policy is that it won't), or (b) use HTTP tarball download instead (you don't have to change stuff on GitHub, just use something like this in your Spack package: url = "https://github.com/citibeth/icebin/tarball/v0.1.0"

Copy link

Choose a reason for hiding this comment

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

OK!

Copy link

Choose a reason for hiding this comment

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

I'm back! I used spack checksum, should be fine right?


depends_on("cmake@3.7.1:", type='build')
depends_on("mpi", type=('build', 'link', 'run'))
depends_on("boost+serialization+filesystem+system+python+mpi", when='@1.9.4:', type=('build', 'link', 'run'))
Copy link
Member

Choose a reason for hiding this comment

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

i don't think you need boost as run dependency. You link against it and that's it.

I suppose we could remove 'run' from a lot of our dependencies.

Same with mpi above

How is MPI not a run dependency, when you need mpirun to launch it?

options.append('-DCMAKE_BUILD_TYPE:STRING=Debug')
else:
options.append('-DCMAKE_BUILD_TYPE:STRING=Release')
options.extend(std_cmake_args)
Copy link
Member

Choose a reason for hiding this comment

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

@adamjstewart @alalazo This package should be subclassing CMakePackage and not writing its own install() method. Please grep for CMakePackage in the repository for other examples.

options.extend(std_cmake_args)
with working_dir('build', create=True):
cmake('..', *options)
make("clean")
Copy link
Member

Choose a reason for hiding this comment

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

That issue will probably jsut go away once this converts to CMakePackage.

make("ug-pdf", parallel=False)
if '+dg' in spec:
make("doc", parallel=False)
if '+tests' in spec:
Copy link
Member

Choose a reason for hiding this comment

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

Has the self.run_tests stuff made it into the docs yet?

@citibeth
Copy link
Member

citibeth commented Dec 16, 2016 via email

@fedepad
Copy link

fedepad commented Dec 18, 2016

@citibeth Thanks for the clarification on the python version dependency, I will change according to that!

@citibeth
Copy link
Member

citibeth commented Dec 21, 2016 via email

@fedepad
Copy link

fedepad commented Jan 4, 2017

@citibeth I subclassed from CMakePackage now. Our package has few targets like make doc, etc.
So how do you specify them now? Because in almost all CMakePackages in the repo I haven't seen these custom targets, but I've only seen the cmake_args method. So where/inside what should I place them?

@citibeth
Copy link
Member

citibeth commented Jan 4, 2017

@fedepad Unfortunately, CMakePackage is currently undocumented.
@adamjstewart @alalazo Do you know the answers to these questions?

@fedepad
Copy link

fedepad commented Jan 4, 2017

@citibeth @alalazo @adamjstewart Ok, looking the code:
https://github.com/LLNL/spack/blob/17b13b161b3ddcd691ea7ed90165cfab6dec3950/lib/spack/spack/build_systems/cmake.py
Looks like one can override the build and install method to accomplish that...maybe!

@adamjstewart
Copy link
Member

adamjstewart commented Jan 4, 2017

Our package has few targets like make doc, etc. So how do you specify them now?

I believe it would look something like this:

def build(self, spec, prefix):                                              
    with working_dir(self.build_directory()):                               
        make()
        make('docs')

You can see how CMakePackage works by taking a look through lib/spack/spack/build_systems/cmake.py.

Alternatively, if you want make and make docs to be separate phases, you could do:

phases = ['cmake', 'build', 'build_docs', 'install']

def build_docs(self, spec, prefix):                                              
    with working_dir(self.build_directory()):                               
        make('docs')

although I don't see any particular advantage to this.

@alalazo We should probably allow users to specify a list of build targets like we did for AutotoolsPackage. Let me submit a PR to do that.

@fedepad
Copy link

fedepad commented Jan 4, 2017

Please review with the latest changes. Main logic should be there. Remain to clarify the "type" (build, link, run) for some of the dependencies, otherwise, I would keep it like that until we are 100% sure.
Also, if/when #2742 gets in, we can move the overridden build method which has custom targets with the new way introduced in the PR, namely build,install targets as a list.

variant('dg', default=False, description='Build developer guide')

depends_on("cmake@2.8:", type='build')
depends_on("mpi", type=('build', 'link', 'run'))
Copy link
Member

Choose a reason for hiding this comment

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

In general, the default type is fine for most dependencies. So for all of these dependencies that specify type=('build', 'link', 'run'), I would remove that.

py-mpi4py may be an exception. I usually use type='nolink' for Python dependencies.

depends_on("texlive", when="+pdf", type='build')
depends_on("doxygen", when="+dg", type='build')

run_tests = True
Copy link
Member

Choose a reason for hiding this comment

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

You probably don't want this in here. Tests are buggy depending on what OS you are on. For example, if someone wants to build espressopp on bgq, the tests may not work. If you hard-code run_test = True in here, what you're saying is you cannot install the package unless the tests pass. This may be fine for you, but it may not be fine for other users. I would remove this line. You can specify it on the command line when you install:

spack install --run-tests espressopp

Copy link

Choose a reason for hiding this comment

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

Ok! Thanks!

@junghans
Copy link
Contributor Author

junghans commented Jan 5, 2017

ping @davydden

Copy link
Member

@davydden davydden left a comment

Choose a reason for hiding this comment

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

LGTM apart from a minor issue

depends_on("boost+serialization+filesystem+system+python+mpi", when='@1.9.4:')
extends("python")
depends_on("python@2:2.7.13")
depends_on("py-mpi4py@2.0.0", when='@1.9.4:', type='nolink')
Copy link
Member

Choose a reason for hiding this comment

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

develop satisfies this "when" condition. Add some reasonable upper bound to the range

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is already back to >= py-mpi4py-1.3.1 in v1.9.4.1, so only v1.9.4 needs >=py-mpi-2.

Copy link

Choose a reason for hiding this comment

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

Check latest commit...

@fedepad
Copy link

fedepad commented Jan 6, 2017

Somehow my comment might have disappeared...anyway, check the latest commit.

depends_on("boost+serialization+filesystem+system+python+mpi", when='@1.9.4:')
extends("python")
depends_on("python@2:2.7.13")
depends_on("py-mpi4py@2.0.0", when='@1.9.4', type='nolink')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be py-mpi4py@2.0.0: (adding :)

Copy link

Choose a reason for hiding this comment

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

Ok, but that means that 1.9.4 should work with mpi4py>=2.0.0 while I think we can guarantee for mpi4py=2.0.0., or? Just let me know what to do and I can add that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can never guarantee that a package will work with a future version ;-). But in https://github.com/espressopp/espressopp/blob/cdf24abc7f08e2c0fda8ad5bdb6041fe03471873/CMakeLists.txt#L147 we required mpi4py-2.0 or higher.

Copy link

Choose a reason for hiding this comment

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

Ok, I'll add that and push!

This commit adds a package for the ESPResSo++
simulation software.
Federico Padua added 4 commits January 6, 2017 04:18
This commit moves Espressopp package to CMakePackage.
Addresses some comments in the PR.
Addressed some comments from @adamjstewart.
Removed global run_tests setting and removed type from many
dependencies. Set type for py-mpi4py to 'nolink'.
Added latest espressopp version and changed mpi4py (version) dependency for
different espressopp versions.
Changed py-mpi4py version requirements for espressopp@1.9.4 according
to the package build requirements for that version.
@fedepad
Copy link

fedepad commented Jan 6, 2017

@junghans Check latest...

@junghans
Copy link
Contributor Author

junghans commented Jan 6, 2017

LGTM!

@tgamblin tgamblin merged commit 8dc0561 into spack:develop Jan 6, 2017
@junghans
Copy link
Contributor Author

junghans commented Jan 6, 2017

Also fixes espressopp/espressopp#130.

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.

None yet

8 participants