Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling GAMESS in Windows with Intel Compilers, with LibXC plugin #43

Open
shoubhikraj opened this issue Apr 8, 2021 · 12 comments
Open

Comments

@shoubhikraj
Copy link

shoubhikraj commented Apr 8, 2021

  • operating system : Windows 10

  • compiler : Intel oneAPI v2021 (at least MKL from base toolkit and C/C++ and Fortran compiler from HPC toolkit required). The Intel compilers also require an installation of visual studio. In my case, I used Visual Studio 2019, but earlier versions should also work.

  • math library : Intel MKL (supplied with oneAPI)

  • communication library : MS-MPI

I have already mentioned some fixes to get the default GAMESS build working on Windows with Intel compilers in #42 . This is a way of running the LibXC interface to GAMESS on windows.

For compiling LibXC:

  1. Install CMake for Windows. Then download the compressed archive for LibXC. The current GAMESS version as of now supports libxc v5.0.0, other versions will cause compilation failure. Decompress the archive in any location on the computer (for example, G:\libxc)
  2. Run the "setvars.bat" script file for Intel oneAPI compilers to get the command line for building. Then add the location of the CMake binary to the PATH. By default the cmake binary (cmake.exe) is in C:\Program Files\CMake\bin. So in the command line, run set PATH="C:\Program Files\CMake\bin\";%PATH%
  3. In the LibXc folder, open the "CMakeLists.txt" file, and edit around line 26. Change
option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON
  "-xHost" "-march=native")

to this:

option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON
  "-QxHost")
  1. Then in the command line change directory to G:\libxc (or wherever the libxc files are), and run the following commands:
set FC=ifort
set CC=icl
set CXX=icl
cmake -S. -B./build -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_FORTRAN=ON -DBUILD_TESTING=OFF -DBUILD_FPIC=ON -DCMAKE_BUILD_SHARED_LIBS=OFF
cd build
nmake

This will compile LibXC, and it will take some time. After compilation is finished, there should be "xc.lib", "xcf90.lib", and "xc_f90_lib_m.mod" in the build directory. Create a new directory gamess/libxc/ (where the gamess source files are) and then paste these files in the gamess/libxc folder.
5. When running ./config in GAMESS, choose Yes when the prompt about libxc comes up.
6. Then run compall and lked as usual. Some modifications need to be made in comp and lked scripts:
In lked (line 1221) change it to set LIBXC_FLAGS="C:/cygwin64$GMS_PATH/libxc/xcf90.lib C:/cygwin64$GMS_PATH/libxc/xc.lib"
This is so that the libxc libraries are linked with gamess.
In comp (line 2788) change it to set EXTRAOPT='-fpp -IC:\cygwin64\gamess\libxc'
This is so that the .mod file is accessible to the compiler when compiling the GAMESS libxc interface files.
7. The linking should run successfully to generate the gamess executable. However, the files "libifcoremd.dll" and "libmmd.dll" has to be in the same directory as the executable. These files are usually present in "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\redist\intel64_win\compiler".

After this the GAMESS-LibXC interface should hopefully run without any issue. I have only tested it with rdft-APF-gradient.inp and rdft-He-unnamed-gradient.inp test files.

Now that Intel compilers are free, this should make compiling easier on Windows systems.

The modified comp, and lked scripts are attached:
comp.txt
lked.txt

@foxtran
Copy link

foxtran commented Apr 8, 2021

Thank you for this instruction.

option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "-QxHost")

Please, provide this change to LibXC (https://gitlab.com/libxc/libxc) as an improvement for Win10 support, but do not remove other options.

What was the reason not to use ${GMS_PATH}/tools/libxc/download-libxc.csh?

One place, which should be changed, is adding -G"NMake Makefiles" to CMake command in Makefile.in, but I don't have Win10 to test it. Can you try it, please?

@saromleang
Copy link
Member

I can work on integrating these changes for your libxc repo and testing on Windows 10.

@foxtran
Copy link

foxtran commented Apr 8, 2021

@saromleang, I'll be glad for your help! If you fork the libxc-5.1.0 branch, it will be better than pushing to the libxc-5.1.0 branch directly. Later, I'll rebase your changes.

@shoubhikraj
Copy link
Author

@FulgurIgor

I didn't use the download-libxc.csh script because the curl command does not work from cygwin on Windows for some reason.

@foxtran
Copy link

foxtran commented Apr 9, 2021

Ok. Which command for downloading is available on Windows?

@shoubhikraj
Copy link
Author

@FulgurIgor

Hi, I have managed to make the download-libxc.csh script work on Cygwin.

The argument --ssl-no-revoke just needs to be added to the curl command:

curl https://gitlab.com/libxc/libxc/-/archive/5.0.0/libxc-5.0.0.tar.gz -o ${GMS_PATH}/libxc/libxc-5.0.0.tar.gz --ssl-no-revoke

Turns out the curl command wasn't working due to some kind of certificate problem.

@foxtran
Copy link

foxtran commented Apr 9, 2021

The --ssl-no-revoke flag is available only on Windows :-|
Was it be the problem with your computer or is it a general problem with Windows?

@shoubhikraj
Copy link
Author

@FulgurIgor I am not sure if it's a problem with only my computer. I don't have access to other windows computers right now so I can't check.

The --insecure flag will disable all types of certificate checking all together, and it works on both Windows and Linux as far as I can tell. But it will greatly reduce security as well.

Would it be acceptable to make a separate script for windows, perhaps a native windows batch script?

@shoubhikraj
Copy link
Author

shoubhikraj commented Apr 10, 2021

Another solution might be to use:

source ../install.info

if ($GMS_TARGET == win64) then
  curl https://gitlab.com/libxc/libxc/-/archive/5.0.0/libxc-5.0.0.tar.gz -o ${GMS_PATH}/libxc/libxc-5.0.0.tar.gz --ssl-no-revoke
else
  curl https://gitlab.com/libxc/libxc/-/archive/5.0.0/libxc-5.0.0.tar.gz -o ${GMS_PATH}/libxc/libxc-5.0.0.tar.gz

@saromleang
Copy link
Member

@shoubhikraj, why do you add -QxHost, but not /QxHost? According to https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/code-generation-options/xhost-qxhost.html, /QxHost should be.

it depends where you are compiling. if you are compiling from windows command prompt you use '/'. if you are compiling within cygwin you can use either '-' or '/'.

cygwin provides access to csh/tcsh/bash however, there is no access for shells or any linux commands via the command prompt.

@shoubhikraj
Copy link
Author

I have tested both '-' and '/' for arguments, and Intel compilers accept both everywhere, even when compiling from windows command prompt i.e. -QxHost will work outside cygwin too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants