Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
46 changes: 46 additions & 0 deletions containers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build container image

Use the `Containerfile` file in this folder to build the `bench-<what>`
container image.

### Using an image

This is the easy part: you just need to download the
[image](https://github.com/N3PDF/external/pkgs/container/) and run with your
favorite container tool.

Here the explicit commands with `podman` [[1]](#docker)

```sh
podman pull ghcr.io/n3pdf/<image-name>:latest
podman run ghcr.io/n3pdf/<image-name>
```

<a name="docker">[1]</a>: to use `docker` instead you can simply replace `podman -> docker`, they have compatible subcommands

### Build an image

_Use case_: if a new external installer is added, or some external code is
updated, to receive the updates you need to regenerate the container (since they
are pre-installed in the image itself)

Update `Containerfile` (if needed [[2]](#container-update)), hen rerun:

```sh
./build.bash <folder>
podman tag <image-id> ghcr.io/n3pdf/<folder>:<version>
# login to GitHub registry with user credentials (not organization), see [3]
echo ${PAT} | podman login ghcr.io -u <username> --password-stdin
# finally publish
podman push ghcr.io/n3pdf/<folder>:<version>
# and publish the new latest (all layers already available, it's just an alias)
podman push ghcr.io/n3pdf/<folder>:latest
```

Where `<folder>` is the name of one of the subfolders in this directory.

<a name="container-update">[2]</a>: you need to update the container both to
spell out new externals, but also to upgrade python version, or other build time
dependencies (e.g. `gfortran`)
<a name="github-registry-docs">[3]</a>: official [GitHub registry
docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry)
46 changes: 46 additions & 0 deletions containers/bench-dis/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM docker.io/python:3.9

# create a dedicated user
RUN /bin/bash -c "apt update; \
apt install -y wget patch autoconf libtool g++ gfortran make"

RUN /bin/bash -c "useradd -m dis"

USER dis
ENV HOME=/home/dis
WORKDIR $HOME

RUN /bin/bash -c "pip install numpy"

COPY --chown=dis packages/lhapdf $HOME/lhapdf
COPY --chown=dis packages/apfel $HOME/apfel
COPY --chown=dis packages/fonlldis $HOME/fonlldis
COPY --chown=dis packages/qcdnum $HOME/qcdnum
COPY --chown=dis packages/xspace-bench $HOME/xspace-bench
# TODO: remove this dirty trick
COPY --chown=dis packages/.backup/ $HOME/.backup

ENV PREFIX=$HOME/.local
ENV PATH=$PATH:$HOME/.local/bin

RUN /bin/bash -c "cd lhapdf; sh install.sh"
RUN /bin/bash -c "cd apfel; sh install.sh"
RUN /bin/bash -c "cd fonlldis; sh install.sh"
RUN /bin/bash -c "cd qcdnum; sh install.sh"
RUN /bin/bash -c "cd xspace-bench; sh install.sh"

# --------------------------------------------------------- #

FROM docker.io/python:3.9-slim

RUN /bin/bash -c "useradd -m dis"

USER dis
ENV HOME=/home/dis
WORKDIR $HOME

ENV LD_LIBRARY_PATH=$HOME/.local/lib

COPY --from=0 /usr/lib/x86_64-linux-gnu/libquadmath* /usr/lib/x86_64-linux-gnu/
COPY --from=0 /usr/lib/x86_64-linux-gnu/libgfortran* /usr/lib/x86_64-linux-gnu/
COPY --from=0 /home/dis/.local/ $HOME/.local
41 changes: 41 additions & 0 deletions containers/bench-evol/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM docker.io/python:3.9

# create a dedicated user
RUN /bin/bash -c "apt update; \
apt install -y wget patch autoconf libtool g++ gfortran make"

RUN /bin/bash -c "useradd -m evol"

USER evol
ENV HOME=/home/evol
WORKDIR $HOME

RUN /bin/bash -c "pip install numpy"

COPY --chown=evol packages/lhapdf $HOME/lhapdf
COPY --chown=evol packages/apfel $HOME/apfel
COPY --chown=evol packages/qcdnum $HOME/qcdnum
COPY --chown=evol packages/pegasus $HOME/pegasus
# TODO: remove this dirty trick
COPY --chown=evol packages/.backup/ $HOME/.backup

ENV PREFIX=$HOME/.local
ENV PATH=$PATH:$HOME/.local/bin

RUN /bin/bash -c "cd lhapdf; sh install.sh"
RUN /bin/bash -c "cd apfel; sh install.sh"
RUN /bin/bash -c "cd qcdnum; sh install.sh"
RUN /bin/bash -c "cd pegasus; sh install.sh"

# --------------------------------------------------------- #

FROM docker.io/python:3.9-slim

RUN /bin/bash -c "apt update; \
apt install -y git curl"

ENV LD_LIBRARY_PATH=/usr/local/lib

COPY --from=0 /usr/lib/x86_64-linux-gnu/libquadmath* /usr/lib/x86_64-linux-gnu/
COPY --from=0 /usr/lib/x86_64-linux-gnu/libgfortran* /usr/lib/x86_64-linux-gnu/
COPY --from=0 /home/evol/.local/ /usr/local
5 changes: 5 additions & 0 deletions containers/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

pushd ..
podman build -t ghcr.io/n3pdf/$1 -f containers/$1/Containerfile .
popd
5 changes: 0 additions & 5 deletions containers/lhapdf/build.sh

This file was deleted.

Binary file added packages/.backup/FONLLdis.tar.gz
Binary file not shown.
15 changes: 15 additions & 0 deletions packages/.backup/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BACKUP_DIR=$(realpath $(dirname $0))
ROOT=$(realpath $BACKUP_DIR/..)

echo "Refetching all sources from: '$ROOT'"
echo " -> store them in '$BACKUP_DIR'"
echo

for ext in $ROOT/*/; do
if [ ! -f $ext/variables.sh ]; then
continue
fi

. $ext/variables.sh
sh $ext/download.sh $URL $BACKUP_DIR/$TARBALL
done
Binary file added packages/.backup/xspace-bench.tar.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.tar.gz
!.backup/*.tar.gz
44 changes: 44 additions & 0 deletions packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# External

This repo provides installer for the following software.

- [APFEL](https://github.com/scarrazza/apfel)
- [LHAPDF](https://lhapdf.hepforge.org)
- [QCDNUM](https://www.nikhef.nl/~h24/qcdnum/)
- [FONLLdis](https://github.com/NNPDF/external)
- [xspace-bench](https://github.com/NNPDF/external)
- [pegasus](https://www.nikhef.nl/~avogt/pegasus.html)

Installers share most of their structure, but since differences are unavoidable
(and they are short and should not change frequently), it is far more flexible
to have a separate independent copy of install script for each external.

## Structure

Each software is packaged providing installers in the subfolders of this repo
(each one name after the program, but all lower case).

The structure of each folder is the following:

- `README.md` (optional): brief description and notes
- `install.sh`: the actual installer, meant to be run by shell (`sh install.sh`)
- `clean.sh`: a cleaner to remove files generated by the installer
- `*.patch`: one or more patches (tiny corrections, or extensions, to the
original source)

#### Clean

If you clone this as a `git` repository and you run `install.sh` from within its
own folder you should be able to clean also by running:

```sh
git clean -fd
```

If instead you download the script, or you run the script out of the repo, then
running `sh clean.sh` in the same folder should clean up.

## Disclaimer

We are not the original authors of any of these software, all the rights are owned
by them, and maintenance is up to them as well.
3 changes: 3 additions & 0 deletions packages/apfel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APFEL-*
scarrazza-apfel-*
*.tar.gz
55 changes: 55 additions & 0 deletions packages/apfel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# APFEL: A Partonic Function Evolution Library

My fork of APFEL, just to store the working installation for my system

## Fixes

- replaced all the shebang containing `python` with `python2`

# Install instructions

## Dependencies

- `swig`

## Install for python2

Uncomment in `configure.ac` the `python_incpath` definition for `python2`, then:

```shell
autoreconf -f -i
chmod +x configure
PYTHON=$(which python2) ./configure --prefix=$HOME/.local
make clean
make #-j4
make install
```

## Install for python3

Uncomment in `configure.ac` the `python_incpath` definition for `python3`, then:

```shell
autoreconf -f -i
PYTHON=$(which python3) ./configure --prefix=$HOME/.local
make clean
make #-j4
make install
```

---

## Description

APFEL is a library to perform the combined QCD+QED DGLAP
evolution of parton distributions. It is written and maintained
by Valerio Bertone (CERN), Stefano Carrazza (Milano) and Juan Rojo (CERN).

## Manual and Instructions:

http://apfel.hepforge.org/
https://github.com/scarrazza/apfel

## APFEL Web:

http://apfel.mi.infn.it
5 changes: 5 additions & 0 deletions packages/apfel/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# import variables
. $(dirname $0)/variables.sh

rm -rf $TARBALL
rm -rf $SRC_DIR
4 changes: 4 additions & 0 deletions packages/apfel/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
URL=$1
TARBALL=$2

wget $URL -O $TARBALL
35 changes: 35 additions & 0 deletions packages/apfel/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# early exit if errors occur
set -e

INSTALLER_DIR=$(realpath $(dirname $0))

# import variables
. $INSTALLER_DIR/variables.sh

# download the code
sh $INSTALLER_DIR/download.sh $URL $TARBALL

# extract code
tar -xvzf $TARBALL
cd $SRC_DIR

# apply patches
# for p in $INSTALLER_DIR/*.patch; do
# echo "Applying patch: '$p'"
# patch <$p -p1
# done

# reconfigure
autoreconf -f -i
# if PREFIX is set use it, otherwise do the default
if [ -z $PREFIX ]; then
PYTHON=$(which python3) ./configure
else
echo "Installing in $PREFIX"
PYTHON=$(which python3) ./configure --prefix=$PREFIX
fi

# reset, compile, and install (includes python interface)
make clean
make -j
make install
4 changes: 4 additions & 0 deletions packages/apfel/variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VERSION=4426f689a95fbde94012083dd55a9af0edcc5928
URL="https://github.com/scarrazza/apfel/tarball/$VERSION"
TARBALL="APFEL-$VERSION.tar.gz"
SRC_DIR="scarrazza-apfel-$(echo $VERSION | cut -c -7)"
2 changes: 2 additions & 0 deletions packages/fonlldis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FONLLdis
*.tar.gz
28 changes: 28 additions & 0 deletions packages/fonlldis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Installation

Run

```
make clean
make
```

Seems like gcc-9 is not working, please use gcc-10.

To execute the original program run

```
./FONLLdis
```


## Python bindings

Run

```sh
cd pyWrap
# activate your environment, so f2py already points to the correct thing
sh f2py.sh
pip install .
```
5 changes: 5 additions & 0 deletions packages/fonlldis/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# import variables
. $(dirname $0)/variables.sh

rm -rf $TARBALL
rm -rf $SRC_DIR
5 changes: 5 additions & 0 deletions packages/fonlldis/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
URL=$1
TARBALL=$2

INSTALLER_DIR=$(realpath $(dirname $0))
cp $INSTALLER_DIR/../.backup/FONLLdis.tar.gz $TARBALL
Loading