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
67 changes: 31 additions & 36 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,47 @@ defaults:
shell: bash -e -l {0}
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
name: ${{ matrix.sys.compiler }} ${{ matrix.sys.version }} - ${{ matrix.sys.blas }}
strategy:
fail-fast: false
matrix:
sys:
- {compiler: gcc, version: '8', blas: OpenBLAS}
- {compiler: gcc, version: '8', blas: mkl}
- {compiler: gcc, version: '9', blas: OpenBLAS}
- {compiler: gcc, version: '9', blas: mkl}
- {compiler: gcc, version: '10', blas: OpenBLAS}
- {compiler: gcc, version: '10', blas: mkl}
- {compiler: gcc, version: '11', blas: OpenBLAS}
- {compiler: gcc, version: '11', blas: mkl}
- {compiler: clang, version: '15', blas: OpenBLAS}
- {compiler: clang, version: '15', blas: mkl}
- {compiler: clang, version: '16', blas: OpenBLAS}
- {compiler: clang, version: '16', blas: mkl}
- {compiler: gcc, version: '12', blas: OpenBLAS}
- {compiler: gcc, version: '12', blas: mkl}
- {compiler: gcc, version: '13', blas: OpenBLAS}
- {compiler: gcc, version: '13', blas: mkl}
- {compiler: gcc, version: '14', blas: OpenBLAS}
- {compiler: gcc, version: '14', blas: mkl}
- {compiler: clang, version: '17', blas: OpenBLAS}
- {compiler: clang, version: '18', blas: mkl}
- {compiler: clang, version: '19', blas: OpenBLAS}
- {compiler: clang, version: '20', blas: mkl}

steps:
- name: Install GCC
if: matrix.sys.compiler == 'gcc'
uses: egor-tensin/setup-gcc@v1
with:
version: ${{matrix.sys.version}}
platform: x64

- name: Setup GCC
if: ${{ matrix.sys.compiler == 'gcc' }}
- name: Install LLVM and Clang
if: matrix.sys.compiler == 'clang'
run: |
GCC_VERSION=${{ matrix.sys.version }}
sudo apt-get update
sudo apt-get --no-install-suggests --no-install-recommends install g++-$GCC_VERSION
CC=gcc-$GCC_VERSION
echo "CC=$CC" >> $GITHUB_ENV
CXX=g++-$GCC_VERSION
echo "CXX=$CXX" >> $GITHUB_ENV
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.sys.version}}
sudo apt-get install -y clang-tools-${{matrix.sys.version}}
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{matrix.sys.version}} 200
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{matrix.sys.version}} 200
sudo update-alternatives --install /usr/bin/clang-scan-deps clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}} 200
sudo update-alternatives --set clang /usr/bin/clang-${{matrix.sys.version}}
sudo update-alternatives --set clang++ /usr/bin/clang++-${{matrix.sys.version}}
sudo update-alternatives --set clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}}

- name: Setup clang
if: ${{ matrix.sys.compiler == 'clang' }}
run: |
LLVM_VERSION=${{ matrix.sys.version }}
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-$LLVM_VERSION main" || exit 1
sudo apt-get update || exit 1
sudo apt-get --no-install-suggests --no-install-recommends install clang-$LLVM_VERSION || exit 1
sudo apt-get --no-install-suggests --no-install-recommends install g++-9 g++-9-multilib || exit 1
sudo ln -s /usr/include/asm-generic /usr/include/asm
CC=clang-$LLVM_VERSION
echo "CC=$CC" >> $GITHUB_ENV
CXX=clang++-$LLVM_VERSION
echo "CXX=$CXX" >> $GITHUB_ENV

- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -76,10 +71,10 @@ jobs:

- name: Install OpenBLAS
if: ${{ matrix.sys.blas == 'OpenBLAS' }}
run: micromamba install openblas==0.3 blas-devel
run: micromamba install 'openblas==0.3.29=pthreads*' blas-devel

