Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul RMG-RMS Python-Julia dependencies & Add tests for many testless Arkane network algorithms #2640

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
7feb483
switch to branch
hwpang Mar 22, 2024
a56bcbc
Use pyjuliacall instead of pyjulia
hwpang Mar 22, 2024
94c5f14
No need to install julia from conda
hwpang Mar 22, 2024
81cf924
update
hwpang Mar 22, 2024
f9933ad
update
hwpang Mar 22, 2024
01818c0
Swap the order
hwpang Mar 22, 2024
a23d541
update
hwpang Mar 22, 2024
4ecb2cd
doc
hwpang Mar 22, 2024
b524f75
Use the preexisting mamba
hwpang Apr 1, 2024
b9e822d
Use JULIA_CONDAPKG_EXE=$CONDA/condabin/conda
hwpang Apr 1, 2024
f907972
Add channels
hwpang Apr 1, 2024
42cfdb8
skip make for now for debugging
hwpang Apr 1, 2024
5b167b3
Trying to use juliaup
hwpang Apr 1, 2024
cc86e36
Don't need to install diffeqpy
hwpang Apr 1, 2024
efac898
Uncomment make step
hwpang Apr 1, 2024
2f57f42
Don't need julia plug in
hwpang Apr 1, 2024
12cfaf1
Use mamba
hwpang Apr 1, 2024
14a637b
No need to add channels
hwpang Apr 1, 2024
502e349
import juliacall
hwpang Apr 2, 2024
5475118
Don't track coverage
hwpang Apr 2, 2024
d73a091
debug
hwpang Apr 2, 2024
844fe53
debug
hwpang Apr 2, 2024
c011288
convert empty list
hwpang Apr 2, 2024
8fa0ea0
Add additional test file for sls
hwpang Apr 2, 2024
f3c5710
Should be seval
hwpang Apr 2, 2024
e77327a
debug
hwpang Apr 2, 2024
46e7341
update doc
hwpang Apr 2, 2024
9533fe7
Add tests
hwpang Apr 3, 2024
0573953
Don't track plots
hwpang Apr 3, 2024
d92657d
don't track yaml files
hwpang Apr 3, 2024
0b985bc
update name
hwpang Apr 3, 2024
956ee47
track yaml files
hwpang Apr 3, 2024
4e7e568
See where we get julia from
hwpang Apr 3, 2024
c0be490
Add Pkg.
hwpang Apr 3, 2024
a4da2b8
debug
hwpang Apr 3, 2024
095efc7
update
hwpang Apr 3, 2024
7608692
debug
hwpang Apr 4, 2024
6bd28bd
use Sundials solver and convert list to julia vector
hwpang Apr 4, 2024
69ccd2b
Resolve AttributeError: 'Interface' object has no attribute 'species'
hwpang Apr 4, 2024
8b968a8
Convert to julia object
hwpang Apr 4, 2024
ed00c27
Remove duplicate test
hwpang Apr 25, 2024
3810a7e
Add comments and juliaup status
hwpang Apr 25, 2024
c468447
Add back changes mistakenly done by formatter
hwpang Apr 25, 2024
8318a90
Don't change release note
hwpang Apr 25, 2024
f05549c
Add docstring
hwpang Apr 25, 2024
9bfbc95
Update rmgpy/rmg/reactors.py
hwpang Apr 25, 2024
4179d05
Fix
hwpang Apr 25, 2024
d72a373
Avoid duplicating
hwpang Apr 25, 2024
233be9d
Avoid casting to list
hwpang Apr 25, 2024
fd23efc
Switch to use SciMLBase and Sundials under RMS
hwpang May 14, 2024
1591be3
Add changelog
hwpang May 14, 2024
92ee4fd
Add comment and docstring to emphasize only supporting native python …
hwpang May 14, 2024
a7fe72f
Merge branch 'main' into test_rms
hwpang May 20, 2024
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
14 changes: 8 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ jobs:
# 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: |
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator'
juliaup status
export JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba
hwpang marked this conversation as resolved.
Show resolved Hide resolved
julia -e 'ENV["JULIA_CONDAPKG_BACKEND"] = "Current"; using Pkg; Pkg.add(Pkg.PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator'

- name: Install Q2DTor
run: echo "" | make q2dtor
Expand All @@ -169,7 +171,7 @@ jobs:
run: |
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation RMS_liquidSurface_ch4o2cat fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
do
if python-jl rmg.py test/regression/"$regr_test"/input.py; then
if python rmg.py test/regression/"$regr_test"/input.py; then
echo "$regr_test" "Executed Successfully"
else
echo "$regr_test" "Failed to Execute" | tee -a $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -258,7 +260,7 @@ jobs:

