0

How to build windows executable file(.exe) through TOUGH3 code?

I tried to build an executable file by mingw32 on the UBUNTU platform, but I failed.  

10 replies

null
    • yqzhang
    • 4 yrs ago
    • Reported - view

    Hi Tianjiao,

    Did you follow the instruction provided at: https://tough.forumbee.com/t/369y7b/tough3-installation-on-pc-updates-install-ubuntu-terminal-and-then-install-tough3

    It seems there is a requirement for the GCC  version. Can you please try?

    Thanks

    Yingqi

      • Tianjiao_Li
      • 4 yrs ago
      • Reported - view

      Yingqi Zhang  Maybe I should use Cygwin instead of Ubuntu to build a (.exe) file for Windows. Do you have updated instructions for compiling with Cygwin? Thanks.

    • Tianjiao_Li
    • 4 yrs ago
    • Reported - view

    Thanks, Yingqi. I followed these instructions and got an executable file successfully which only works under Linux. However, I need an executable that works under windows. 

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Tianjiao Li Hi Tianjiao,

      You can call any program compiled on Windows Subsystem for Linux from a Windows command prompt. For instance, to call tough3-eos1, simply run:

      bash -c "~/tough3-build/esd-tough3/tough3-install/bin/tough3-eos1"

      Basically, you can create a batch script that calls this command in order to run TOUGH3 compiled in WSL directly in Windows. Note that in this simple case, arguments are not passed to the command which is overly complicated to script in Batch (which means that the input file must be named INFILE and the output file will be named OUTPUT).

      Alternatively, I've attached an archive that contains two scripts. One Python script that parses different arguments (input file, output file, number of processes for MPI) and pass them to TOUGH3 compiled in WSL, and a second Batch script that calls the Python script.

      Either put these two scripts in your working directory or (better) put them in a directory saved in your PATH so that you can call the command "tough3" anywhere in Windows.

      To call TOUGH3 in Windows, simply run (for instance for EOS1):

      tough3 eos1

      Additional optional arguments are:

      -i INFILE
      -o OUTPUT
      -n number of MPI processes
      
      • Tianjiao_Li
      • 4 yrs ago
      • Reported - view

      Keurfon Luu Thanks, Keurfon. I learned a lot from your message. It works in my system.

    • yqzhang
    • 4 yrs ago
    • Reported - view

    Tianjiao,

    Cygwin does now work well. Do you have intel fortran? If not I can help you. Can you send me an email? Yingqi

    • yqzhang
    • 4 yrs ago
    • Reported - view

    Hi Tianjiao,

    If you have intel fortran and MS studio, please follow the steps to make executables:

    1. Create a new project

    2. Add files to the project. Typically files need to be included are :csv_file.f90, Data_DD.f90, eos**.f90, Finalout.f90, Input_Output.f90, Main_Comp.f90, Mesh_Maker.f90, MULTI.f90, Multi_Compo.f90, parallel_stubs.f90, radheat.f90, solver_core.f90, t2_solver_core.f90, t2solv.f90, thrm.f90, TOUGH3.f90, Utility.f90

    If it is eco2n and eco2m, you need to add two more files: thrmb.f90 and thrmc.f90

    If it is eco2n_v2, you need to add three more files: thrmb.f90, thrmc.f90, and thrmc_v2.f90.

    Most of the files are located under: TOUGH3-Code\esd-tough3\src

    But some solver related files are at: TOUGH3-Code\esd-toughlib\src\t2_solver_interface,

    and TOUGH3-Code\esd-toughlib\src

    3. Click "project" on the top manu bar, select "Configuration properties", --> Fortran -->preprocessor, change preprocessor source file to Yes(/fpp);

    "Configuration properties", --> Fortran -->Libraries: select "Multithreaded" for "runtime library", and "Sequential(/Qmklsequential" for "Use Intel Math Kernel library"

    4. Click on "build project".

    Then you are done. Good luck.

    Yingqi

      • Tianjiao_Li
      • 4 yrs ago
      • Reported - view

      Yingqi Zhang Thanks, Yingqi. I compiled tough_eos1.exe successfully based on your instructions.

      • diwu
      • 4 yrs ago
      • Reported - view

      Hi @Tianjiao Li, I want to ask, how did you compile tough3 successfully? I try to compile with visual studio, It then prompts for an error, “fatal error lnk1120”.Thank you very much for your help.

      • Tianjiao_Li
      • 4 yrs ago
      • Reported - view

      Di Wu You can try to change the following settings before "build project".

      1. Delet lines :"#ifdef TF_EOS3",and "#endif" in eosX.f90

      2. Fortran-Optimization-Heap Arrays-0

      Good luck.

Content aside

  • 4 yrs agoLast active
  • 10Replies
  • 277Views
  • 4 Following