Skip to content

Commit eac0906

Browse files
hwpangJacksonBurns
authored andcommitted
HWP Initial JuliaCall efforts
These squashed commits contain all of the initial efforts by HWP to switch from pythoncall to JuliaCall
1 parent b041507 commit eac0906

31 files changed

Lines changed: 1032 additions & 148 deletions

File tree

.github/workflows/CI.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,11 @@ jobs:
173173
# RMS installation and linking to Julia
174174
- name: Install and link Julia dependencies
175175
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
176+
# 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.
176177
run: |
177-
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
178-
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="for_rmg")); using ReactionMechanismSimulator'
178+
juliaup status
179+
export JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba
180+
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'
179181
180182
- name: Install Q2DTor
181183
run: echo "" | make q2dtor
@@ -192,7 +194,7 @@ jobs:
192194
run: |
193195
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;
194196
do
195-
if python-jl rmg.py test/regression/"$regr_test"/input.py; then
197+
if python rmg.py test/regression/"$regr_test"/input.py; then
196198
echo "$regr_test" "Executed Successfully"
197199
else
198200
echo "$regr_test" "Failed to Execute" | tee -a $GITHUB_STEP_SUMMARY
@@ -282,7 +284,7 @@ jobs:
282284
283285
echo "<details>"
284286
# Compare the edge and core
285-
if python-jl scripts/checkModels.py \
287+
if python scripts/checkModels.py \
286288
"$regr_test-core" \
287289
$REFERENCE/"$regr_test"/chemkin/chem_annotated.inp \
288290
$REFERENCE/"$regr_test"/chemkin/species_dictionary.txt \
@@ -299,7 +301,7 @@ jobs:
299301
cat "$regr_test-core.log" || (echo "Dumping the whole log failed, please download it from GitHub actions. Here are the first 100 lines:" && head -n100 "$regr_test-core.log")
300302
echo "</details>"
301303
echo "<details>"
302-
if python-jl scripts/checkModels.py \
304+
if python scripts/checkModels.py \
303305
"$regr_test-edge" \
304306
$REFERENCE/"$regr_test"/chemkin/chem_edge_annotated.inp \
305307
$REFERENCE/"$regr_test"/chemkin/species_edge_dictionary.txt \
@@ -320,7 +322,7 @@ jobs:
320322
if [ -f test/regression/"$regr_test"/regression_input.py ];
321323
then
322324
echo "<details>"
323-
if python-jl rmgpy/tools/regression.py \
325+
if python rmgpy/tools/regression.py \
324326
test/regression/"$regr_test"/regression_input.py \
325327
$REFERENCE/"$regr_test"/chemkin \
326328
test/regression/"$regr_test"/chemkin

.github/workflows/docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ jobs:
6868
- name: Install and link Julia dependencies
6969
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
7070
run: |
71-
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
72-
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="for_rmg")); using ReactionMechanismSimulator'
71+
which julia
72+
export JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba
73+
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'
7374
7475
- name: Checkout gh-pages Branch
7576
uses: actions/checkout@v2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ nbproject/*
4747
.vscode/*
4848

4949
# Unit test files
50-
.coverage
50+
.coverage*
5151
testing/*
5252
htmlcov/*
5353

@@ -117,3 +117,4 @@ examples/**/dictionary.txt
117117
examples/**/reactions.py
118118
examples/**/RMG_libraries
119119
examples/**/species
120+
examples/**/plots

Dockerfile

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ RUN ln -snf /bin/bash /bin/sh
1313
# - libxrender1 required by RDKit
1414
RUN apt-get update && \
1515
apt-get install -y \
16-
make \
17-
gcc \
18-
wget \
19-
git \
20-
g++ \
21-
libxrender1 && \
16+
make \
17+
gcc \
18+
wget \
19+
git \
20+
g++ \
21+
libxrender1 && \
2222
apt-get autoremove -y && \
2323
apt-get clean -y
2424

