Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
reverendbedford authored Oct 31, 2024
2 parents 514fbc3 + 92fe09e commit 4fe45b2
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 26 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
build_wheels_linux_mac:
env:
CIBW_SKIP: cp311-* cp312-* cp313-* *-manylinux_i686 pp* *_ppc641e *_s390x *_aarch64 *musllinux*
CIBW_SKIP: cp36-* cp311-* cp312-* cp313-* *-manylinux_i686 pp* *_ppc641e *_s390x *_aarch64 *musllinux*
CIBW_BEFORE_ALL_LINUX: yum -y install cmake cmake3 blas-devel lapack-devel && alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 --slave /usr/local/bin/ctest ctest /usr/bin/ctest --slave /usr/local/bin/cpack cpack /usr/bin/cpack --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake --family cmake && alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 --slave /usr/local/bin/ctest ctest /usr/bin/ctest3 --slave /usr/local/bin/cpack cpack /usr/bin/cpack3 --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 --family cmake
CIBW_BEFORE_ALL_MACOS: brew install cmake openblas superlu gfortran
CIBW_BEFORE_BUILD: "cmake -DCMAKE_BUILD_TYPE=Release -DUSE_OPENMP=OFF . && cmake --build . && rm CMakeCache.txt && rm -rf CMakeFiles && pip install -r requirements.txt"
Expand All @@ -32,10 +32,10 @@ jobs:
run: python -m pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: packages
name: packages-${{matrix.os}}

build_sdist:
name: Build source distribution
Expand All @@ -50,19 +50,36 @@ jobs:
python-version: '3.8'
- name: Build source distribution
run: python setup.py sdist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
name: packages
name: packages-source

upload_pypi:
upload_pypi_wheel:
needs: [build_wheels_linux_mac, build_sdist]
runs-on: ubuntu-latest
name: Upload packages to pypi
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/[email protected]
with:
name: packages-${{matrix.os}}
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PIPY_PASSWORD }}

upload_pypi_source:
needs: [build_wheels_linux_mac, build_sdist]
runs-on: ubuntu-latest
name: Upload packages to pypi
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4.1.7
with:
name: packages
name: packages-source
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
with:
submodules: recursive
- run: brew update
- run: brew install cmake openblas superlu 1>/dev/null || true
- run: brew install cmake openblas superlu
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand All @@ -62,9 +62,9 @@ jobs:
with:
submodules: recursive
- run: brew update
- run: brew install cmake openblas superlu gfortran valgrind 1>/dev/null || true
- run: brew install cmake openblas superlu gfortran
- run: brew reinstall gcc
- run: cmake -D CMAKE_CXX_COMPILER=/usr/bin/g++ -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_Fortran_COMPILER=/usr/local/bin/gfortran -D CMAKE_BUILD_TYPE=${{ matrix.btype }} -D USE_OPENMP=OFF -D BUILD_UTILS=ON .
- run: cmake -D CMAKE_CXX_COMPILER=/usr/bin/g++ -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_Fortran_COMPILER=/opt/homebrew/bin/gfortran -D CMAKE_BUILD_TYPE=${{ matrix.btype }} -D USE_OPENMP=OFF -D BUILD_UTILS=ON .
- run: make -j 2
- run: test/drivers/test_drivers.sh
- run: cd profiling && ./check_memory.sh
Expand All @@ -84,7 +84,7 @@ jobs:
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-toolchain base-devel mingw-w64-x86_64-openblas mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy mingw-w64-x86_64-python-networkx mingw-w64-x86_64-python-matplotlib
install: git mingw-w64-x86_64-toolchain base-devel mingw-w64-x86_64-openblas mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy mingw-w64-x86_64-python-networkx mingw-w64-x86_64-python-matplotlib mingw-w64-x86_64-gcc-fortran
- run: pip install nose2
- run: cmake . -G"MSYS Makefiles" -D"WRAP_PYTHON=ON" -D"CMAKE_BUILD_TYPE=${{ matrix.btype }}"
- run: make -j 2
Expand All @@ -105,7 +105,7 @@ jobs:
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-toolchain base-devel mingw-w64-x86_64-openblas mingw-w64-x86_64-cmake
install: git mingw-w64-x86_64-toolchain base-devel mingw-w64-x86_64-openblas mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc-fortran
- run: cmake . -G"MSYS Makefiles" -D"BUILD_UTILS=ON" -D"CMAKE_BUILD_TYPE=${{ matrix.btype }}"
- run: make -j 2
- run: PATH=$PATH:$PWD/lib ./test/drivers/test_drivers.sh
8 changes: 4 additions & 4 deletions .github/workflows/test_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: pull_request
jobs:
test_wheels_linux_mac:
env:
CIBW_SKIP: cp311-* cp312-* cp313-* *-manylinux_i686 pp* *_ppc641e *_s390x *_aarch64 *musllinux*
CIBW_SKIP: cp36-* cp311-* cp312-* cp313-* *-manylinux_i686 pp* *_ppc641e *_s390x *_aarch64 *musllinux*
CIBW_BEFORE_ALL_LINUX: yum -y install cmake cmake3 blas-devel lapack-devel && alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 --slave /usr/local/bin/ctest ctest /usr/bin/ctest --slave /usr/local/bin/cpack cpack /usr/bin/cpack --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake --family cmake && alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 --slave /usr/local/bin/ctest ctest /usr/bin/ctest3 --slave /usr/local/bin/cpack cpack /usr/bin/cpack3 --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 --family cmake
CIBW_BEFORE_ALL_MACOS: brew install cmake openblas superlu gfortran
CIBW_BEFORE_BUILD: "cmake -DCMAKE_BUILD_TYPE=Release -DUSE_OPENMP=OFF . && cmake --build . && rm CMakeCache.txt && rm -rf CMakeFiles && pip install -r requirements.txt"
Expand All @@ -30,10 +30,10 @@ jobs:
run: python -m pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: packages
name: packages-${{matrix.os}}