echo "<details>"
# Compare the edge and core
if python-jl scripts/checkModels.py \
if python scripts/checkModels.py \
"$regr_test-core" \
$REFERENCE/"$regr_test"/chemkin/chem_annotated.inp \
$REFERENCE/"$regr_test"/chemkin/species_dictionary.txt \
Expand All @@ -275,7 +277,7 @@ jobs:
cat "$regr_test-core.log"
echo "</details>"
echo "<details>"
if python-jl scripts/checkModels.py \
if python scripts/checkModels.py \
"$regr_test-edge" \
$REFERENCE/"$regr_test"/chemkin/chem_edge_annotated.inp \
$REFERENCE/"$regr_test"/chemkin/species_edge_dictionary.txt \
Expand All @@ -296,7 +298,7 @@ jobs:
if [ -f test/regression/"$regr_test"/regression_input.py ];
then
echo "<details>"
if python-jl rmgpy/tools/regression.py \
if python rmgpy/tools/regression.py \
test/regression/"$regr_test"/regression_input.py \
$REFERENCE/"$regr_test"/chemkin \
test/regression/"$regr_test"/chemkin
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ jobs:
- name: Install and link Julia dependencies
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
run: |
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator'
which julia
export JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba
julia -e 'ENV["JULIA_CONDAPKG_BACKEND"] = "Current"; using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator'

- name: Checkout gh-pages Branch
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ nbproject/*
.vscode/*

# Unit test files
.coverage
.coverage*
testing/*
htmlcov/*

Expand Down Expand Up @@ -117,3 +117,4 @@ examples/**/dictionary.txt
examples/**/reactions.py
examples/**/RMG_libraries
examples/**/species
examples/**/plots
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ RUN ln -snf /bin/bash /bin/sh
# - libxrender1 required by RDKit
RUN apt-get update && \
apt-get install -y \
make \
gcc \
wget \
git \
g++ \
libxrender1 && \
make \
gcc \
wget \
git \
g++ \
libxrender1 && \
apt-get autoremove -y && \
apt-get clean -y

Expand Down Expand Up @@ -64,16 +64,15 @@ ENV PATH="$RUNNER_CWD/RMG-Py:$PATH"
# setting this env variable fixes an issue with Julia precompilation on Windows
ENV JULIA_CPU_TARGET="x86-64,haswell,skylake,broadwell,znver1,znver2,znver3,cascadelake,icelake-client,cooperlake,generic"
RUN make && \
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master")); Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator' && \
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
julia -e 'ENV["JULIA_CONDAPKG_BACKEND"] = "Current"; using Pkg; Pkg.add(Pkg.PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator'

