Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
246ffce
change rms branch to what it is on `main`
JacksonBurns Jan 14, 2025
b360bd4
switch back to HWP's branch of RMS; update setting of vars
JacksonBurns Jan 15, 2025
dfbe675
remove single quotes
JacksonBurns Jan 15, 2025
6c99b44
change env vars again
JacksonBurns Jan 15, 2025
52a23cb
LD_LIBRARY_PATH debugging
JacksonBurns Jan 16, 2025
4803c26
remove LD_LIBRARY_PATH debugging; do not set PYTHONPATH or modify PATH
JacksonBurns Jan 16, 2025
7187cd4
try setting the PATH but not the PYTHONPATH
JacksonBurns Jan 16, 2025
4ac1aa6
[DEBUG] Don't set PYTHONPATH in pure-python action either
JacksonBurns Jan 16, 2025
4e92189
explicitly set `PYTHON` to point toward the Python we want Julia to u…
JacksonBurns Jan 16, 2025
ef924f0
increment upload-artifact version
JacksonBurns Jan 16, 2025
43c8a88
leave note for future self
JacksonBurns Jan 16, 2025
76cac4c
set JULIA_PYTHONCALL_EXE to point to our conda python
JacksonBurns Jan 16, 2025
78c502f
set pythonpath too
JacksonBurns Jan 16, 2025
7937eae
ensure PYTHONHOME isn't set during RMS install
JacksonBurns Jan 17, 2025
8fe65c1
set `LD_LIBRARY_PATH`
JacksonBurns Jan 17, 2025
a60e011
install rosetta to try and fix python x86 compat mode 'encodings' error
JacksonBurns Jan 17, 2025
8455555
try just installing juliaup from conda forge, idek at this point
JacksonBurns Jan 17, 2025
8803c1f
try actually installing rmg to avoid setting PYTHONPATH
JacksonBurns Jan 17, 2025
6d82371
cleanup setup.py towards making rmg installable
JacksonBurns Jan 17, 2025
aa7d7f2
dont dump c files
JacksonBurns Jan 17, 2025
fcc5fee
no html files
JacksonBurns Jan 17, 2025
0a1fe0b
openbabel stfu
JacksonBurns Jan 17, 2025
dae8a56
make rmg locally installable with pip install
JacksonBurns Jan 17, 2025
7102ef5
don't modify PATH
JacksonBurns Jan 17, 2025
5cd1bd5
remove deprecated make targets, consolidate checks
JacksonBurns Jan 17, 2025
934f68b
port some other changes from the full ci
JacksonBurns Jan 17, 2025
348059d
typo
JacksonBurns Jan 17, 2025
50155d9
switch back to conda
JacksonBurns Jan 17, 2025
9ab6f75
[DEBUG] wtf is juliaup doing to my os?
JacksonBurns Jan 17, 2025
7d81721
Multiprocessing `fork` instead of `spawn`, see extended
JacksonBurns Jan 21, 2025
eecf41c
re-build rmg after RMS install to ensure deps arent' broken
JacksonBurns Jan 21, 2025
9dd8926
move setting start method to conftest.py to run it once
JacksonBurns Jan 21, 2025
67385ae
finish the incomplete setting of x86 emulation
JacksonBurns Jan 21, 2025
77e5013
try and make julia leave the compilers alone
JacksonBurns Jan 21, 2025
c92c837
this should not be required
JacksonBurns Jan 21, 2025
b1fbe5c
try incrementing Julia version, IDEK at this point
JacksonBurns Jan 21, 2025
d118670
revert Julia version increment, set back to 1.9
jonwzheng Jan 21, 2025
0d615e6
try setting LD_LIBRARY_PATH rather than LD_PRELOAD
jonwzheng Jan 21, 2025
733d2c4
typo
jonwzheng Jan 21, 2025
32c899c
whoopsie - another typo
jonwzheng Jan 21, 2025
aea0a01
put Juliaup before path update and add more print statements
jonwzheng Jan 21, 2025
fb11cb7
try without export
jonwzheng Jan 21, 2025
cc0f895
this is not needed, pure python mode works without it
JacksonBurns Jan 22, 2025
ab2f408
don't allow rms to install anything in the conda environment; we have
JacksonBurns Jan 22, 2025
8f713d3
soft revert
JacksonBurns Jan 22, 2025
e844d15
more comprehensize debugging info for failed Julia imports
JacksonBurns Jan 22, 2025
5268688
try and make sure juliacall uses the correct julia
JacksonBurns Jan 22, 2025
028ce64
allow rms install to 'fail', see extended
JacksonBurns Jan 22, 2025
cc2c9ba
make juliapackage use our globally installed RMS package
JacksonBurns Jan 23, 2025
b2686e6
persist the environment variables changes needed when installing RMS
JacksonBurns Jan 23, 2025
8486fb7
incorrect rebase fixup
JacksonBurns Jan 23, 2025
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
94 changes: 61 additions & 33 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ jobs:

