electronic-structure / SIRIUS

Domain specific library for electronic structure calculations
BSD 3-Clause "New" or "Revised" License
122 stars 40 forks source link

sirius conda package on conda-forge? #621

Closed ltalirz closed 3 years ago

ltalirz commented 3 years ago

Hi guys, I was wondering whether there is interest in creating a conda package for sirius.

While a conda sirius won't get you optimal performance for your machine, the pre-built binaries make it much easier and faster for new prospective users to give it a try.

Most of the core Sirius dependencies already are on conda-forge; I guess one would just need to add spfft and spla. There is even a way to build gpu-enabled packages, but I have no experience with this so far.

I'm happy to help with this but I'm sure I'll also need some advice from the maintainers on how to best build the libraries.

P.S. QE, cp2k, lammps, abinit, siesta, etc. are already on conda-forge.

toxa81 commented 3 years ago

@AdhocMan Simon, if it starts from spla and spfft, can I ask you to have a look?

AdhocMan commented 3 years ago

I don't have any experience writing conda packages, but I'd certainly be happy to help. This is a first attempt for SpFFT, which seems to be working, and may be useful as a starting point:

{% set name = "spfft" %}
{% set version = "1.0.2" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/eth-cscs/SpFFT/archive/refs/tags/v{{ version }}.tar.gz
  sha256: 541f6d92993655b68404cfea60d84ce0a7644eed49dff7e7437db818127700f9

requirements:
  build:
    - {{ compiler('cxx') }}
    - {{ compiler('fortran') }}
    - make
    - cmake >=3.11.0
  host:
    - {{ mpi }}
    - fftw
  run:
    - {{ mpi }}

test:
  commands:
    - test -f "${PREFIX}/lib64/libspfft${SHLIB_EXT}" || test -f "${PREFIX}/lib/libspfft${SHLIB_EXT}"

about:
  home: https://github.com/eth-cscs/SpFFT.git
  license: BSD 3-Clause
  license_family: BSD
  license_file: LICENSE
  summary: Sparse 3D FFT library
  doc_url: https://spfft.readthedocs.io/en/latest/?badge=latest
  dev_url: https://github.com/eth-cscs/SpFFT

And build.sh:

mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="${PREFIX}"  -DSPFFT_MPI=ON -DSPFFT_OMP=ON -DSPFFT_GPU_BACKEND=OFF -DSPFFT_GPU_DIRECT=OFF -DSPFFT_SINGLE_PRECISION=ON -DSPFFT_STATIC=OFF -DSPFFT_FORTRAN=ON -DSPFFT_BUILD_TESTS=OFF
make -j2 install
ltalirz commented 3 years ago

thanks a lot @AdhocMan for preparing the recipe I just opened a corresponding PR to conda-forge https://github.com/conda-forge/staged-recipes/pull/14605

do you agree that I list you among the maintainers of the conda feedstock for spfft? nowadays, the update process of conda-forge packages is largely automated (e.g. it should realize when you make a new spfft release on github, and then will automatically create a corresponding PR to update your feedstock that you just need to check & merge)

toxa81 commented 3 years ago

Hi Leopold @ltalirz! Just out of my personal curiosity: why do you need Sirius package on Conda? Do you distribute CP2K/QE/SIRIUS packages for AiiDA users through Conda-forge?

ltalirz commented 3 years ago

Hi Anton, thanks for asking.

If you have the binaries of your code on conda-forge, you can e.g. publish a conda environment.yml together with a paper and thereby make it very easy for others to reproduce your results and play around with the code. With respect to other package managers, the advantage of conda is the multi-platform support (windows, linux, mac + different processor architectures) as well as their great CI setup that makes it easy to do "standardized" builds as well as to keep them up to date.

I've been discussing the conda question with @nicolamarzari already for some time and I personally think it would be very useful to have all MaX codes present on conda-forge - most of them already are:

qe: https://github.com/conda-forge/qe-feedstock siesta: https://github.com/conda-forge/siesta-feedstock abinit: https://github.com/conda-forge/abinit-feedstock cp2k: https://github.com/conda-forge/cp2k-feedstock aiida: https://github.com/conda-forge/aiida-core-feedstock

Missing are: fleur bigdft yambo

I think this is particularly important for the MaX libraries - after all, the main reason for developing those is for other codes to use and build upon them, so let's make it easy to depend on them! Until we started here they were all missing:

chess laxlib / fftxlib sirius dbcsr cosma spfft (now present) spla (now present)

Finally, to come back to your question: Of course, this is also interesting from the AiiDA/Quantum Mobile perspective: For Quantum Mobile, using conda could allow us to drastically reduce build times for the VM image. Also, since conda packages are likely to find a wider user base than our ansible roles, the motivation from the code developer side to contribute to their maintenance is larger.

For AiiDA, the conda package and its version could be recorded in the provenance graph, making it easy to re-run a specific workflow execution locally.

Cheers, Leo

ltalirz commented 3 years ago

thanks a lot for taking this up, in particular @AdhocMan !

https://github.com/conda-forge/sirius-feedstock

Next on my list is to enable the sirius switch in the cp2k conda package ;-)