Problem about cvx_solver_settings(‘MSK_SPAR_REMOTE_OPTSERVER_HOST’, ‘http://host:port’)

149 views
Skip to first unread message

li xing

unread,
Nov 18, 2024, 11:56:56 PM11/18/24
to mosek

Dear experts,

Windows11, Matlab Version 2024b, CVX Version 2.2, Mosek Beta Version 11.0.0(with Personal Academic License)

I have read the introduction of OptServerLight in the following link. 4 Installation — MOSEK Optimization Server 10.2.8

My questions are as follows:
I start the ‘mskgenhostid.bat’ in the folder ‘E:\MosekBeta11.0.0\11.0\tools\platform\win64x86\bin’, and I get the ‘hostname’ from its output as follows:

Then, I start the ‘optserverlight.exe’ in the folder ‘E:\MosekBeta11.0.0\11.0\tools\platform\win64x86\bin’, and I get the ‘port’ from its output as follows:
image

Afterwards, I use the command ‘cvx_solver_settings(‘MSK_SPAR_REMOTE_OPTSERVER_HOST’, ‘http://DESKTOP-******:123456’)’ and the code can run correctly.

Using the command ‘MSK_SPAR_REMOTE_OPTSERVER_HOST’ to transfer local Mosek computation tasks to a remote computer for processing, how can I determine if the computation task has been successfully transferred? Additionally, is it possible to perform Mosek computations on both the local and several remote computers simultaneously?

Michal Adamaszek

unread,
Nov 19, 2024, 1:24:11 AM11/19/24
to mosek
In addition to what was said in the CVX forum I can also recommend this blogpost


in understanding how optserverlight works.

Michal

li xing

unread,
Nov 19, 2024, 1:54:20 AM11/19/24
to mosek

Many thanks for your answer.

However, some issues were encountered while using this command.

local computer:
Windows11 64bit, Matlab2024b, Mosek Beta Version 11.0.0(Personal Academic License)
Memory: 16GB

Server:
Windows10 64bit, Matlab2024a, Mosek Beta Version 11.0.0(Personal Academic License)
Memory: 16GB
Host name: DESKTOP-****
Port:123456(take 123456 as an example of port)

However, the following error message appears:
Mosek error: MSK_RES_ERR_SERVER_PROTOCOL (Unexpected message or data from solver server.)

Michal Adamaszek

unread,
Nov 19, 2024, 1:58:36 AM11/19/24
to mosek
I suggest using Mosek 10.2 in the client and the optservelight also from Mosek 10.2 on the server. There are still some corner cases of the Optserverlight in Mosek 11 beta that are being ironed out and we are aware of certain issues.

With that, if there still are problems, then please contact support with a reproducible simple example and the log file of optserverlight ran in debug mode (-debug command line flag).

Best,
Michal

li xing

unread,
Nov 19, 2024, 2:14:41 AM11/19/24
to mosek
Many thanks for your answer.

With Mosek Stable Version 10.2.6, the same problem occurs.

Michal Adamaszek

unread,
Nov 19, 2024, 2:18:49 AM11/19/24
to mosek
Please simplify your example as much as possible to the simplest reproducible case (remove parfor etc.) and send that, together with the full command-line invocation of optserverlight and its log file to our support.

Make sure you start optserverlight with large enough size and time limits to support the problems you want to solve. Start with small examples first.

Michal

li xing

unread,
Nov 19, 2024, 2:22:26 AM11/19/24
to mosek
I transfer the Mosek computing task to a remote server. After the remote server completes the solution, do I need to transfer the results to the local computer through some command?
In addition, the code can run correctly if I replace 'parfor' with 'for'.

Michal Adamaszek

unread,
Nov 19, 2024, 2:28:12 AM11/19/24
to mosek
In the client nothing changes, when the remote optimization ends your API will normally receive the solutions just as if the optimization happened locally. 

I strongly suggest you start with small toy examples without any loops to see how it works locally vs. remotely.

How you organize your code in Matlab is not relevant to Mosek.

Michal

li xing

unread,
Nov 19, 2024, 2:29:22 AM11/19/24
to mosek
Many thanks for your answer. How can I  start optserverlight with large enough size and time?

Michal Adamaszek

unread,
Nov 19, 2024, 2:30:20 AM11/19/24
to mosek
In order to configure the optserver use command line options


optserverlight.exe -h

will give you full help

li xing

unread,
Nov 19, 2024, 2:53:14 AM11/19/24
to mosek
Do you mean that I type the 'optserverlight.exe -h ' in the window when I start the 'optserverlight.exe '?
However, this window does not allow the input of this command.

Michal Adamaszek

unread,
Nov 19, 2024, 2:54:54 AM11/19/24
to mosek
It is a command-line tool, you can start it from a command line (terminal, shell) and then provide additional parameters.

If you just started it by clicking an icon in the file explorer, or something like that, then you deprive yourself of these options.

li xing

unread,
Nov 19, 2024, 3:06:36 AM11/19/24
to mosek
Many thanks for your answer.
I type 'optserverlight -h' in the window of command prompt and I see the output information.
How can I change the default size and time limits?

Michal Adamaszek

unread,
Nov 19, 2024, 4:40:38 AM11/19/24
to mosek
I don't know what output you got. You should see a listing of all command-line options. You can choose from all the options displayed by the help info.


For instance

optserverlight.exe -solver-timeout 1000 -max-tasks 10 -size-limit 100000000

will set the solver time to maximum of 1000 seconds per problem, maximum of 10 simultaneous solves and a size limit of 100MB per task.

li xing

unread,
Nov 19, 2024, 5:06:35 AM11/19/24
to mosek
I get the output as follows:
Usage of optserverlight:
  -certdir string
        Enable SSL, cert.pem and key.pem in this dir
  -debug
        Turn on debugging
  -hostname string
        Server host name
  -licfile string
        MOSEK license file
  -logfile string
        Server log file
  -max-task int
        Maximum number of tasks to store (default 2)
  -mosekpipe string
        mosekpipe binary (default "D:\\MosekVersion\\MosekStableVersion10.2.6\\10.2\\tools\\platform\\win64x86\\bin\\mosekpipe")
  -port int
        Port to listen to
  -size-limit int
        Maximum task file size in bytes to accept (default 16777216)
  -solconv string
        solconv binary (default "D:\\MosekVersion\\MosekStableVersion10.2.6\\10.2\\tools\\platform\\win64x86\\bin\\solconv")
  -solver-timeout float
        Default timeout in seconds for solving a job (default 5)
  -timeout float
        Default timeout in seconds for submitted and solved tasks until they are deleted (default 1)
  -tls-min-ver string
        Minimum TLS server version, currently 1.0, 1.1, 1.2 or 1.3 (default "1.2")
  -v    Turn up log verbosity


If I need to modify these settings, do I enter 'optserverlight -port 34567 -solver-timeout 10 -max-task 50 -size-limit 100000000' in the command prompt window and press Enter?

Michal Adamaszek

unread,
Nov 19, 2024, 5:19:34 AM11/19/24
to mosek
Well I suppose you want to use your own settings and maybe set a log file if you want to submit it with an issue report later but essentially yes. The command line usage, passing options etc. of optserverlight is not any different from any piece of software.

li xing

unread,
Nov 19, 2024, 6:11:25 AM11/19/24
to mosek

        Now, I have submitted the relevant questions and some screenshots during my operation process.

I have some problems about Mosek OptServerLight. I have read the instructions of Mosek OptServerLight in the link https://docs.mosek.com/latest/opt-server/install-and-run.html#optserverlight . I have tried the method you guided in the Mosek forum. https://groups.google.com/g/mosek/c/SxoiiuWf7Nk

 

I would like to try to use OptServerLight to transfer the Mosek optimization tasks from computer A to computer B. If the transfer is successful and the code runs correctly, I am considering to rent a high-performance computing server to complete the program calculations, which can prevent code theft.

I provide information related to computers and software:

local computer:

Windows11 64bit, Matlab2024b, Mosek Beta Version 11.0.0(Personal Academic License)

Memory: 16GB

Server(Another computer):

Windows10 64bit, Matlab2024a, Mosek Beta Version 11.0.0(Personal Academic License)

Memory: 16GB

Host name: DESKTOP-****

Port:123456(take 123456 as an example of port)

 

1. Start the ‘command window’ and type ‘optserverlight -h’, then I can see the following output:

8c4a131de51874735d40f8edc29d0332.png

 

2. According to your suggestion, I type ‘optserverlight.exe -solver-timeout 3600 -max-task 1000 -size-limit 1000000000’ in the command window and press ‘Enter’, then I see:

94c65b3d1a57afbf35deae75cef59e07.png

Does the situation shown in the picture indicate that I have successfully set my own settings?

In addition, is the setting of ‘-max-task’, ‘-size-limit’, ‘-solver-timeout’, etc, based on the local computer or the remote computer? Does the size of the setting depend on the device hardware?

Michal Adamaszek

unread,
Nov 19, 2024, 6:43:40 AM11/19/24
to mosek
You are in the best position to check if it works by running some smaller and then bigger examples. It seems to look good from the screenshots.

According to the screenshots you are actually using Mosek 10.2 and not 11 as you mention, but that's good.

All the settings refer of course to the machine on which you run the optserver. Note that the optserver doesn't know anything about your local computer.

Yes, you should probably choose settings which make sense in comparison with the hardware you have, for instance not trying to solve 100 problems in parallel each with 64 threads etc. . As always, start small/slow with basic examples and then see how it scales. Some of the settings are adjustable with ordinary Mosek parameters, for example MSK_IPAR_NUM_THREADS

Best,
Michal

Message has been deleted
Message has been deleted
Message has been deleted

li xing

unread,
Nov 19, 2024, 7:10:49 AM11/19/24
to mosek
I greatly appreciate your thorough explanation. 

I installed Mosek Stable Version 10.2.6 and Mosek Beta Version 11.0.0. However, when I type ‘optserverlight -h’ in the ‘command window’, it only shows Mosek Stable Version 10.2.6.How can I change the settings of OptServerLight for Mosek Beta Version 11.0.0?

optserverlight.exe -solver-timeout 3600 -max-task 1000 -size-limit 1000000000 
-mosekpipe "D:\\MosekVersion\\MosekBetaVesion11.0.0\\11.0\\tools\\platform\\win64x86\\bin\\mosekpipe"  
-solconv "D:\\MosekVersion\\MosekBetaVesion11.0.0\\11.0\\tools\\platform\\win64x86\\bin\\solconv"

Can this change the settings of OptServerLight for Mosek Beta Version 11.0.0?

Michal Adamaszek

unread,
Nov 19, 2024, 7:12:41 AM11/19/24
to mosek
Do not rely on the ordering of paths in the environment variable %PATH%, just invoke the exact correct binary with the full path to the exe file (they are all in the bin folder of the Mosek installation)

D:\somepath\folder\....\optservelight.exe -max-time ... your options

As much as we'd like we may not have the resources to be helping with general issues not related to Mosek, like basic operating system usage. It is also not the topic of this forum, sorry. Especially for using the optserver a certain level of overall orientation in system/network issues may be useful.

I suggest not mixing the optserver binary from one version with the helper binaries from another version. Better to treat each one as a single package as compatibility is not guaranteed.

Michal
Message has been deleted

li xing

unread,
Nov 19, 2024, 7:38:32 AM11/19/24
to mosek
I have tried to type ‘D:\MosekVersion\MosekBetaVesion11.0.0\11.0\tools\platform\win64x86\bin\optserverlight.exe -solver-timeout 3600 -max-task 1000 -size-limit 1000000000’ in the command window and the code run correctly.
The method you suggested is more concise and effective than the one I just used.
(optserverlight.exe -solver-timeout 3600 -max-task 1000 -size-limit 1000000000
-mosekpipe "D:\\MosekVersion\\MosekBetaVesion11.0.0\\11.0\\tools\\platform\\win64x86\\bin\\mosekpipe"  
-solconv "D:\\MosekVersion\\MosekBetaVesion11.0.0\\11.0\\tools\\platform\\win64x86\\bin\\solconv")

Sorry for asking a question unrelated to Mosek. Mosek provided OptServerLight, which I thought was also a problem for Mosek, but I couldn't find detailed usage instructions in Mosek's introduction documents. Therefore, I consulted experts for instructions on how to use it.
Reply all
Reply to author
Forward
0 new messages