Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows Complie Issue
There may be some issues with compiling MYSTRAN in Windows. While it appears to be resolvable, can we make this either (a) more bullet-proof or (b) provide some instructions in the trouble shooting section of the build MD here:

From the Fortran forum, there is this thread, and the following notable comments:

  • As suggested I tried building via MSYS2 (or rather MinGW-w64). That failed because despite a message that CMake 3.23 would be installed, I am stuck with CMake 3.17.
  • Instead, I switched to Cygwin, which does have an up-to-date version on my machine.
  • The configuration step started, but then I got a complaint that submodules had not been downloaded. No indication of what submodules are to be downloaded. There is no indication in the file either.
  • A quick check of the MakeLists.txt file showed a few packages are needed, but there is no information that I can see about where to get the various packages.
  • I was also surprised to see f2c - is that really necessary?
  • The information in suggests though the script will do it. Is that outdated information?

Side note: I find a fairly recent version of CMake in the installation but it does not do much (no output, stops immediately - missing DLLs?). In the MinGW-w64 console a different version is invoked that actually works.
The initial response is to use a modern version of msys2 and install the correct version of cmake. This will be added to the trouble shoot section of the BUILD.MD file here:

Also.."I got same or similar message when compiling v14.01 on macOS. I had to copy superlu on the mystran directory since the zip from github doesn't include it. After that everything went as expected."
Just the alternative for gcc gfortran, that doesn't came with msys and pacman.

i use the batch file to create mystran.exe from gcc.exe gfortran.exe
1. copy all mystran on c:\mystran for example : latest on 14.01 with folder mystran-main
2. create first folder opeblas in mystran-main.
copy openblas x64 binary for faster blas lapack solver into folder openblas in mystran-main,
all in dll dll.a and .h header
3. copy superlu src folder to superlu\gcc_src folder with c_fortran_dgssv.c in fortran folder into same folder gcc_src.
(rename default src from zipper to gcc_src)
4. create output folder in mystran-main
4. download batch file gcc_fortran4.rsp gcc_fortran4.bat
copy 2 files into c:\mystran folder
set path=%path%;c:\gcc\bin or whatever folder gcc installed.
go to folder c:\mystran via cmd.exe
run gcc_Fortran4.bat
5. the mystran.exe is on output folder
6. to run it will need openblas.dll in step2, superlu.dll.a that compiled in step 3.
Thanks, what did you use to generate the files in Step 4? If the source code changes, how does one update all the steps? In other words, what steps stay the same and what has to change with the source code?
(11-17-2022, 09:50 PM)Admin Wrote: Thanks, what did you use to generate the files in Step 4? If the source code changes, how does one update all the steps? In other words, what steps stay the same and what has to change with the source code?

It was generated copy from VS build log. then converted to use gcc. So we can experimenting faster.
Yes it is only support 14.01 only. Any changes like from 13 not worked because the several files is different folder now than older mystran source.
Minus: Any new files need to be added manually. 

For all update mystran later...
UPDATE: For using CMAKE using GCC