- name: Configure using CMake
run: cmake -Bbuild -DDOWNLOAD_GTEST=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib
run: cmake -Bbuild -DDOWNLOAD_GTEST=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib

- name: Build
working-directory: build
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ defaults:
jobs:
build:
runs-on: macos-${{ matrix.os }}
name: macos-${{ matrix.os }} - mkl
name: macos-${{ matrix.os }} - OpenBLAS
strategy:
fail-fast: false
matrix:
os:
- 11
- 12
- 13
- 14
- 15

steps:

Expand All @@ -34,8 +35,8 @@ jobs:
init-shell: bash
cache-downloads: true

- name: Install mkl
run: micromamba install mkl
- name: Install OpenBLAS
run: micromamba install 'openblas==0.3.29=openmp*' blas-devel

- name: Configure using CMake
run: cmake -Bbuild -DDOWNLOAD_GTEST=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -16,28 +16,28 @@ repos:
- id: detect-private-key
- id: check-merge-conflict
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.1
rev: v1.5.4
hooks:
- id: forbid-tabs
- id: remove-tabs
args: [--whitespaces-count, '4']
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.5.0
rev: v2.11.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
- repo: https://github.com/tdegeus/cpp_comment_format
rev: v0.2.0
rev: v0.2.1
hooks:
- id: cpp_comment_format
- repo: https://github.com/tdegeus/conda_envfile
rev: v0.4.1
rev: v0.4.2
hooks:
- id: conda_envfile_parse
files: environment.yaml
# Externally provided executables (so we can use them with editors as well).
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.6
rev: v17.0.6
hooks:
- id: clang-format
files: .*\.[hc]pp$
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.29)
project(xtensor-blas)

set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.29)

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
project(xtensor-benchmark)
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channels:
- conda-forge
dependencies:
- cmake
- xtensor>=0.25.0
- xtensor>=0.25.0,<0.26
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.29)

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
project(xtensor-blas-test)
Expand Down
6 changes: 3 additions & 3 deletions test/downloadGTest.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 2.8.2)
cmake_minimum_required(VERSION 3.29)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/JohanMabille/googletest.git
GIT_TAG warnings
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.16.0
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
Expand Down
35 changes: 20 additions & 15 deletions test/test_dot_extended.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ namespace xt
xarray<double> py_a = {
{{0.3745401188473625, 0.9507143064099162, 0.7319939418114051, 0.5986584841970366, 0.1560186404424365},
{0.1559945203362026, 0.0580836121681995, 0.8661761457749352, 0.6011150117432088, 0.7080725777960455},
{0.0205844942958024, 0.9699098521619943, 0.8324426408004217, 0.2123391106782762, 0.1818249672071006}},
{0.0205844942958024, 0.9699098521619943, 0.8324426408004217, 0.2123391106782762, 0.1818249672071006
}},

{{0.1834045098534338, 0.3042422429595377, 0.5247564316322378, 0.4319450186421158, 0.2912291401980419},
{0.6118528947223795, 0.1394938606520418, 0.2921446485352182, 0.3663618432936917, 0.4560699842170359},
{0.7851759613930136, 0.1996737821583597, 0.5142344384136116, 0.5924145688620425, 0.0464504127199977}}};
{0.7851759613930136, 0.1996737821583597, 0.5142344384136116, 0.5924145688620425, 0.0464504127199977}}
};
// py_b
xarray<double> py_b = {
{0.6075448519014384, 0.1705241236872915, 0.0650515929852795, 0.9488855372533332, 0.9656320330745594},
{0.8083973481164611, 0.3046137691733707, 0.0976721140063839, 0.6842330265121569, 0.4401524937396013},
{0.1220382348447788, 0.4951769101112702, 0.0343885211152184, 0.9093204020787821, 0.2587799816000169},
{0.662522284353982, 0.311711076089411, 0.5200680211778108, 0.5467102793432796, 0.184854455525527}};
{0.662522284353982, 0.311711076089411, 0.5200680211778108, 0.5467102793432796, 0.184854455525527}
};
// py_dr
xarray<double> py_dr = {
{{1.1560019913607258, 1.1421672030085086, 1.1263990512143978, 1.2813094834150083},
Expand All @@ -52,7 +55,8 @@ namespace xt

{{0.8885299172713558, 0.7159304454839006, 0.6592223836380569, 0.7792380767202456},
{1.2025508600129964, 1.0170636073271262, 0.6049520893427571, 0.8853834024749684},
{1.15151820221699, 1.1715787914743192, 0.763094187597877, 1.182339688054495}}};
{1.15151820221699, 1.1715787914743192, 0.763094187597877, 1.182339688054495}}
};