- name: Compel Arm-based Mac to use x86
if: matrix.os == 'macos-latest'
run: echo "CONDA_SUBDIR=osx-64" >> $GITHUB_ENV
run: |
echo "CONDA_SUBDIR=osx-64" >> $GITHUB_ENV
# softwareupdate --install-rosetta --agree-to-license # did not help with encodings issue

- name: Setup Miniforge Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -83,64 +85,90 @@ jobs:
miniforge-version: latest
python-version: ${{ matrix.python-version }}
activate-environment: rmg_env
use-mamba: true
auto-update-conda: true
show-channel-urls: true
channels: conda-forge,cantera,rmg
conda-remove-defaults: "true"

# - name: Continue to Coerce Arm-Mac # pure python mode works without this, so it isn't required
# if: matrix.os == 'macos-latest'
# run: |
# conda config --env --set subdir osx-64

# list the environment for debugging purposes
- name: mamba info
- name: conda info
run: |
mamba info
mamba list
conda info
conda list

# Clone RMG-database
- name: Clone RMG-database
run: |
cd ..
git clone -b $RMG_DATABASE_BRANCH https://github.com/ReactionMechanismGenerator/RMG-database.git

# modify env variables as directed in the RMG installation instructions
- name: Set Environment Variables
run: |
RUNNER_CWD=$(pwd)
echo "PYTHONPATH=$RUNNER_CWD/RMG-Py:$PYTHONPATH" >> $GITHUB_ENV
echo "$RUNNER_CWD/RMG-Py" >> $GITHUB_PATH
# # modify env variables as directed in the RMG installation instructions
# - name: Set Environment Variables
# run: |
# RUNNER_CWD=$(pwd)
# echo "$RUNNER_CWD/RMG-Py" >> $GITHUB_PATH # I don't think this actually accomplishes anything

# RMG build step
- name: make RMG
run: |
make clean
make
make install

# Setup Juliaup
- name: Set Julia paths
- name: PRE-JULIA ENVIRONMENT
run: |
# echo "JULIAUP_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_ENV
# echo "JULIAUP_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_PATH
# echo "JULIA_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_ENV
# echo "JULIA_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_PATH
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_ENV
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_PATH
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_ENV
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_PATH
echo "JULIA_CONDAPKG_BACKEND=Current" >> $GITHUB_ENV
# echo "JULIA_CONDAPKG_BACKEND=Current" >> $GITHUB_PATH
printenv | sort
conda list

- name: Setup Juliaup
uses: julia-actions/install-juliaup@v2
with:
channel: '1.9'

- name: Check Julia version
run: julia --version
- name: POST JULIAUP
run: |
printenv | sort
conda list

# - name: Try and Make Julia stop ruining the Compilers
# run: |
# echo "LD_LIBRARY_PATH=$CONDA_PREFIX/lib" >> $GITHUB_ENV

# - name: POST LIBRARY PATH UPDATE
# run: |
# printenv | sort
# conda list

- name: Set some env vars
run: |
echo "JULIA_CONDAPKG_BACKEND=Null" >> $GITHUB_ENV
echo "JULIA_PYTHONCALL_EXE=$CONDA_PREFIX/bin/python" >> $GITHUB_ENV

# RMS installation and linking to Julia
- name: Install and link Julia dependencies
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
# JULIA_CONDAPKG_EXE points to the existing conda/mamba to avoid JuliaCall from installing their own. See https://juliapy.github.io/PythonCall.jl/stable/pythoncall/#If-you-already-have-a-Conda-environment.
run: . install_rms.sh