2525
# Install conda
26-
RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" && \
27-
bash Miniforge3-Linux-x86_64.sh -b -p /miniforge && \
28-
rm Miniforge3-Linux-x86_64.sh
29-
ENV PATH="$PATH:/miniforge/bin"
26+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
27+
bash Miniconda3-latest-Linux-x86_64.sh -b -p /miniconda && \
28+
rm Miniconda3-latest-Linux-x86_64.sh
29+
ENV PATH="$PATH:/miniconda/bin"
3030

3131
# Set solver backend to mamba for speed
3232
RUN conda install -n base conda-libmamba-solver && \
@@ -70,16 +70,15 @@ ENV PATH="$RUNNER_CWD/RMG-Py:$PATH"
7070
# setting this env variable fixes an issue with Julia precompilation on Windows
7171
ENV JULIA_CPU_TARGET="x86-64,haswell,skylake,broadwell,znver1,znver2,znver3,cascadelake,icelake-client,cooperlake,generic"
7272
RUN make && \
73-
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master")); Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev=ENV["rmsbranch"])); using ReactionMechanismSimulator' && \
74-
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
73+
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'
7574

7675
# RMG-Py should now be installed and ready - trigger precompilation and test run
77-
RUN python-jl rmg.py examples/rmg/minimal/input.py
76+
RUN python rmg.py examples/rmg/minimal/input.py
7877
# delete the results, preserve input.py
7978
RUN mv examples/rmg/minimal/input.py . && \
8079
rm -rf examples/rmg/minimal/* && \
8180
mv input.py examples/rmg/minimal/
8281

8382
# when running this image, open an interactive bash terminal inside the conda environment
84-
RUN echo "source activate rmg_env" > ~/.bashrc
83+
RUN echo "source activate rmg_env" >~/.bashrc
8584
ENTRYPOINT ["/bin/bash", "--login"]

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ decython:
6262
find . -name *.pyc -exec rm -f '{}' \;
6363

6464
test-all:
65-
python-jl -m pytest
65+
python -m pytest
6666

6767
test test-unittests:
68-
python-jl -m pytest -m "not functional and not database"
68+
python -m pytest -m "not functional and not database"
6969

7070
test-functional:
71-
python-jl -m pytest -m "functional"
71+
python -m pytest -m "functional"
7272

7373
test-database:
74-
python-jl -m pytest -m "database"
74+
python -m pytest -m "database"
7575

7676
eg0: all
7777
mkdir -p testing/eg0

documentation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = python-jl $$(which sphinx-build)
6+
SPHINXBUILD = python $$(which sphinx-build)
77
PAPER =
88
BUILDDIR = build
99

documentation/source/users/rmg/installation/anacondaDeveloper.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Installation by Source Using Anaconda Environment for Unix-based Systems: Linux
124124

125125
#. 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). ::
126126

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

129129
You may now use RMG-Py, Arkane, as well as any of the :ref:`Standalone Modules <modules>` included in the RMG-Py package.
130130
For more information about using conda, please check out the `conda user guide <https://conda.io/projects/conda/en/latest/user-guide/getting-started.html>`_.
@@ -140,15 +140,15 @@ You might have to edit them slightly to match your exact paths. Specifically,
140140
you will need ``/opt/miniconda3/envs/rmg_env`` to point to where your conda environment is located.
141141

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

145145
{
146146
"name": "Python: rmg.py rms_constant_V",
147147
"type": "python",
148148
"request": "launch",
149149
"cwd": "${workspaceFolder}/",
150150
"program": "rmg.py",
151-
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
151+
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
152152
"args": [
153153
"examples/rmg/rms_constant_V/input.py",
154154
],
@@ -167,7 +167,7 @@ Open one of the many test files named ``*Test.py`` in ``test/rmgpy`` before you
167167
"type": "python",
168168
"request": "launch",
169169
"program": "/opt/miniconda3/envs/rmg_env/bin/pytest",
170-
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
170+
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
171171
"args": [
172172
"--capture=no",
173173
"--verbose",
@@ -187,7 +187,7 @@ This configuration will allow you to debug running all the database tests.::
187187
"type": "python",
188188
"request": "launch",
189189
"program": "/opt/miniconda3/envs/rmg_env/bin/pytest",
190-
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
190+
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
191191
"args": [
192192
"--capture=no",
193193
"--verbose",
@@ -208,7 +208,7 @@ This configuration will allow you to use the debugger breakpoints inside unit te
208208
"request": "launch",
209209
"program": "${file}",
210210
"purpose": ["debug-test"],
211-
"python": "/opt/miniconda3/envs/rmg_env/bin/python-jl",
211+
"python": "/opt/miniconda3/envs/rmg_env/bin/python",
212212
"console": "integratedTerminal",
213213
"justMyCode": false,
214214
"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
@@ -256,7 +256,7 @@ To configure the rest of the settings, find the ``settings.json`` file in your `
256256
You can use the following settings to configure the pytest framework::
257257

258258
"python.testing.pytestEnabled": true,
259-
"python.testing.pytestPath": "python-jl -m pytest",
259+
"python.testing.pytestPath": "python -m pytest",
260260
"python.testing.pytestArgs": [
261261
"-p", "julia.pytestplugin",
262262
"--julia-compiled-modules=no",

documentation/source/users/rmg/running.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Running a basic RMG job is straightforward, as shown in the example below. Howev
1010

1111
Basic run::
1212

13-
python-jl rmg.py input.py
13+
python rmg.py input.py
1414

1515
.. _inputflags:
1616

@@ -19,7 +19,7 @@ Input flags
1919

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

22-
python-jl rmg.py -h
22+
python rmg.py -h
2323

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

@@ -63,23 +63,23 @@ Some representative example usages are shown below.
6363

6464
Run by restarting from a seed mechanism::
6565

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

6868
Run with CPU time profiling::
6969

70-
python-jl rmg.py -p input.py
70+
python rmg.py -p input.py
7171

7272
Run with multiprocessing for reaction generation and QMTP::
7373

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

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

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

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

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

8484

8585
Details on the multiprocessing implementation

environment.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
# moved diffeqpy to pip and (temporarily) removed chemprop
1919
# - April 17, 2024 Limit versions of cclib at advice of maintainers.
2020
# - August 4, 2024 Restricted pyrms to <2
21+
# - May 14, 2024 Removed diffeqpy by switching to call SciMLBase and Sundials using JuliaCall
22+
2123
name: rmg_env
2224
channels:
2325
- rmg
@@ -51,8 +53,8 @@ dependencies:
5153
- conda-forge::rdkit >=2022.09.1
5254

5355
# general-purpose external software tools
54-
- conda-forge::julia=1.9.1
55-
- conda-forge::pyjulia >=0.6
56+
- conda-forge::juliaup
57+
- conda-forge::pyjuliacall # for calling julia packages
5658

5759
# Python tools
5860
- python >=3.7
@@ -90,18 +92,8 @@ dependencies:
9092
# packages we maintain
9193
- rmg::pydas >=1.0.3
9294
- rmg::pydqed >=1.0.3
93-
- rmg::pyrms <2
9495
- rmg::symmetry
9596

96-
# packages we would like to stop maintaining (and why)
97-
- rmg::diffeqpy
98-
# we should use the official verison https://github.com/SciML/diffeqpy),
99-
# rather than ours (which is only made so that we can get it from conda)
100-
# It is only on pip, so we will need to do something like:
101-
# https://stackoverflow.com/a/35245610
102-
# Note that _some other_ dep. in this list requires diffeqpy in its recipe
103-
# which will cause it to be downloaded from the rmg conda channel
104-
10597
# configure packages to use OpenBLAS instead of Intel MKL
10698
- blas=*=openblas
10799

File renamed without changes.

0 commit comments

Comments
 (0)