Skip to content

Commit

Permalink
Add OpenBLAS install tool for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
samhatfield committed Mar 6, 2025
1 parent fe5054f commit 13d02ca
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/tools/install-openblas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#! /usr/bin/env bash

# (C) Copyright 2013 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

set +x
set -e -o pipefail

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PATH=$SCRIPTDIR:$PATH

# Some defaults for the arguments
PREFIX=$(pwd)/install
openblas_version=0.3.29
fftw_configure="--enable-shared"

while [ $# != 0 ]; do
case "$1" in
"--prefix")
PREFIX="$2"; shift
;;
"--version")
openblas_version="$2"; shift
;;
*)
echo "Unrecognized argument '$1'"
exit 1
;;
esac
shift
done

echo "Installing OpenBLAS version ${openblas_version}"

openblas_installed=${PREFIX}/openblas-${openblas_version}-installed
if [[ -f "${openblas_installed}" ]]; then
echo "OpenBLAS ${openblas_version} is already installed at ${PREFIX}"
exit
fi

os=$(uname)
case "$os" in
Darwin)
brew ls --versions openblas || brew install openblas
exit
;;
*Ubuntu*)
sudo apt-get install libopenblas-dev
exit
;;
*)
;;
esac


# if [ -z "${TMPDIR+x}" ]; then
# TMPDIR=${HOME}/tmp
# fi
# mkdir -p ${TMPDIR}/downloads

# openblas_gh=https://github.com/OpenMathLib/OpenBLAS
# openblas_tarball_url=$openblas_gh/releases/download/v${openblas_version}/OpenBLAS-${openblas_version}.tar.gz
# openblas_tarball=$TMPDIR/downloads/openblas-${openblas_version}.tar.gz
# openblas_dir=$TMPDIR/downloads/openblas-${openblas_version}

# echo "+ curl -L ${openblas_tarball_url} > ${openblas_tarball}"
# curl -L ${openblas_tarball_url} > ${openblas_tarball}
# echo "+ tar xzf ${openblas_tarball} -C ${TMPDIR}/downloads"
# tar xzf ${openblas_tarball} -C ${TMPDIR}/downloads
# echo "+ cd ${openblas_dir}"
# cd ${openblas_dir}
# echo "+ ./configure --prefix=${PREFIX} ${fftw_configure}"
# ./configure --prefix=${PREFIX} ${fftw_configure}
# echo "+ make -j8"
# make -j8
# echo "+ make install"
# make install

# echo "+ rm -rf \${fftw_tarball} \${fftw_dir}"
# rm -rf ${fftw_tarball} ${fftw_dir}

# echo "+ touch ${fftw_installed}"
# touch ${fftw_installed}
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ jobs:
${ECTRANS_TOOLS}/install-fftw.sh --version 3.3.10 --with-single --prefix ${DEPS_DIR}/fftw
echo "FFTW_ROOT=${DEPS_DIR}/fftw" >> $GITHUB_ENV
- name: Install OpenBLAS
shell: bash -eux {0}
run: ${ECTRANS_TOOLS}/install-openblas.sh

- name: Set Build & Test Environment
run: |
Expand Down

0 comments on commit 13d02ca

Please sign in to comment.