Skip to content

Commit

Permalink
globbing and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-urban committed Sep 30, 2024
1 parent 38a9c2e commit 5fe0abb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 75 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/ci-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,76 +54,6 @@ concurrency:
#BUILD_TYPE: Release

jobs:
macos:
name: CI ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
cxx_compiler: ["$(brew --prefix llvm@18)/bin/clang++"]
llvm: ["$(brew --prefix llvm@18)"]
boost: ["$(brew --prefix boost)"]
libomp: ["$(brew --prefix libomp)"]
os: ["macos-12"]

# env does not work here because is resolved as string and not command
# env:
# CXX: ${{ matrix.cxx_compiler }}

steps:

- uses: actions/setup-python@v3
with:
python-version: '3.12'

- name: checkout main repository
uses: actions/checkout@v4
with:
submodules: recursive
lfs: false

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: super-ci-mac-2 # name for the cache

# uninstall clang 15
- run: brew uninstall llvm@15

- run: brew install coreutils llvm@18

- run: brew install libomp boost

- run: pip install meson meson-python ninja pytest numpy

# LDFLAGS="-L/opt/homebrew/opt/libomp/lib" CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
- name: configure meson
run: |
BOOST_ROOT=${{ matrix.boost }} CXX=${{ matrix.llvm }}/bin/clang++ LDFLAGS="-L${{ matrix.llvm }}/lib/c++ -L${{ matrix.llvm }}/lib -L${{ matrix.boost }}/lib" CPPFLAGS="-I${{ matrix.llvm }}/include -I${{ matrix.boost }}/include" meson setup builddir/; meson configure builddir -Dpython.install_env=auto
- name: compile project
run: meson compile -C builddir/

- name: test (cpp)
run: meson test -C builddir/ --print-errorlogs

- name: install project
run: sudo meson install -C builddir/

- name: install pip requirements
run: pip install -r requirements.txt

- name: test (pytest)
run: pytest -v

- name: 'Upload error log'
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.container}}_testlog
path: builddir/meson-logs/meson-log.txt
retention-days: 5

macos_arm:
name: CI ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -162,7 +92,6 @@ jobs:

- run: pip install meson meson-python ninja pytest numpy

# LDFLAGS="-L/opt/homebrew/opt/libomp/lib" CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
- name: configure meson
run: |
meson setup builddir -Dpython.install_env=auto
Expand Down
4 changes: 3 additions & 1 deletion src/themachinethatgoesping/tools/.docstrings/helper.doc.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: c10033c746c08995b3cc73b4e3a6ca5535af9fff92a9e4064818334037d0a889
//sourcehash: 9e52974b63da8f3ce7627008f66e807c37ee88c968b30ff423515d475050c669

/*
This file contains docstrings for use in the Python bindings.
Expand Down Expand Up @@ -67,6 +67,8 @@ static const char *__doc_themachinethatgoesping_tools_helper_compare_containers

static const char *__doc_themachinethatgoesping_tools_helper_float_equals = R"doc()doc";

static const char *__doc_themachinethatgoesping_tools_helper_float_is_finite_and_not_zero = R"doc()doc";

static const char *__doc_themachinethatgoesping_tools_helper_get_from_map_with_default = R"doc()doc";

static const char *__doc_themachinethatgoesping_tools_helper_int_as_string = R"doc()doc";
Expand Down
10 changes: 8 additions & 2 deletions src/themachinethatgoesping/tools/helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace themachinethatgoesping {
namespace tools {
namespace helper {

template <typename t_out, typename t_in1, typename t_in2>
template<typename t_out, typename t_in1, typename t_in2>
inline t_out substract_set_zero_if_negative(t_in1 a, t_in2 b)
{
return a > b ? a - b : 0;
Expand Down Expand Up @@ -228,12 +228,18 @@ inline bool compare_containers(const t_container1& c1, const t_container2& c2)
}

template<typename t_float>
bool float_equals(t_float a, t_float b, t_float epsilon = 0.0001)
bool float_equals(t_float a, t_float b, t_float epsilon = t_float(0.0001))
{
return std::abs(a - b) < epsilon || (std::isnan(a) && std::isnan(b)) ||
(std::isinf(a) && std::isinf(b));
}

template<typename t_float>
bool float_is_finite_and_not_zero(t_float a, t_float epsilon = t_float(0.0001))
{
return std::isfinite(a) && std::abs(a) > epsilon;
}

} // namespace helper
} // namespace tools
} // namespace themachinethatgoesping
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# list and install headers
headers = [
'pyarray.hpp',
'pytensor.hpp',
'pyarray_backstrides.hpp',
'pycontainer.hpp',
'pynative_casters.hpp',
Expand Down

0 comments on commit 5fe0abb

Please sign in to comment.