# RMG-Py should now be installed and ready - trigger precompilation and test run
RUN python-jl rmg.py examples/rmg/minimal/input.py
RUN python rmg.py examples/rmg/minimal/input.py
# delete the results, preserve input.py
RUN mv examples/rmg/minimal/input.py . && \
rm -rf examples/rmg/minimal/* && \
mv input.py examples/rmg/minimal/

# when running this image, open an interactive bash terminal inside the conda environment
RUN echo "source activate rmg_env" > ~/.bashrc
RUN echo "source activate rmg_env" >~/.bashrc
ENTRYPOINT ["/bin/bash", "--login"]
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ decython:
find . -name *.pyc -exec rm -f '{}' \;

test-all:
python-jl -m pytest
python -m pytest

test test-unittests:
python-jl -m pytest -m "not functional and not database"
python -m pytest -m "not functional and not database"

test-functional:
python-jl -m pytest -m "functional"
python -m pytest -m "functional"

test-database:
python-jl -m pytest -m "database"
python -m pytest -m "database"

eg0: all
mkdir -p testing/eg0
Expand Down
2 changes: 1 addition & 1 deletion documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python-jl $$(which sphinx-build)
SPHINXBUILD = python $$(which sphinx-build)
PAPER =
BUILDDIR = build

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Installation by Source Using Anaconda Environment for Unix-based Systems: Linux

#. Finally, you can run RMG from any location by typing the following (given that you have prepared the input file as ``input.py`` in the current folder). ::

python-jl replace/with/path/to/rmg.py input.py
python replace/with/path/to/rmg.py input.py

You may now use RMG-Py, Arkane, as well as any of the :ref:`Standalone Modules <modules>` included in the RMG-Py package.

Expand All @@ -158,15 +158,15 @@ You might have to edit them slightly to match your exact paths. Specifically,
you will need ``/opt/miniconda3/envs/rmg_env`` to point to where your conda environment is located.

This configuration will allow you to debug the rms_constant_V example, running through
python-jl. ::
python. ::

{
"name": "Python: rmg.py rms_constant_V",
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}/",
"program": "rmg.py",
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
"args": [
"examples/rmg/rms_constant_V/input.py",
],
Expand All @@ -185,7 +185,7 @@ Open one of the many test files named ``*Test.py`` in ``test/rmgpy`` before you
"type": "python",
"request": "launch",
"program": "/opt/miniconda3/envs/rmg_env/bin/pytest",
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
"args": [
"--capture=no",
"--verbose",
Expand All @@ -205,7 +205,7 @@ This configuration will allow you to debug running all the database tests.::
"type": "python",
"request": "launch",
"program": "/opt/miniconda3/envs/rmg_env/bin/pytest",
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
"args": [
"--capture=no",
"--verbose",
Expand All @@ -226,7 +226,7 @@ This configuration will allow you to use the debugger breakpoints inside unit te
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
"console": "integratedTerminal",
"justMyCode": false,
"env": {"PYTEST_ADDOPTS": "--no-cov",} // without disabling coverage VS Code doesn't stop at breakpoints while debugging because pytest-cov is using the same technique to access the source code being run
Expand Down Expand Up @@ -274,7 +274,7 @@ To configure the rest of the settings, find the ``settings.json`` file in your `
You can use the following settings to configure the pytest framework::

"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "python-jl -m pytest",
"python.testing.pytestPath": "python -m pytest",
"python.testing.pytestArgs": [
"-p", "julia.pytestplugin",
"--julia-compiled-modules=no",
Expand Down
14 changes: 7 additions & 7 deletions documentation/source/users/rmg/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Running a basic RMG job is straightforward, as shown in the example below. Howev

Basic run::

python-jl rmg.py input.py
python rmg.py input.py

.. _inputflags:

Expand All @@ -19,7 +19,7 @@ Input flags

The options for input flags can be found in ``/RMG-Py/rmgpy/util.py``. Running ::

python-jl rmg.py -h
python rmg.py -h

at the command line will print the documentation from ``util.py``, which is reproduced below for convenience::

Expand Down Expand Up @@ -63,23 +63,23 @@ Some representative example usages are shown below.

Run by restarting from a seed mechanism::

python-jl rmg.py -r path/to/seed/ input.py
python rmg.py -r path/to/seed/ input.py

Run with CPU time profiling::

python-jl rmg.py -p input.py
python rmg.py -p input.py

Run with multiprocessing for reaction generation and QMTP::

python-jl rmg.py -n <Max number of processes allowed> input.py
python rmg.py -n <Max number of processes allowed> input.py

Run with setting a limit on the maximum execution time::

python-jl rmg.py -t <DD:HH:MM:SS> input.py
python rmg.py -t <DD:HH:MM:SS> input.py

Run with setting a limit on the maximum number of iterations::

python-jl rmg.py -i <Max number of desired iterations> input.py
python rmg.py -i <Max number of desired iterations> input.py


Details on the multiprocessing implementation
Expand Down
17 changes: 4 additions & 13 deletions environment.yml
hwpang marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# made dependency list more explicit (@JacksonBurns).
# - October 16, 2023 Switched RDKit and descripatastorus to conda-forge,
# moved diffeqpy to pip and (temporarily) removed chemprop
#
# - May 14, 2024 Removed diffeqpy by switching to call SciMLBase and Sundials using JuliaCall

name: rmg_env
channels:
- defaults
Expand Down Expand Up @@ -49,8 +50,8 @@ dependencies:
- conda-forge::rdkit >=2022.09.1

# general-purpose external software tools
- conda-forge::julia=1.9.1
- conda-forge::pyjulia >=0.6
- conda-forge::juliaup
hwpang marked this conversation as resolved.
Show resolved Hide resolved
- conda-forge::pyjuliacall # for calling julia packages

# Python tools
- python >=3.7
Expand Down Expand Up @@ -88,18 +89,8 @@ dependencies:
- rmg::pydas >=1.0.3
- rmg::pydqed >=1.0.3
- rmg::pyrdl
- rmg::pyrms
- rmg::symmetry

# packages we would like to stop maintaining (and why)
- rmg::diffeqpy
# we should use the official verison https://github.com/SciML/diffeqpy),
# rather than ours (which is only made so that we can get it from conda)
# It is only on pip, so we will need to do something like:
# https://stackoverflow.com/a/35245610
# Note that _some other_ dep. in this list requires diffeqpy in its recipe
# which will cause it to be downloaded from the rmg conda channel

# conda mutex metapackage
- nomkl

Expand Down
Loading
Loading