- name: Where is RMS?
run: julia -E "using ReactionMechanismSimulator; pathof(ReactionMechanismSimulator)"

- name: Set some other env vars
run: |
mamba install conda-forge::pyjuliacall
julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator'
echo "PYTHON_JULIAPKG_EXE=$(which julia)" >> $GITHUB_ENV
echo "PYTHON_JULIAPKG_PROJECT=$HOME/.julia/packages" >> $GITHUB_ENV

- name: POST-JULIA ENVIRONMENT
run: |
printenv | sort
conda list

# - name: Rebuild RMG
# run: |
# make clean
# make

- name: Install Q2DTor
run: echo "" | make q2dtor
Expand Down Expand Up @@ -322,14 +350,14 @@ jobs:

- name: Upload regression summary artifact
# the annotate workflow uses this artifact to add a comment to the PR
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if : ${{ github.event_name == 'pull_request' }}
with:
name: regression_summary
path: summary.txt

- name: Upload Comparison Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: regression_test_comparison_results
path: |
Expand All @@ -339,7 +367,7 @@ jobs:
- name: Code coverage install and run
if: success() || ( failure() && steps.regression-execution.conclusion == 'success' )
run: |
mamba install -y -c conda-forge codecov
conda install -y -c conda-forge codecov
codecov

build-and-push-docker:
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/pure_python_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,23 @@ jobs:
miniforge-version: latest
python-version: ${{ matrix.python-version }}
activate-environment: rmg_env
use-mamba: true
auto-update-conda: true
show-channel-urls: true
channels: conda-forge,cantera,rmg
conda-remove-defaults: "true"

# list the environment for debugging purposes
- name: mamba info
- name: conda info
run: |
mamba info
mamba list
conda info
conda list

# Clone RMG-database
- name: Clone RMG-database
run: |
cd ..
git clone -b $RMG_DATABASE_BRANCH https://github.com/ReactionMechanismGenerator/RMG-database.git

# modify env variables as directed in the RMG installation instructions
- name: Set Environment Variables
run: |
RUNNER_CWD=$(pwd)
echo "PYTHONPATH=$RUNNER_CWD/RMG-Py:$PYTHONPATH" >> $GITHUB_ENV
echo "$RUNNER_CWD/RMG-Py" >> $GITHUB_PATH

# RMG build step
- name: make RMG
run: |
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
#
################################################################################

# build dir
reactionmechanismgenerator.egg-info/

# MacOS files
.DS_Store

# Compiled Python modules
*.pyc
*.so
*.pyd
# and intermediate source files
*.c

# Image files generated by RMG
*.png
Expand Down
22 changes: 4 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,14 @@
CC=gcc
CXX=g++

.PHONY : all minimal main solver check pycheck arkane clean install decython documentation test q2dtor
.PHONY : all check clean install decython documentation test q2dtor

all: pycheck main solver check

minimal:
python setup.py build_ext minimal --inplace --build-temp .

main:
python setup.py build_ext main --inplace --build-temp .

solver:
@ python utilities.py check-pydas
python setup.py build_ext solver --inplace --build-temp .

arkane:
python setup.py build_ext arkane --inplace --build-temp .
all: check install check

check:
@ python utilities.py check-dependencies

pycheck:
@ python utilities.py check-python
@ python utilities.py check-pydas

documentation:
$(MAKE) -C documentation html
Expand All @@ -42,7 +28,7 @@ clean-solver:

install:
@ python utilities.py check-pydas
python setup.py install
python -m pip install -vv --no-cache-dir -e .

q2dtor:
@ echo -e "\nInstalling Q2DTor...\n"
Expand Down
2 changes: 2 additions & 0 deletions arkane/encorr/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
from arkane.exceptions import BondAdditivityCorrectionError
from arkane.modelchem import LevelOfTheory, CompositeLevelOfTheory

pybel.ob.obErrorLog.SetOutputLevel(0)

