Skip to content

Commit

Permalink
Merge pull request #97 from cropsinsilico/language/julia
Browse files Browse the repository at this point in the history
Language/julia
  • Loading branch information
langmm authored Apr 17, 2023
2 parents 5d67eab + b9607b3 commit 270e65a
Show file tree
Hide file tree
Showing 195 changed files with 4,315 additions and 174 deletions.
81 changes: 57 additions & 24 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env:
BUILDDOCS: 0
INSTALLC: 1
INSTALLFORTRAN: 1
INSTALLJULIA: 1
INSTALLLPY: 0
INSTALLMATLAB: 0
INSTALLMPI: 1
Expand All @@ -21,7 +22,15 @@ env:
YGG_GHA_JOB_ID_SUFFIX: null
jobs:
build_sdist:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Build source distribution
needs:
- test_pip
- test_conda
- test_rmq_pip
- test_rmq_conda
- test_stripped
- docs
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand Down Expand Up @@ -54,7 +63,15 @@ jobs:
name: sdist
path: ./dist/*
build_wheels:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Build wheels on ${{ matrix.os }}
needs:
- test_pip
- test_conda
- test_rmq_pip
- test_rmq_conda
- test_stripped
- docs
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand All @@ -76,16 +93,9 @@ jobs:
'
- env:
CIBW_ARCHS_LINUX: auto aarch64 ppc64le
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_LINUX: ${{ matrix.linux_arch }}
CIBW_ARCHS_MACOS: ${{ matrix.mac_arch }}
CIBW_ARCHS_WINDOWS: ${{ matrix.windows_arch }}
CIBW_BEFORE_ALL_LINUX: yum install -y blas-devel lapack-devel
CIBW_ENVIRONMENT: PIP_ONLY_BINARY=numpy
CIBW_SKIP: cp2* cp33* cp34* cp35* cp36* pp* cp310-manylinux_i686 cp311-manylinux_i686
*-musllinux_*
CIBW_TEST_COMMAND: ygginfo && pytest -m subset_rapidjson --import-mode=importlib
{project}/tests
CIBW_TEST_REQUIRES: pytest flaky
name: Build wheels
uses: pypa/[email protected]
- name: Upload artifacts
Expand All @@ -98,6 +108,14 @@ jobs:
include:
- os: windows-2019
windows_arch: x86
- linux_arch: aarch64
os: ubuntu-20.04
- linux_arch: ppc64le
os: ubuntu-20.04
linux_arch:
- auto
mac_arch:
- x86_64 arm64
os:
- ubuntu-20.04
- macOS-11
Expand Down Expand Up @@ -290,6 +308,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
name: (PIP) Set up Julia
uses: julia-actions/setup-julia@v1
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
name: Set up Matlab
uses: matlab-actions/setup-matlab@v1
Expand Down Expand Up @@ -324,7 +345,7 @@ jobs:
name: (MACOS,PIP) Set C compiler to llvm clang
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
name: (WINDOWS,CONDA) Set up miniconda base environment
name: (CONDA) Set up miniconda base environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down Expand Up @@ -381,8 +402,8 @@ jobs:
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
runner.os == 'macOS'
name: (MACOS,CONDA) Set allow_multiple_omp config
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
yggconfig --allow-multiple-omp
Expand Down Expand Up @@ -618,6 +639,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
name: (PIP) Set up Julia
uses: julia-actions/setup-julia@v1
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
name: Set up Matlab
uses: matlab-actions/setup-matlab@v1
Expand Down Expand Up @@ -652,7 +676,7 @@ jobs:
name: (MACOS,PIP) Set C compiler to llvm clang
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
name: (WINDOWS,CONDA) Set up miniconda base environment
name: (CONDA) Set up miniconda base environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down Expand Up @@ -709,8 +733,8 @@ jobs:
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
runner.os == 'macOS'
name: (MACOS,CONDA) Set allow_multiple_omp config
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
yggconfig --allow-multiple-omp
Expand Down Expand Up @@ -938,6 +962,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
name: (PIP) Set up Julia
uses: julia-actions/setup-julia@v1
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
name: Set up Matlab
uses: matlab-actions/setup-matlab@v1
Expand Down Expand Up @@ -972,7 +999,7 @@ jobs:
name: (MACOS,PIP) Set C compiler to llvm clang
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
name: (WINDOWS,CONDA) Set up miniconda base environment
name: (CONDA) Set up miniconda base environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down Expand Up @@ -1029,8 +1056,8 @@ jobs:
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
runner.os == 'macOS'
name: (MACOS,CONDA) Set allow_multiple_omp config
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
yggconfig --allow-multiple-omp
Expand Down Expand Up @@ -1241,6 +1268,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
name: (PIP) Set up Julia
uses: julia-actions/setup-julia@v1
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
name: Set up Matlab
uses: matlab-actions/setup-matlab@v1
Expand Down Expand Up @@ -1275,7 +1305,7 @@ jobs:
name: (MACOS,PIP) Set C compiler to llvm clang
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
name: (WINDOWS,CONDA) Set up miniconda base environment
name: (CONDA) Set up miniconda base environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down Expand Up @@ -1332,8 +1362,8 @@ jobs:
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
runner.os == 'macOS'
name: (MACOS,CONDA) Set allow_multiple_omp config
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
yggconfig --allow-multiple-omp
Expand Down Expand Up @@ -1543,6 +1573,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
name: (PIP) Set up Julia
uses: julia-actions/setup-julia@v1
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
name: Set up Matlab
uses: matlab-actions/setup-matlab@v1
Expand Down Expand Up @@ -1577,7 +1610,7 @@ jobs:
name: (MACOS,PIP) Set C compiler to llvm clang
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
name: (WINDOWS,CONDA) Set up miniconda base environment
name: (CONDA) Set up miniconda base environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down Expand Up @@ -1634,8 +1667,8 @@ jobs:
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
runner.os == 'macOS'
name: (MACOS,CONDA) Set allow_multiple_omp config
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
yggconfig --allow-multiple-omp
Expand Down
4 changes: 3 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
History
=======

1.9.0 (2023-04-11) Migrate to using extended version of rapidjson/python-rapidjson for serialization
1.9.0 (2023-04-14) Migrate to using extended version of rapidjson/python-rapidjson for serialization and add support for models written in Julia
------------------

* Added Julia interface with units implemented via Unitful
* Added Julia versions of examples
* Dropped support for Python 3.5
* Changed rapidjson submodule to extended version
* Vendor python-rapidjson extension
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ recursive-include yggdrasil *.txt
recursive-include yggdrasil *.json
recursive-include yggdrasil *.f90
recursive-include yggdrasil *.xml
recursive-include yggdrasil *.jl
recursive-include yggdrasil/examples *.py
recursive-include yggdrasil/examples *.rst
recursive-include yggdrasil/demos *.py
Expand All @@ -34,6 +35,8 @@ include yggdrasil/languages/LPy/lpy_model.py
include yggdrasil/languages/R/DESCRIPTION
include yggdrasil/languages/R/NAMESPACE
include yggdrasil/languages/R/R/*.R
include yggdrasil/languages/Julia/Yggdrasil/*.toml
include yggdrasil/languages/Julia/Yggdrasil/src/*.jl
include yggdrasil/languages/fortran/*.f90
include yggdrasil/languages/fortran/*.c
include yggdrasil/languages/fortran/*.h
Expand Down
5 changes: 3 additions & 2 deletions docs/source/examples/make_example_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'r': 'R',
'R': 'R',
'c': 'C',
'julia': 'Julia',
'cpp': 'C++',
'all': 'Mixed',
'all_nomatlab': 'Mixed w/o Matlab',
Expand Down Expand Up @@ -90,15 +91,15 @@ def get_default_lang(k):

def write_src_ref(fd, k):
default = get_default_lang(k)
assert(default)
assert default
write_src(fd, k, default, upone=True)
fd.write('\n')
write_ref_link(fd, k)


def write_yml_ref(fd, k):
default = get_default_lang(k)
assert(default)
assert default
write_yml(fd, k, default, upone=True)
fd.write('\n')
write_ref_link(fd, k)
Expand Down
9 changes: 9 additions & 0 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,12 @@ If you would like to use OpenSimRoot, you will need to install GNU make. If you
* ``brew install make`` on Mac
* ``apt-get install make`` on Linux
* ``choco install make`` on Windows

Additional Steps for Julia Models
---------------------------------

If you do not use conda/mamba to install ``julia``, or you are installing |yggdrasil| on a Windows machine or an M1/M2 Mac (there are not currently ``julia`` conda packages for these systems as of 2023/04/07, but this may change), you will need to install it yourself. Julia downloads can be found `here <https://julialang.org/downloads/>`_.

Once julia is installed, you can complete the installation of the |yggdrasil| Julia interface via::

$ ygginstall julia
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
skip = "pp* cp2* cp33* cp34* cp35* cp36* *musllinux* cp310-manylinux_ppc64le cp311-manylinux_ppc64le"
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686 *ppc64le"
test-requires = ["pytest", "flaky"]
test-command = "ygginfo && pytest -m subset_rapidjson --import-mode=importlib {project}/tests"
before-test = "pip install --only-binary=numpy,scipy numpy scipy"

# [tool.cibuildwheel.linux]
# before-all = "yum install -y openblas-devel"

# [[tool.cibuildwheel.overrides]]
# select = "cp3{7,8,9,10,11}-manylinux_i686"
# before-all = ""

# [[tool.cibuildwheel.overrides]]
# select = "cp3{7,8,9,10,11}-manylinux_ppc64le"
# before-test = "pip install --only-binary=numpy numpy"
# before-all = "yum install -y openblas-devel"

[tool.black]
line-length = 88
target-version = ['py27', 'py36', 'py37', 'py38']
Expand Down
15 changes: 14 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "yggdrasil" %}
{% set version = "1.9.0" %}
{% set version = "1.9.1" %}
{% set PY_VER_MAJOR = PY_VER.split('.')[0] %}
{% set PY_VER_MINOR = PY_VER.split('.')[1] %}

Expand Down Expand Up @@ -73,6 +73,7 @@ requirements:
- scipy
- six
- sysv_ipc # [not win]
- toml
- unyt

test:
Expand Down Expand Up @@ -149,6 +150,18 @@ outputs:
- czmq
- lz4
- zeromq
- name: yggdrasil.julia
build:
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
run_exports:
- {{ pin_subpackage('yggdrasil.julia') }}
requirements:
host:
- juliaup
- python
run:
- {{ pin_subpackage('yggdrasil', exact=True) }}
- juliaup
- name: yggdrasil.mpi
build:
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ requests
scipy
six
sysv_ipc; platform_system != 'Windows'
toml
unyt
17 changes: 17 additions & 0 deletions requirements_condaonly.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake; platform_system != 'Windows' # [conda,c]
czmq # [conda,zmq,c]
julia>=1.1.1 # [conda,julia]
matplotlib # [conda]
r-rcpp<=1.0.3; platform_system == 'Darwin' # [conda,R]
r-base # [conda,R]
r-bit64 # [conda,R]
r-r6 # [conda,R]
r-reticulate # [conda,R]
r-zeallot # [conda,R]
r-units # [conda,R]
zeromq # [conda,zmq,c]
# c-compiler; platform_system == 'Windows' # [conda,c]
# cxx-compiler; platform_system == 'Windows' # [conda,c]
m2w64-gcc-fortran; platform_system == 'Windows' # [conda,fortran]
m2w64-toolchain_win-64; platform_system == 'Windows' # [conda,fortran]
fortran-compiler; platform_system != 'Windows' # [conda,fortran]
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ def scripts():
('r', 'r_model.R'),
('fortran', ['hellofunc.f90', 'fortran_model.f90']),
('sbml', 'sbml_model.xml'),
('osr', 'osr_model.xml')]
('osr', 'osr_model.xml'),
('julia', 'julia_model.jl')]
scripts = {}
for k, v in script_list:
if isinstance(v, list):
Expand Down
Loading

0 comments on commit 270e65a

Please sign in to comment.