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

Build HEAD of v2.10 branch, enabling metatensor #5

Open
wants to merge 7 commits into
base: cecam-2023
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.13.sdk # [osx and x86_64]
- /opt/MacOSX11.0.sdk # [osx and arm64]
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04 , macos-11]
os: [ubuntu-22.04, macos-11, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -23,29 +23,31 @@ jobs:
export MAKEFLAGS=-j3
conda create --name build
source activate build
conda-build -c conda-forge plumed
conda-build -c conda-forge gromacs
conda-build -c conda-forge lammps
conda-build -m .github/conda_build_config.yaml -c conda-forge plumed
Copy link
Member

@GiovanniBussi GiovanniBussi Oct 14, 2024

Choose a reason for hiding this comment

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

Useful trick (-m), so that we have them in a single place, thanks!

Copy link
Author

Choose a reason for hiding this comment

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

Yes! And this is intentionally not in the repository root, to prevent it from being picked on local builds: https://docs.conda.io/projects/conda-build/en/latest/resources/variants.html#conda-build-variant-config-files

conda-build -m .github/conda_build_config.yaml -c conda-forge py-plumed
conda-build -m .github/conda_build_config.yaml -c conda-forge gromacs
conda-build -m .github/conda_build_config.yaml -c conda-forge lammps
- name: Deploy
env:
CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }}
run: |
source activate base # needed to have correct CONDA_PREFIX
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l cecam-2023 $CONDA_PREFIX/conda-bld/*/lammps*.tar.bz2 --force
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l cecam-2023 $CONDA_PREFIX/conda-bld/*/plumed*.tar.bz2 --force
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l cecam-2023 $CONDA_PREFIX/conda-bld/*/gromacs*.tar.bz2 --force
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l tutorials-2024 $CONDA_PREFIX/conda-bld/*/lammps*.tar.bz2 --force
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l tutorials-2024 $CONDA_PREFIX/conda-bld/*/plumed*.tar.bz2 --force
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l tutorials-2024 $CONDA_PREFIX/conda-bld/*/py-plumed*.tar.bz2 --force
anaconda -t $CONDA_UPLOAD_TOKEN upload -u plumed -l tutorials-2024 $CONDA_PREFIX/conda-bld/*/gromacs*.tar.bz2 --force
- name: Test
run: |
conda create --name plumed-masterclass
conda create --name plumed-masterclass
source activate plumed-masterclass
conda install -y -c conda-forge plumed py-plumed numpy pandas matplotlib notebook mdtraj mdanalysis git
# check if python module is working
python -c "import plumed; p=plumed.Plumed(); print(p)"
# first install serial gromacs
conda install -y --strict-channel-priority -c plumed/label/masterclass -c conda-forge gromacs
# then replace with parallel gromacs and plumed
conda install -y --strict-channel-priority -c plumed/label/cecam-2023 -c conda-forge plumed
conda install -y --strict-channel-priority -c plumed/label/cecam-2023 -c conda-forge gromacs
conda install -y --strict-channel-priority -c plumed/label/tutorials-2024 -c conda-forge plumed
conda install -y --strict-channel-priority -c plumed/label/tutorials-2024 -c conda-forge gromacs
# check if python module is working
python -c "import plumed; p=plumed.Plumed(); print(p)"
cd test
Expand All @@ -55,7 +57,7 @@ jobs:
cat dir*/colvar*.dat
# install lammps
cd -
conda install -y --strict-channel-priority -c plumed/label/cecam-2023 -c conda-forge plumed lammps
conda install -y --strict-channel-priority -c plumed/label/tutorial-2024 -c conda-forge plumed lammps
cd test-lammps
mpiexec lmp -in start.lmp
cat COLVAR
2 changes: 0 additions & 2 deletions gromacs/conda_build_config.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions lammps/conda_build_config.yaml

This file was deleted.

15 changes: 13 additions & 2 deletions plumed/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export CXXFLAGS="${CXXFLAGS//-O2/-O3}"

# libraries are explicitly listed here due to --disable-libsearch
export LIBS="-lboost_serialization -lfftw3 -lgsl -lgslcblas -llapack -lblas -lz $LIBS"
export LIBS="-lmetatensor_torch -lmetatensor -ltorch -lc10 -ltorch_cpu $LIBS"
Copy link
Member

Choose a reason for hiding this comment

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

@Luthaf any specific reason for removing libraries here (boost, fftw3, gslm etc)? I suspect they won't be linked

Copy link
Author

Choose a reason for hiding this comment

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

I did not remove anything, I added another line below. The full set of libraries will be -lmetatensor_torch -lmetatensor -ltorch -lc10 -ltorch_cpu -lboost_serialization -lfftw3 -lgsl -lgslcblas -llapack -lblas -lz, plus whatever was in $LIBS before these two lines

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I didn't read correctly the script, it's fine as you did


# libtorch puts some headers in a non-standard place
export CPPFLAGS="-I$PREFIX/include/torch/csrc/api/include $CPPFLAGS"

