Skip to content

Commit

Permalink
Merge pull request firemodels#13674 from gforney/master
Browse files Browse the repository at this point in the history
updates to windows hypre and sundials build scripts to make them more consistent with linux/mac versions
  • Loading branch information
gforney authored Nov 1, 2024
2 parents 08a9b1b + 6f5962d commit a8fce54
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 124 deletions.
134 changes: 70 additions & 64 deletions Build/Scripts/HYPRE/build_hypre.bat
Original file line number Diff line number Diff line change
@@ -1,71 +1,95 @@
@echo off
set HYPREVERSION=2.31.0
set HYPRETAG=v2.31.0
set LIB_TAG=v2.32.0

::*** library and tag name are the same

set LIB_DIR=%LIB_TAG%


::*** placehoder for parsing options

call :getopts %*
if %stopscript% == 1 exit /b

set have_setx=1
call :have_program setx || set have_setx=0
::*** make sure cmake and gcc are installed

set abort=0
set buildstatus=
call :is_file_installed cmake || set abort=1
call :is_file_installed gcc || set abort=1
if %abort% == 1 exit /b

set CURDIR=%CD%

::*** define root directory where fds repo and libs directories are located

set FIREMODELS=..\..\..\..
cd %FIREMODELS%
set FIREMODELS=%CD%
cd %CURDIR%

set LIBS=%FIREMODELS%\libs
if not exist %LIBS% mkdir %LIBS%
if not exist %LIBS% echo failed to create %LIBS% directory
if not exist %LIBS% exit
::*** if hypre library directory exists exit and use it

set INSTALLDIR=%FIREMODELS%\libs\hypre\%LIB_DIR%
if not exist %INSTALLDIR% goto endif1
set HYPRE_HOME=%INSTALLDIR%
set buildstatus=prebuilt
goto eof
:endif1

::*** if directory pointed to by HYPRE_HOME exists exit and use it

if "x%HYPRE_HOME%" == "x" goto endif2
if not exist %HYPRE_HOME% goto endif2
set buildstatus=prebuilt
goto eof
:endif2

::*** if hypre repo does not exist exit and build fds without it

set LIB_REPO=%FIREMODELS%\hypre
if exist %LIB_REPO% goto endif3
set HYPRE_HOME=
set buildstatus=norepo
goto eof
:endif3

cd %LIBS%
set LIBS=%CD%
if not exist %LIBS%\hypre mkdir %LIBS%\hypre
if not exist %LIBS%\hypre echo failed to create %LIBS%\hypre directory
if not exist %LIBS%\hypre exit
::*** if we've gotten this far the prebuilt libraries do not exist, the repo does exist so build the hypre library

set INSTALLDIR=%LIBS%\hypre\%HYPREVERSION%
cd %CURDIR%

echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo setting up Intel compilers
echo building Hypre library version %LIB_TAG%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat

cd %CURDIR%

set HYPRE=%FIREMODELS%\hypre

:: clone hypre repo (at same level as fds, smv etc repos) if it doesn't exist
if exist %HYPRE% goto endif1
set buildstatus=build
echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo cloning hypre from https://github.com/LLNL/hypre.git
echo setting up Intel compilers
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat

cd %CURDIR%

cd %FIREMODELS%
git clone https://github.com/hypre-space/hypre.git
cd hypre
echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo checking out tag %HYPRETAG%
echo checking out tag %LIB_TAG%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
git checkout %HYPRETAG%
cd %LIB_REPO%
git checkout %LIB_REPO%\src\config\HYPRE_config.h.cmake.in
git checkout %LIB_TAG%

echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo modify HYPRE_config.h.cmake.in file
Expand All @@ -74,73 +98,52 @@ echo ----------------------------------------------------------
echo.
echo change HYPRE_FMANGLE line to #define HYPRE_FMANGLE 4
echo after saving file, press enter
notepad %HYPRE%\src\config\HYPRE_config.h.cmake.in
notepad %LIB_REPO%\src\config\HYPRE_config.h.cmake.in

pause
cd %CURDIR%
:endif1
pause
cd %CURDIR%

echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo cleaning hypre repo
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.

cd %HYPRE%
set HYPRE=%CD%
cd %LIB_REPO%
git clean -dxf

:: configure hypre
echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo configuring hypre version %HYPRETAG%
echo configuring hypre version %LIB_TAG%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.

set BUILDDIR=%HYPRE%\src\cmbuild
set BUILDDIR=%LIB_REPO%\src\cmbuild
cd %BUILDDIR%
cmake ..\ ^
-G "MinGW Makefiles" ^
-DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" ^
-DCMAKE_C_COMPILER=icx ^
-DCMAKE_C_FLAGS="/DWIN32 -O3 /fp:precise" ^
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" ^
-DCMAKE_INSTALL_LIBDIR="lib"

:: build and install hypre
echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo building and installing hypre version %HYPRETAG%
echo building and installing hypre version %LIB_TAG%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
call make install

if %have_setx% == 0 goto else_setx
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo setting HYPRE_HOME environment variable to %INSTALLDIR%
setx HYPRE_HOME %INSTALLDIR%
echo note: the environment variable HYPRE_HOME takes effect after opening a new command shell
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
goto endif_setx
:else_setx
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo set environment variable HYPRE_HOME to %INSTALLDIR%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
:endif_setx

echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo hypre version %HYPRETAG% installed in %INSTALLDIR%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
set HYPRE_HOME=%INSTALLDIR%
echo Hypre library version %LIB_TAG% built in %INSTALLDIR%
echo.

cd %CURDIR%
Expand Down Expand Up @@ -210,4 +213,7 @@ echo.
echo -help - display this message
exit /b

:eof
:eof
echo.
if "%buildstatus%" == "norepo" echo HYPRE library not built, The hypre git repo does not exist
if "%buildstatus%" == "prebuilt" echo HYPRE library not built. It exists in %HYPRE_HOME%
Loading

0 comments on commit a8fce54

Please sign in to comment.