test_sdist:
name: Test source distribution on linux
Expand All @@ -48,7 +48,7 @@ jobs:
python-version: '3.8'
- name: Build source distribution
run: python setup.py sdist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
name: packages
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
project(NEML LANGUAGES CXX)

### Version ###
Expand Down
2 changes: 1 addition & 1 deletion pybind11
Submodule pybind11 updated 182 files
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ target_include_directories(neml PRIVATE "../include")
target_link_libraries(neml ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${SOLVER_LIBRARIES} ${OpenMP_CXX_LIBRARIES})
generate_export_header(neml EXPORT_FILE_NAME ${PROJECT_SOURCE_DIR}/include/neml_export.h)
generate_export_header(neml EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/neml_export.h)
set_target_properties(neml PROPERTIES PUBLIC_HEADER
"${PROJECT_BINARY_DIR}/include/neml_export.h;../include/neml_interface.h;../include/nemlerror.h;../include/windows.h")


# An annoyance for building the python package
if (PYTHON_PACKAGE)
# Strictly we don't need this for wheels, but for source builds it's handy
install(TARGETS neml
LIBRARY DESTINATION neml)
else()
set_target_properties(neml PROPERTIES PUBLIC_HEADER
"${PROJECT_BINARY_DIR}/include/neml_export.h;../include/neml_interface.h;../include/nemlerror.h;../include/windows.h"
)
install(TARGETS neml
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include)
Expand Down
4 changes: 0 additions & 4 deletions src/cp/slipharden.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,8 @@ void FASlipHardening::populate_hist(History & history) const

void FASlipHardening::init_hist(History & history) const
{
size_t i = 0;
for (auto vn : varnames_) {
history.get<double>(vn) = 0.0;
i++;
}
}

Expand Down Expand Up @@ -799,10 +797,8 @@ void SimpleLinearHardening::populate_hist(History & history) const

void SimpleLinearHardening::init_hist(History & history) const
{
size_t i = 0;
for (auto vn : varnames_) {
history.get<double>(vn) = 0;
i++;
}
}

Expand Down
4 changes: 3 additions & 1 deletion test/test_nemlmath.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
sys.path.append('..')

import math

from neml.math.nemlmath import *
from common import *

Expand Down Expand Up @@ -396,7 +398,7 @@ def test_isclose(self):
class TestVariousFactorial(unittest.TestCase):
def test_factorial(self):
for i in range(10):
self.assertTrue(np.isclose(np.math.factorial(i), factorial(i)))
self.assertTrue(np.isclose(math.factorial(i), factorial(i)))

class TestEigenstuff(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 4fe45b2

Please sign in to comment.