This topic contains 3 replies, has 3 voices, and was last updated by Dimitri Kouom Dimitri Kouom 2 weeks, 1 day ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6157
    James Bowen
    James Bowen
    Participant

    I would like to run EFDCplus from within a Matlab script. I have an existing Matlab script that does automated calibration based upon many runs of EFDC. Is it possible to run EFDCplus from within a windows command line? I can do it w/ the single threaded version of the code that I’ve compiled and run on my Mac, I but haven’t gotten it working on the PC. I’ve experimented w/ copying the .exe and some .dll files to the folder w/ the .inp files. There seems to be a license file missing. Can you advise if I can do this, and if so, how?
    Thanks,
    Jim Bowen

    #6158
    Tom Mathis
    Tom Mathis
    Moderator

    Hi Jim,

    You can definitely do that by having your MATLAB script run a simple batch file using the Windows command line. A few things:
    – The EFDC+ executable does not need to be in the same folder as the model input files, just leave it in the directory it was installed to. This will ensure that your license works.
    – You can run an EFDC+ model from the folder with the model input files by creating a batch file which calls the EFDC+ in it’s installed location.
    – When the model starts running, an empty file called 0run will be created in the same folder as the model input files. This file will be deleted if the user ends the run, or if the run is completed. However, if the model crashes due to an error then the 0run file will not be deleted.

    An example of the batch file for EFDC+, which would reside in the same folder (the file created by EFDC_Explorer is always called 0run_efdc.bat):
    SET KMP_AFFINITY=granularity=fine,compact,1,0

    TITLE D:\Projects\Portland Harbor RM 4-7 Group\temp\Hyd_00
    D:
    CD “D:\Projects\Portland Harbor RM 4-7 Group\temp\Hyd_00”
    “C:\EEMS\x64\EFDCPlus_100_OMP_190802_SPx64.exe” -NT2

    The first line sets the KMP offset, which helps you run multiple models efficiently on the same processor. More info here: https://eemodelingsystem.atlassian.net/wiki/spaces/EEREF/pages/2387021/KMP+Offset

    The next line is the title of the run, this is the folder with the model input files.

    The next 2 lines tell the command line to change the current directory to the folder with the model input files.

    The last line calls the EFDC+ executable (make sure this matches the original install path, so that your license will work), and sets the number of threads for the run. In the example I gave above, the run would have used 2 processor cores for the simulation.

    Hope that helps. Let me know if you have any more questions.

    Tom Mathis

    #6159
    James Bowen
    James Bowen
    Participant

    Thanks Tom for the quick response. Duh, it should have occurred to me to try running the batch file instead of the .exe file. I have seen those files in the folders. I opened a command window to test running one of those batch files. It worked fine. I think I should be good to go. Thanks for the info on the batch file. I will be creating them inside the matlab script so it’s good to know what each lines does. I will let you know when I’ve got the whole thing working.
    Thanks,
    Jim

    #6175
    Dimitri Kouom
    Dimitri Kouom
    Participant

    Hi James,
    Please can you share your Matlab script for the automatic calibration ? Actually, with my colleagues we are planning to investigate this interesting path. So we are kindly interested to work in collaboration with you in order to make it possible.
    We appreciated !

    Thanks

    Regards

    Ralph

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.