Skip to content

Commit 85a6207

Browse files
committed
Print statements about using the Julia system image.
I wanted to use logging, but this is imported before the logging module is imported and set up. Strangely, using the system image I made like this in julia: using PackageCompiler using ReactionMechanismSimulator create_sysimage(["ReactionMechanismSimulator"]; sysimage_path="rms.so") my time to launch is no faster than not having it. Here are a couple of runs of python-jl rmg.py test/regression/superminimal/input.py 289.01s user 20.75s system 109% cpu 4:43.95 total 305.97s user 22.11s system 106% cpu 5:09.14 total compared to without the special system image: 291.06s user 22.26s system 107% cpu 4:52.13 total in both cases, actually running RMG was about 1 minute.
1 parent 841543e commit 85a6207

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

rmgpy/rmg/reactors.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,22 @@
4343
system_image_path = os.path.join(os.path.dirname(get_path()), "rms.so")
4444
# Should be RMG-Py/rms.so for a normal install, alongside rmg.py
4545
if os.path.exists(system_image_path):
46-
logging.info(f"Using system Julia system image at {system_image_path}")
46+
print(f"Using system Julia system image at {system_image_path}")
4747
jl = Julia(sysimage=system_image_path)
48-
elif __debug__:
49-
# This is the normal case (__debug__ is True by default)
50-
jl = Julia(compiled_modules=False) # Disable incremental precompilation of modules.
5148
else:
52-
# This means that python was run with the -O flag.
53-
# I don't know why or how often that is done
54-
# (all it does usually is remove assert statements),
55-
# nor why one would then need or wish to skip creating a Julia runtime,
56-
# but for now I'm trying to refactor without changing behaviour.
57-
pass
49+
print(f"Couldn't find Julia system image at {system_image_path}. "
50+
"Using default Julia system image.")
51+
if __debug__:
52+
# This is the normal case (__debug__ is True by default)
53+
jl = Julia(compiled_modules=False) # Disable incremental precompilation of modules.
54+
else:
55+
# This means that python was run with the -O flag.
56+
# I don't know why or how often that is done
57+
# (all it does usually is remove assert statements),
58+
# nor why one would then need or wish to skip creating a Julia runtime,
59+
# and allow incremental precompilation to be its default,
60+
# but for now I'm trying to refactor without changing behaviour.
61+
pass
5862
from pyrms import rms
5963
from diffeqpy import de
6064
from julia import Main

0 commit comments

Comments
 (0)