xt::xtensor<double, 2> bas = xt::transpose(py_b);

Expand All @@ -78,18 +82,16 @@ namespace xt

{{0.5426960831582485, 0.1409242249747626, 0.8021969807540397, 0.0745506436797708, 0.9868869366005173},
{0.7722447692966574, 0.1987156815341724, 0.0055221171236024, 0.8154614284548342, 0.7068573438476171},
{0.7290071680409873, 0.7712703466859457, 0.0740446517340904, 0.3584657285442726, 0.1158690595251297}}};
{0.7290071680409873, 0.7712703466859457, 0.0740446517340904, 0.3584657285442726, 0.1158690595251297}}
};
// py_b
xarray<double> py_b = {
0.8631034258755935,
0.6232981268275579,
0.3308980248526492,
0.0635583502860236,
0.3109823217156622};
xarray<double> py_b =
{0.8631034258755935, 0.6232981268275579, 0.3308980248526492, 0.0635583502860236, 0.3109823217156622};
// py_dr
xarray<double> py_dr = {
{1.8736790686065976, 1.0197269167779506, 0.8888679673881792},
{1.1333287572487494, 1.0638629967411402, 1.1932578950872312}};
{1.1333287572487494, 1.0638629967411402, 1.1932578950872312}
};

auto xres = xt::linalg::dot(py_a, py_b);
std::cout << xres << std::endl;
Expand Down Expand Up @@ -118,7 +120,8 @@ namespace xt
{{100, 101, 102, 103, 104},
{105, 106, 107, 108, 109},
{110, 111, 112, 113, 114},
{115, 116, 117, 118, 119}}}};
{115, 116, 117, 118, 119}}}
};
// py_b
xarray<long> py_b = {
{{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, 10, 11}, {12, 13, 14}},
Expand All @@ -127,7 +130,8 @@ namespace xt

{{30, 31, 32}, {33, 34, 35}, {36, 37, 38}, {39, 40, 41}, {42, 43, 44}},

{{45, 46, 47}, {48, 49, 50}, {51, 52, 53}, {54, 55, 56}, {57, 58, 59}}};
{{45, 46, 47}, {48, 49, 50}, {51, 52, 53}, {54, 55, 56}, {57, 58, 59}}
};
// py_dr
xarray<long> py_dr = {
{{{{90, 100, 110}, {240, 250, 260}, {390, 400, 410}, {540, 550, 560}},
Expand Down Expand Up @@ -176,7 +180,8 @@ namespace xt

{{3390, 3950, 4510}, {11790, 12350, 12910}, {20190, 20750, 21310}, {28590, 29150, 29710}},

{{3540, 4125, 4710}, {12315, 12900, 13485}, {21090, 21675, 22260}, {29865, 30450, 31035}}}}};
{{3540, 4125, 4710}, {12315, 12900, 13485}, {21090, 21675, 22260}, {29865, 30450, 31035}}}}
};

auto xres = xt::linalg::dot(py_a, py_b);
EXPECT_TRUE(xt::allclose(xres, py_dr));
Expand Down
Loading