1. Download GCC from - x64  Fortran, Fortran, C, C++ for Windows (
    install at c:\gcc 

2. Download CMAKE latest binary windows - x64 Download | CMake  zipped file    
    - Extract bin cmake.exe etc. at c:\gcc\bin
    - Extract share folder at c:\gcc\share
    - Extract man folder at C:\gcc\share\man
3. Create vars.bat in gcc folder that contain
  4. Extract mystran in any folder.
  5. Extract superlu in superlu mystran sub folder
  6. Go to command cmd.exe and run vars.bat
  Go to top root mystran folder that contain Cmakelist.txt and
  run in command file

  7A. If using CBLAS Superlu and LAPACK in Mystran
cmake -G"MinGW Makefiles"  -D"CMAKE_MAKE_PROGRAM=make.exe" -D"CMAKE_FORTRAN_COMPILER=gfortran.exe" -D"CMAKE_C_COMPILER=gcc.exe" -D"CMAKE_CXX_COMPILER=g++.exe"
make -j16 (or how many threads you have)
   7B. If Using OpenBlas binary
   8B. Extract Openblas in c:\gcc\openblas ; all files not in different folder, make it same folder libopenblas.dll and its .h files also others in the same folder
   9B. the Cmake files  OpenBLASConfig.cmake and OpenBLASConfigVersion.cmake in the zipped Openblas putted in same folder c:\gcc\openblas
    and  folder cmake share like c:\gcc\share\cmake in the C:\gcc\share\cmake-3.25\Modules
   10B. Get modified BLAS Cmake Cmakelists.txt  that reside in mystran folder or mystran-main folder Cmakelists.txt -
     this modified Cmakelists.txt also compatible be used for Intel Fortran etc. The original cmake list grab internal Lapack files so it need to be replaced if you re going to use pre built BLAS VENDOR like ATLAS, OpenBLAS. etc  

   11B. Go to top root mystran folder that contain Cmakelist.txt and and run in command file

cmake -G "MinGW Makefiles" -D"CMAKE_MAKE_PROGRAM:PATH=c:\gcc\bin\make.exe" -D"CMAKE_Fortran_COMPILER:PATH=c:\gcc\bin\gfortran.exe"  -D"TPL_BLAS_LIBRARIES:PATH=c:\gcc\openblas\libopenblas.DLL.a"  -D"BLAS_LIBRARIES:PATH=c:\gcc\openblas\libopenblas.DLL.a" -D"XSDK_ENABLE_Fortran=TRUE" -D"CMAKE_BUILD_TYPE=RELEASE" -DBLA_VENDOR=OpenBLAS -DUSE_XSDK_DEFAULTS=TRUE -DBUILD_SHARED_LIBS=FALSE

make -j16 (or whatever many threads you have)


  C For Command Line using CMAKE using Intel Fortran and existing BLAS 
    1. Extract mystran and superlu. superlu must reside in superlu folder
    2. Please edit  GET_MYSTRAN_DIR.F90
      !      GETENV not compatible 
      !      INTRINSIC                                    :: GETENV

      CALL GET_ENVironment_variable ( 'MYSTRAN_directory', MYSTRAN_DIR )
      3. Goto \SuperLU\TESTING folder, Delete all files and MATGEN folder also
       Put empty text file CMAKELISTS.TXT, this testing is just for testing and not used.
      4. Goto \SRC and \CBLAS
         Edit SLU_Cnames.h to call c obj as UPPERCASE call, not lowercase_ as default in C [ONLY FOR INTEL FORTRAN]
/* Fortran interface */
#define c_bridge_dgssv_ C_BRIDGE_DGSSV
#define c_fortran_sgssv_ C_FORTRAN_SGSSV
#define c_fortran_dgssv_ C_FORTRAN_DGSSV
#define c_fortran_cgssv_ C_FORTRAN_CGSSV
#define c_fortran_zgssv_ C_FORTRAN_ZGSSV

       5. Get modified CMakelists.txt in the root of mystran folder  Cmakelists.txt -
       6. Download jom, put it in mystran folder, or any path folder, for faster compiling than nmake
       7A. Using Intel64 environment command line cmd.exe . O C:\Program Files (x86)\Intel\oneAPI\setvars,bat
jom /j16 (or whatever threads you have)
       7B. If using nmake or building

       7C. For using Visual Studio Interface

cmake  -D"CMAKE_FORTRAN_COMPILER=ifort.exe" -D"CMAKE_C_COMPILER=icl.exe" -D"CMAKE_CXX_COMPILER=icl.exe" -G"Visual Studio 17 2022"

    7D For Command Line using CMAKE using Intel Fortran and Intel MKL,  

jom /j16   

   7E. For Command Line using CMAKE using Intel Fortran and OpenBLAS

cmake  -D"CMAKE_FORTRAN_COMPILER=ifort.exe" -D"CMAKE_C_COMPILER=icl.exe" -D"CMAKE_CXX_COMPILER=icl.exe" -G"NMake Makefiles JOM"  -Denable_internal_blaslib=FALSE -DBLA_VENDOR=Openblas -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE -DXSDK_ENABLE_Fortran=TRUE -D"TPL_BLAS_LIBRARIES=c:\gcc\openblas\libopenblas.dll.a" -D"BLAS_LIBRARIES=c:\gcc\openblas\libopenblas.dll.a" -USE_XSDK_DEFAULTS=TRUE
jom /j16
a. use     -G"Nmake Makefiles"  for nmake OR      -G"Nmake Makefiles JOM" for jom OR    -G"Visual Studio 17 2022" for using Visual Studio Interface
b. f2c may be needed for MinGW, sometimes MSYS not compatible with it
c. In Release setup of Intel Fortran compile from CMAKE, the /DNDEBUG made NDEBUG variable became 1, and there is error, so it need to be removed from CMAKE.
d. The Ninja way not compatible with MinGW, and has some problems linking using Intel Compiler


Forum Jump:

Users browsing this thread: 1 Guest(s)