Forum Discussion

FICO's avatar
FICO
Community Manager
10 years ago

Parallel processing in Xpress

Hi everyone!

I am trying to run submodels in parallel in xpress and I am experiencing a few issues.

1 - Can I define a constant value of a submodel with a command line: for instance: run(myMod,t=2)?

-------------------

2 - I am trying to share memory from a subproblem "s" as follows:

initializations to "bin:shmem:output" + s

     output

end-initializations.

But when I try to read this memory from my master problem as

initializations from "bin:shmem:output" + s

     output

end-initializations.

I get an error mesage: Mosel: E-22: I cannot open file `shmem:output1' for reading (file not found).

------------------------

3 - If I try to share results with txt files, it works for most of the time but from time to time I also get an error mesage E-22 for the text file. I know that this is probably an issue of more than one parallel procedure trying to assess the same file, but I though my code could handle this:

initializations to 'submodel_input.txt'

     t s

end-initilizations

forall s in submodelsSet do

     run(submodel)****

end-do

forall s in submodelsSet do

     wait

end-do

forall s in submodelsSet do

     initializations from 'submodel_output' + s + '.txt'

          output

     end-initializations

end-do

****Inside of each submodel I write the output as follows

     initializations to 'submodel_output' + s + '.txt'

          output

     end-initializations

------

Could someone please help me with these issues?

All the best

Arthur.

2 Replies

  • FICO's avatar
    FICO
    Community Manager

    1 - You can set runtime parameters for submodels directly with the "run" command of mmjobs:

      run(myMod, "t=2,mystring='some text'")

      or via "setmodpar":

      declarations

        params:text

      end-declarations

      setmodpar(params, "t", 2)

      setmodpar(params, "mystring", "some text")

      run(myMod, params)

    2/3 - Does your master model "wait" for submodel termination - or for some other event message sent by the submodel to signal that data are available for reading?

    Please take a look at the example FICO Xpress Examples Repository: Working with multiple models: submodels, coordination, communication, and parallelizati… (http://examples.xpress.fico.com/example.pl?id=mosel_solv_9_12)  documented in Section 2.7 "Communication of data between different models" of the whitepaper "Multiple models and parallel solving with Mosel" (contained in the "docs" subdirectory of the standard Xpress distribution) or section 17.2.3 "Exchanging data between models" of the Mosel User Guide ( FICO Xpress Examples Repository: Calculating prime numbers (http://examples.xpress.fico.com/example.pl?id=mosel_xprd_prime_0_m)).

  • FICO's avatar
    FICO
    Community Manager

    Thank you very much Susanne! I have managed to get it to work.