# ######## Database loading ##########
quantum_corrections_path = os.path.join(settings['database.directory'], 'quantum_corrections', 'data.py')
spec = importlib.util.spec_from_file_location("quantum_calculations", quantum_corrections_path)
Expand Down
24 changes: 24 additions & 0 deletions install_rms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# manual installation steps
# start by installing juliaup on your system globally
# curl -fsSL https://install.julialang.org | sh
# # restart shell
# juliaup add 1.9
# juliaup default 1.9
# juliaup remove release

# actual steps
conda install -y conda-forge::pyjuliacall # conda-forge::pyside2
# export JULIA_CONDAPKG_BACKEND=Current
# export JULIA_CONDAPKG_EXE=$CONDA_EXE
# export JULIA_PYTHONCALL_EXE=$CONDA_PREFIX/bin/python

# https://juliapy.github.io/PythonCall.jl/stable/pythoncall/#If-you-already-have-Python-and-required-Python-packages-installed
export JULIA_CONDAPKG_BACKEND=Null
export JULIA_PYTHONCALL_EXE=$CONDA_PREFIX/bin/python
# export MPLBACKEND=tkagg # supported backend for PythonPlot.jl, needed by RMS

julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator; Pkg.instantiate()' | echo "RMS install error - continuing anyway ¯\_(ツ)_/¯"

# ensure that juliacall in Python uses the correct julia executable and packages: https://github.com/JuliaPy/PyJuliaPkg?tab=readme-ov-file#which-julia-gets-used
export PYTHON_JULIAPKG_EXE=$(which julia)
export PYTHON_JULIAPKG_PROJECT=$HOME/.julia/packages
47 changes: 11 additions & 36 deletions rmgpy/rmg/reactionmechanismsimulator_reactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,20 @@
"""
import itertools
import logging
import sys

import numpy as np

import rmgpy.constants as constants

NO_JULIA = True
try:
import juliacall
from juliacall import Main
Main.seval("using PythonCall")
Main.seval("using ReactionMechanismSimulator")
Main.seval("using ReactionMechanismSimulator.Sundials")
NO_JULIA = False
except:
logging.warning("Julia import failed, RMS reactors not available.")

from rmgpy import constants
from rmgpy.data.kinetics.depository import DepositoryReaction
from rmgpy.data.kinetics.family import TemplateReaction
from rmgpy.data.solvation import SolventData
from rmgpy.kinetics.arrhenius import (
Arrhenius,
ArrheniusBM,
ArrheniusChargeTransfer,
ArrheniusEP,
Marcus,
MultiArrhenius,
MultiPDepArrhenius,
PDepArrhenius,
)
from rmgpy.kinetics.chebyshev import Chebyshev
from rmgpy.kinetics.falloff import Lindemann, ThirdBody, Troe
from rmgpy.kinetics.kineticsdata import KineticsData
from rmgpy.kinetics.surface import StickingCoefficient, SurfaceChargeTransfer
from rmgpy.molecule.fragment import Fragment
from rmgpy.reaction import Reaction
Expand All @@ -77,7 +57,17 @@
from rmgpy.species import Species
from rmgpy.thermo.nasa import NASA, NASAPolynomial
from rmgpy.thermo.thermodata import ThermoData
from rmgpy.thermo.wilhoit import Wilhoit


NO_JULIA = True
try:
from juliacall import Main
Main.seval("using PythonCall")
Main.seval("using ReactionMechanismSimulator")
Main.seval("using ReactionMechanismSimulator.Sundials")
NO_JULIA = False
except Exception as e:
logging.warning(f"Julia import failed, RMS reactors not available.\nException: {str(e)}\nStacktrace:\n{e.__traceback__}")


def to_julia(obj):
Expand All @@ -104,21 +94,6 @@ def to_julia(obj):
else: # Other native Python project does not need special conversion.
return obj

NO_JULIA = False
try:
if __debug__:
from os.path import abspath, dirname, exists, join

from julia.api import Julia
path_rms = dirname(dirname(dirname(abspath(__file__))))
jl = Julia(sysimage=join(path_rms, "rms.so")) if exists(join(path_rms, "rms.so")) else Julia(compiled_modules=False)
from diffeqpy import de
from julia import Main
from pyrms import rms
except Exception as e:
logging.info("Unable to import Julia dependencies, original error: " + str(e) + ". RMS features will not be available on this execution.")
NO_JULIA = True


class PhaseSystem:
"""
Expand Down
Loading
Loading