# enable MPI
export CXX=mpic++
Expand All @@ -26,8 +30,15 @@ export CXX=mpic++
# --disable-libsearch forces to link only explicitely requested libraries
# --disable-static-patch avoid tests that are only required for static patches
# --disable-static-archive makes package smaller
./configure --prefix=$PREFIX --disable-python --disable-libsearch --disable-static-patch --disable-static-archive --enable-modules=all --enable-boost_serialization
./configure --prefix=$PREFIX \
--disable-python \
--disable-libsearch \
--disable-static-patch \
--disable-static-archive \
--enable-modules=all \
--enable-boost_serialization \
--enable-metatensor \
--enable-libtorch

make -j3
make install

2 changes: 0 additions & 2 deletions plumed/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.9.sdk # [osx]
mpi:
- mpich
- openmpi
17 changes: 11 additions & 6 deletions plumed/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{% set name = "plumed" %}
{% set version = "2.9.0" %}
{% set version = "2.10" %}
{% set git_rev = "b0ffcb55ad8cc3c71ec5c30a1bd46f68dd33bceb" %}

package:
name: {{ name|lower }}
version: {{ version }}
version: {{ version }}.git.{{ git_rev }}

source:
url: https://github.com/plumed/plumed2/archive/v{{ version }}.tar.gz
sha256: 612d2387416b5f82dd8545709921440370e144fd46cef633654cf0ee43bac5f8
#git_url: https://github.com/plumed/plumed2.git
#git_rev: ddb59d16b21d6afb054fd9f6352f5d290e8575bf
# url: https://github.com/plumed/plumed2/archive/v{{ version }}.tar.gz
# sha256: 612d2387416b5f82dd8545709921440370e144fd46cef633654cf0ee43bac5f8
git_url: https://github.com/plumed/plumed2.git
git_rev: {{ git_rev }}

build:
number: 0
Expand All @@ -34,12 +35,16 @@ requirements:
- liblapack
- llvm-openmp # [osx]
- zlib
- libtorch
- libmetatensor-torch >=0.5.0,<0.6.0
run:
# for some not clear reason boost-cpp is needed here as well
- boost-cpp
- openmpi
- gawk
- llvm-openmp # [osx]
- libtorch
- libmetatensor-torch >=0.5.0,<0.6.0

test:
commands:
Expand Down
9 changes: 9 additions & 0 deletions py-plumed/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env bash

cd python
make pip
export plumed_default_kernel=$PREFIX/lib/libplumedKernel$SHLIB_EXT
#export plumed_disable_rtld_deepbind=yes

$PYTHON -m pip install . --no-deps -vv

6 changes: 6 additions & 0 deletions py-plumed/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
python:
- 3.8
- 3.9
- 3.10
- 3.11
- 3.12
52 changes: 52 additions & 0 deletions py-plumed/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% set name = "py-plumed" %}
{% set version = "2.10" %}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a standard way to make sure the date is baked in the version in some way? What I am thinking about is if a few weeks we release 2.10 it should override this one. Or shall we just increase the build: number below?

Copy link
Author

Choose a reason for hiding this comment

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

If you look below, the actual version ends up being 2.10.git.<hash>. I'm not sure if this will be treated as an alpha version by conda, but I can check that. If that's the case, the future 2.10 release should have priority over the alpha release!

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I changed this to have the version be 2.10.dev1 and store the git sha in the build string instead. The whole package is then plumed-2.10.dev1-git.b0ffcb55ad8cc3c71ec5c30a1bd46f68dd33bceb.

This means that when 2.10 is released, it will be used instead of this one, since conda is following PEP440: https://peps.python.org/pep-0440/

{% set git_rev = "b0ffcb55ad8cc3c71ec5c30a1bd46f68dd33bceb" %}

package:
name: {{ name|lower }}
version: {{ version }}.git.{{ git_rev }}

source:
# url: https://github.com/plumed/plumed2/archive/v{{ version }}.tar.gz
# sha256: 612d2387416b5f82dd8545709921440370e144fd46cef633654cf0ee43bac5f8
git_url: https://github.com/plumed/plumed2.git
git_rev: {{ git_rev }}

build:
number: 0
skip: True # [win or py2k]

requirements:
build:
- {{ compiler('c') }}
- make
host:
- python
- pip
- cython
run:
- plumed
- python

test:
imports:
- plumed
commands:
- python -c "import plumed; p=plumed.Plumed(); print(p)"

about:
home: http://www.plumed.org/
license: LGPL-3.0
license_family: GPL
license_file: COPYING.LESSER
summary: 'Python wrappers for plumed library'
description: |
PLUMED is an open source library for free energy calculations in
molecular systems which works together with some of the most
popular molecular dynamics engines.
doc_url: https://www.plumed.org/doc
dev_url: https://github.com/plumed/plumed2

extra:
recipe-maintainers:
- GiovanniBussi