Skip to content

Commit

Permalink
No shared engines
Browse files Browse the repository at this point in the history
  • Loading branch information
mldiego committed Jul 8, 2024
1 parent 4624d48 commit 04eb158
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions code/nnv/examples/Submission/VNN_COMP2024/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def prepare_instance(category: str, onnx: str, vnnlib: str) -> None:
# keep MATLAB engine open until manually killed
# while True:
# time.sleep(0.5)
print("We should not be here...")
# print("This is the last line of the prepare instance")
# print("We should not be here...")
print("This is the last line of the prepare instance")

def run_instance(category, onnx, vnnlib, timeout, outputlocation) -> None:
"""Run an instance based on parameters defined in .csv file.
Expand All @@ -47,11 +47,11 @@ def run_instance(category, onnx, vnnlib, timeout, outputlocation) -> None:
"""

print("Begin run instance, try to connect to matlab engine")
#eng = matlab.engine.start_matlab()
eng = matlab.engine.start_matlab()
# eng_name = matlab.engine.find_matlab()[0]
print("Looking for connections")
# eng = matlab.engine.connect_matlab(name=eng_name)
eng = matlab.engine.connect_matlab('vnncomp')
# eng = matlab.engine.connect_matlab('vnncomp')

print("Is it connected?")
# print(f'Successfully connected to engine: {eng_name}.')
Expand Down
6 changes: 3 additions & 3 deletions code/nnv/examples/Submission/VNN_COMP2024/prepare_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ killall -q matlab
# python -c "exec('$WAIT_FOR_CONNECTION_TO_CLOSE')"

# start the matlab engine in background and keep the connection open
# python3 /home/ubuntu/toolkit/code/nnv/examples/Submission/VNN_COMP2024/execute.py 'prepare_instance' $CATEGORY $ONNX_FILE $VNNLIB_FILE &
python3 /home/ubuntu/toolkit/code/nnv/examples/Submission/VNN_COMP2024/execute.py 'prepare_instance' $CATEGORY $ONNX_FILE $VNNLIB_FILE &
# python execute.py 'prepare_instance' $CATEGORY $ONNX_FILE $VNNLIB_FILE &

# WAIT_FOR_CONNECTION_TO_OPEN='import matlab.engine\nimport time\nwhile not matlab.engine.find_matlab(): time.sleep(1) \nprint(eng)'
# python3 -c "exec('$WAIT_FOR_CONNECTION_TO_OPEN')"
# python -c "exec('$WAIT_FOR_CONNECTION_TO_OPEN')"

matlab -nodisplay -r "matlab.engine.shareEngine('vnncomp')"
# matlab -nodisplay -r "matlab.engine.shareEngine('vnncomp')"

echo "MATLAB session started and shared"
# echo "MATLAB session started and shared"

exit 0

0 comments on commit 04eb158

Please sign in to comment.