8000 spack cmake package. · Issue #42 · dev-zero/cp2k · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

spack cmake package. #42

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 8000 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
haampie opened this issue Jan 8, 2021 · 1 comment
Open

spack cmake package. #42

haampie opened this issue Jan 8, 2021 · 1 comment

Comments

@haampie
Copy link
haampie commented Jan 8, 2021

I've tried to build this feature/cmake branch with spack. My package currently looks like this:

# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *


class Cp2kCmake(CMakePackage):
    """CP2K is a quantum chemistry and solid state physics software package
    that can perform atomistic simulations of solid state, liquid, molecular,
    periodic, material, crystal, and biological systems
    """

    homepage = "https://www.cp2k.org"
    url      = "https://github.com/dev-zero/cp2k"
    git      = "https://github.com/dev-zero/cp2k.git"

    version('develop', branch='feature/cmake')

    build_directory = 'spack-build'

    variant('mpi', default=True, description='Enable MPI support')
    variant('smm', default='libxsmm', values=('libxsmm', 'libsmm', 'blas'),
            description='Library for small matrix multiplications')

    depends_on('blas')
    depends_on('lapack')
    depends_on('fftw-api@3')
    depends_on('mpi@2:', when='+mpi')

    depends_on('dbcsr')
    depends_on('libxsmm@1.11:~header-only', when='smm=libxsmm')

    # Build dependencies
    depends_on('python', type='build')
    depends_on("py-fypp", type="build")
    depends_on("pkgconfig", type='build')

    conflicts('smm=libxsmm',  when='target=aarch64:', msg='libxsmm is not available on arm')
    
    # Make sure dependencies use openmp threading
    conflicts('^fftw~openmp')
    conflicts('^openblas threads=none')
    conflicts('^openblas threads=pthreads')

    def cmake_args(self):
        return [
            self.define_from_variant('USE_MPI', 'mpi'),
        ]

I had to fix:

  • two build errors, one about get_accdrv_active_device_id not being exported from dbcsr, so I patched dbcsr locally. And another one about truncated lines due to CPABORT calls, which is just trimmed a bit.
  • adding a make install target: Install cp2k binaries #41

I create the following environment file in the parent folder where I had cloned both cp2k and dbcsr:

$ ls
cp2k  dbcsr  spack.yaml
$ cat spack.yaml 
spack:
  specs: 
    - cp2k-cmake@develop %gcc@:9 ^openblas threads=openmp ^dbcsr@develop +openmp +cuda cuda_arch=70 ^cuda@:11.0 ^fftw +openmp
  develop:
    cp2k-cmake:
      path: ./cp2k
      spec: cp2k-cmake@develop
    dbcsr:
      path: ./dbcsr
      spec: dbcsr@develop
$ spack -e . install -v
...
[+] /home/harmen/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/cp2k-cmake-develop-aytliij634jsqmkoybvbefdm6qojl3dy

and it works just fine. I wonder if the spack package would get a lot shorter after migration to cmake.

I'm just leaving this here, cause I don't know where else to share it.

@haampie
Copy link
Author
haampie commented Jan 8, 2021

The main difference here is I've added dbcsr as a dependency. I think this is much better than relying on submodules :).

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

No branches or pull requests

1 participant
0