Native compile of MRCC on Windows

  • shoubhikrajmaiti
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #1095 by shoubhikrajmaiti
Native compile of MRCC on Windows was created by shoubhikrajmaiti
I was interested to see if MRCC could be compiled natively on Windows because the installation page said that native compile on windows has not been tried yet. WSL is slow and cygwin refuses to compile MRCC, so running it on windows properly is almost impossible.

I have managed to compile it completely natively on Windows, so I thought I should share it here.

Compiler: Intel Fortran and Intel C compilers and Intel MKL (all of which are available in the oneAPI base and HPC toolkit, which Intel has made freely available recently)

File modifications:
  1. The file paths on windows use the backslash separator '\' while on linux it is frontslash '/'. There were a few lines in the source code that had to be changed for this.
  2. Another problem is the C-Fortran interface. On Linux, the Fortran compiler exports all symbols in lowercase with a trailing underscore (so subroutine xyz becomes "xyz_") while in windows, the symbols are all uppercase without any underscore (so xyz becomes "XYZ"). This means in all the C sources the names of the exported functions has to be made uppercase and the trailing underscore has to be removed. All the C sources except xalloc.c work when this scheme is used. (Maybe this is because in xalloc.c the interface is defined with FC_FUNC macro). So, instead of xalloc.c, xalloc.f90 has to be used (which is already provided in the source archive).
  3. There are multiple shell command calls (like cp, mv etc) which would not work on Windows. It is possible to change each individual command to a native windows command like copy, move. However, that would require a lot of change in the source code (~400 shell commands). So, I have only changed crucial commands like "echo" and "which". Other commands - cp, mv, diff, rm, sed, grep, wc and cat have been left as it is. This means these commands have to be present in the Windows command prompt when running the program. Fortunately there are lots of packages like Git-for-Windows or GNUwin32 which provide native executables (cp.exe, diff.exe) which work on windows and do the same job as the linux commands. Only these 8 command executables have to be in PATH (more detail in the compile script).
  4. I have tried to make the changes minimal, and I have guarded all the changes with #ifdef WINTEL. On windows, use the flag -DWINTEL when compiling. If the flag is not used, the original source code is compiled as usual.
The fortran source files that I had to modify are: combin.f, compmod.f, dmrcc.f, hessgrad.f, integ.f, mrcc.f, optim.f90, scf.f, geomopt.f and ovirt.f. All the C source files had to be modified (except xalloc.c, which isn't used for Windows compilation anyways). All the modified source files are attached (in zip archives).

I have tested the build with the first 6 test files in the MTEST folder, and all of them have run successfully. Also, I have only tested the OpenMP parallel version, I have not attempted to compile with MPI, so that may or may not work. The dftd3 interface also does not work at the moment (some more changes need to be made in that part of the code).

I have also written a powershell script that will compile and link the executables on windows (as the original compile script is a shell script). The first part of the script also contains a some extra information about compiling and running (right click, open with.. notepad, as double clicking will only run the script). For the compile script to work, the ifort and icl have to be on path. So, please make sure to use the setvars.bat or psxevars.bat script depending on which version of Intel compilers you are using.

Please Log in or Create an account to join the conversation.

  • shoubhikrajmaiti
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #1096 by shoubhikrajmaiti
Replied by shoubhikrajmaiti on topic Native compile of MRCC on Windows
The powershell script (compile.ps1) is attached with this message. (changed the extension to .txt as I cannot seem to be able to attach .ps1 files).
Attachments:

Please Log in or Create an account to join the conversation.

  • shoubhikrajmaiti
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #1102 by shoubhikrajmaiti
Replied by shoubhikrajmaiti on topic Native compile of MRCC on Windows
The previous compile script had some errors in it. The new compile script can be accessed here (at github.com/ShoubhikRaj/molecular-modelli.../MRCC-compile-script ). I will keep updating the script if there are any changes, or any issues are pointed out. Note that the script was written originally for the 2020 february version of MRCC.

Please Log in or Create an account to join the conversation.

  • shoubhikrajmaiti
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #1103 by shoubhikrajmaiti
Replied by shoubhikrajmaiti on topic Native compile of MRCC on Windows
A question for the developers, would you be willing to host Windows compiled binaries in the MRCC binary page? I can provide compiled binaries.

Please Log in or Create an account to join the conversation.

Time to create page: 0.042 seconds
Powered by Kunena Forum