-
Notifications
You must be signed in to change notification settings - Fork 7
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
SEMLA does not allow parallel loading of a library #9
Comments
What do you mean by parallel loading, and are you sure that is the right cure? If you have an issue, it woudl be nice to have a description of the environment: what tool did the loading, etc. We have not seen issues with slow library loading. |
We have the problem that it takes a very long time to load our encrypted library in OpenModelica Connection Editor, up to one minute. As far as I understand it, it is not possible to split the loading of a library so that parts of the library can be loaded in parallel. Maybe @adeas31 can describe the problem better. |
As far as I can tell, this supposes that parallel loading would be a solution to the experienced slowness. We don't use any parallelism, and loading of encrypted libraries is very fast. I suggest to investigate the true reason for the slow loading, instead of starting with a supposed solution of parallelisation. |
@adeas31, please get back with details of I will close this with somehting like "unable to replicate" |
I will take a look at it and will get back with details. |
Decrypting several .moc files at the same time in parallel would speed up the library loading quite a lot for large libraries (with a lot of files). Currently it seems that calling the lve tool can only be done on one thread in serial.
I guess this happens because of how you are using pipes with stdin/stdout. I will check later. Well, ideally would be to start the lve tool ONCE like a server and be able to connect to it several times from different threads and decrypt files in parallel. |
@axelmartenssonmodelon, what is your take on this? |
@hubertus65 We spawn several processes using the same LVE executable in parallel. |
@axelmartenssonmodelon that doesn't sound optimal. This means you are doing the handshake several times. Ideally there should be only one LVE executable running and the functions like |
@adeas31 I can see what you mean, this solution would indeed give a limited improvement in performance. However, it would also require the addition of multiplexing in the LVE protocol and a more complex implementation. We prefer to wait with this kind of feature. |
BTW, I tried spawning several processes of LVE executable in parallel but that doesn't work for us. For each LVE process we do,
I don't understand how running several processes of LVE are suppose to work. According to SEMLA specification here https://github.com/modelica/Encryption-and-Licensing/blob/master/doc/SEMLA.md#semla---communication-protocol-between-a-tool-and-lve some actions are only performed once. |
https://github.com/modelica/Encryption-and-Licensing/blob/33879fd5d5b71dab174e4d0d3fe35b45923b8de5/src/tests/test_tool.c is a test case that implements the call sequence you mentioned. This testcase still passes when run in parallel. It can be run in parallel using the following script: #!/bin/bash
# Run 5 'test_tool' processes in parallel, wait for them to finish, and check that their exit statuses are zero
run_test_tool_command() {
./test_tool --lve lve_linux64 --feature test_licensed_feature --no-feature test_not_licensed_feature
}
wait_and_exit_if_nonzero() {
local PROCESS=$1
wait ${PROCESS}
local EXIT_STATUS=$?
if [ ${EXIT_STATUS} -ne 0 ] ; then
echo "$(basename $0): error: process exited with nonzero exit status: process: ${PROCESS}"
exit ${EXIT_STATUS}
fi
}
run_test_tool_command & PROCESS_1=$!
run_test_tool_command & PROCESS_2=$!
run_test_tool_command & PROCESS_3=$!
run_test_tool_command & PROCESS_4=$!
run_test_tool_command & PROCESS_5=$!
wait_and_exit_if_nonzero ${PROCESS_1}
wait_and_exit_if_nonzero ${PROCESS_2}
wait_and_exit_if_nonzero ${PROCESS_3}
wait_and_exit_if_nonzero ${PROCESS_4}
wait_and_exit_if_nonzero ${PROCESS_5}
When I save this script as
|
Of course this works as you only have several processes, each with its own SSL instance, but do it in parallel on threads from test_tool.c. |
How this is suppose to speed up the library loading? You are doing the same thing again and again. What we want to do is that run LVE process once for a library and do these actions as defined in the SEMLA specification, And then decrypt its files in parallel, This section above |
@adeas31 If I understand the problem with using only one LVE, it's that the protocol against one LVE is blocking, so you can't ask for the next file until you have received the previous file. If we spawn several instances of the same LVE and use them as workers in a process pool, then we can ask each worker for a different file in parallel. |
@axelmartenssonmodelon we will try that. As I understand, when we start several instances of LVE then each of them should go through the |
@adeas31 Yes, that is correct |
As a result, it can take a very long time until a library is loaded
The text was updated successfully, but these errors were encountered: