Skip to content

Commit 6e9300c

Browse files
authored
Merge pull request #13802 from cxp484/master
FDS Build: Change Build scripts to allow both ifx and ifort, and keep same fortran compiler for FDS and thirdparty.
2 parents e7bd3b4 + 1aa4e68 commit 6e9300c

File tree

17 files changed

+170
-193
lines changed

17 files changed

+170
-193
lines changed

.github/workflows/linux.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,15 @@ jobs:
4242
- name: build fds debug
4343
run: |
4444
source /opt/intel/oneapi/setvars.sh
45-
export INTEL_IFORT=ifx
4645
cd ./Build/impi_intel_linux_db
47-
sh ./make_fds.sh
46+
./make_fds.sh
4847
./fds_impi_intel_linux_db
4948
- name: build fds release
5049
run: |
5150
source /opt/intel/oneapi/setvars.sh
52-
export INTEL_IFORT=ifx
5351
cd ./Build/impi_intel_linux
54-
sh ./make_fds.sh
52+
./make_fds.sh
5553
./fds_impi_intel_linux
56-
5754
# Setup python
5855
- uses: actions/setup-python@v5
5956
with:
@@ -91,11 +88,11 @@ jobs:
9188
run: |
9289
source /opt/intel/oneapi/setvars.sh
9390
cd ./Build/ompi_gnu_linux_db
94-
sh ./make_fds.sh
91+
./make_fds.sh
9592
./fds_ompi_gnu_linux_db
9693
- name: build fds release
9794
run: |
9895
source /opt/intel/oneapi/setvars.sh
9996
cd ./Build/ompi_gnu_linux
100-
sh ./make_fds.sh
97+
./make_fds.sh
10198
./fds_ompi_gnu_linux

.github/workflows/windows.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ jobs:
7373
7474
- name: build fds debug
7575
run: |
76-
set INTEL_IFORT=ifx
7776
cd Build\impi_intel_win_db
7877
call make_fds.bat
7978
fds_impi_intel_win_db.exe
8079
- name: build fds release
8180
run: |
82-
set INTEL_IFORT=ifx
8381
cd Build\impi_intel_win
8482
call make_fds.bat
8583
fds_impi_intel_win.exe

Build/Scripts/HYPRE/build_hypre.bat

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,6 @@ echo ----------------------------------------------------------
7676
echo ----------------------------------------------------------
7777
echo.
7878

79-
set buildstatus=build
80-
echo.
81-
echo ----------------------------------------------------------
82-
echo ----------------------------------------------------------
83-
echo setting up Intel compilers
84-
echo ----------------------------------------------------------
85-
echo ----------------------------------------------------------
86-
echo.
87-
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat
88-
89-
cd %CURDIR%
90-
9179
echo.
9280
echo ----------------------------------------------------------
9381
echo ----------------------------------------------------------
@@ -130,27 +118,12 @@ echo ----------------------------------------------------------
130118
echo ----------------------------------------------------------
131119
echo.
132120

133-
::Check if make.bat or make.exe exists, and set CMAKE_MAKE_PROGRAM accordingly
134-
set CMAKE_MAKE_PROGRAM=
135-
for /f "delims=" %%i in ('where make.bat 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
136-
if not defined CMAKE_MAKE_PROGRAM (
137-
for /f "delims=" %%i in ('where make.exe 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
138-
)
139-
if not defined CMAKE_MAKE_PROGRAM (
140-
echo Error: Neither make.bat nor make.exe found in PATH.
141-
exit /b 1
142-
)
143-
144-
echo.
145-
echo make proram is %CMAKE_MAKE_PROGRAM%
146-
echo.
147-
148121
set BUILDDIR=%LIB_REPO%\src\cmbuild
149122
cd %BUILDDIR%
150123
cmake ..\ ^
151124
-G "MinGW Makefiles" ^
152125
-DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" ^
153-
-DCMAKE_C_COMPILER=%CC% ^
126+
-DCMAKE_C_COMPILER=%COMP_CC% ^
154127
-DCMAKE_C_FLAGS="/DWIN32 -O3 /fp:precise" ^
155128
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" ^
156129
-DCMAKE_MAKE_PROGRAM="%CMAKE_MAKE_PROGRAM%" ^

Build/Scripts/HYPRE/confmake.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010

1111
cmake_args=(
1212
-DCMAKE_INSTALL_PREFIX="$HYPRE_INSTALL_PREFIX"
13-
-DCMAKE_C_COMPILER="$CC"
13+
-DCMAKE_C_COMPILER="$COMP_CC"
1414
-DCMAKE_C_FLAGS="$C_FLAGS"
1515
-DCMAKE_INSTALL_LIBDIR="lib"
1616
)
@@ -27,7 +27,4 @@ fi
2727
# Run cmake with the arguments
2828
cmake ../ "${cmake_args[@]}"
2929

30-
# ./configure CC=$CC FC=mpiifort CFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" FFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" \
31-
# --prefix=$FIREMODELS/libs/hypre/$HYPRE_VERSION
32-
3330
make install

Build/Scripts/SUNDIALS/build_sundials.bat

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ echo ----------------------------------------------------------
7474
echo ----------------------------------------------------------
7575
echo.
7676

77-
echo.
78-
echo ----------------------------------------------------------
79-
echo ----------------------------------------------------------
80-
echo setting up Intel compilers
81-
echo ----------------------------------------------------------
82-
echo ----------------------------------------------------------
83-
echo.
84-
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat
85-
8677
git checkout %LIB_TAG%
8778

8879
echo.
@@ -110,28 +101,13 @@ echo ----------------------------------------------------------
110101
echo ----------------------------------------------------------
111102
echo.
112103

113-
::Check if make.bat or make.exe exists, and set CMAKE_MAKE_PROGRAM accordingly
114-
set CMAKE_MAKE_PROGRAM=
115-
for /f "delims=" %%i in ('where make.bat 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
116-
if not defined CMAKE_MAKE_PROGRAM (
117-
for /f "delims=" %%i in ('where make.exe 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
118-
)
119-
if not defined CMAKE_MAKE_PROGRAM (
120-
echo Error: Neither make.bat nor make.exe found in PATH.
121-
exit /b 1
122-
)
123-
124-
echo.
125-
echo make proram is %CMAKE_MAKE_PROGRAM%
126-
echo.
127-
128104
cmake ..\ ^
129105
-G "MinGW Makefiles" ^
130106
-DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" ^
131107
-DEXAMPLES_INSTALL_PATH="%INSTALLDIR%\examples" ^
132108
-DBUILD_FORTRAN_MODULE_INTERFACE=ON ^
133-
-DCMAKE_C_COMPILER=%CC% ^
134-
-DCMAKE_Fortran_COMPILER=%FC% ^
109+
-DCMAKE_C_COMPILER=%COMP_CC% ^
110+
-DCMAKE_Fortran_COMPILER=%COMP_FC% ^
135111
-DEXAMPLES_ENABLE_C=OFF ^
136112
-DEXAMPLES_ENABLE_CXX=OFF ^
137113
-DEXAMPLES_ENABLE_F2003=OFF ^

Build/Scripts/SUNDIALS/confmake.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export SUNDIALS_INSTALL_PREFIX=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION
33
cmake_args=(
44
-DCMAKE_INSTALL_PREFIX="$SUNDIALS_INSTALL_PREFIX"
55
-DEXAMPLES_INSTALL_PATH="$SUNDIALS_INSTALL_PREFIX/examples"
6-
-DCMAKE_C_COMPILER="$CC"
7-
-DCMAKE_CXX_COMPILER="$CXX"
8-
-DCMAKE_Fortran_COMPILER="$FC"
6+
-DCMAKE_C_COMPILER="$COMP_CC"
7+
-DCMAKE_CXX_COMPILER="$COMP_CXX"
8+
-DCMAKE_Fortran_COMPILER="$COMP_FC"
99
-DBUILD_FORTRAN_MODULE_INTERFACE=ON
1010
-DEXAMPLES_ENABLE_CXX=OFF
1111
-DEXAMPLES_ENABLE_CUDA=OFF

Build/Scripts/build_thirdparty_libs.bat

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
@echo off
22

3+
:: Select the compilers
4+
call ..\Scripts\set_compilers.bat
5+
36
set clean_hypre=
47
set clean_sundials=
58
set clean_fds=
@@ -89,18 +92,6 @@ cd %SCRIPTDIR%
8992
SET SCRIPTDIR=%CD%
9093

9194

92-
:: Decide C and FORTRAN COMPILER for third-party builds
93-
set CC=icx
94-
if "x%INTEL_IFORT%" == "x" (
95-
set FC=ifx
96-
) else (
97-
set FC=%INTEL_IFORT%
98-
)
99-
echo.
100-
echo Third-party libs C Compiler=%CC%
101-
echo Third-party libs Fortran Compiler=%FC%
102-
echo.
103-
10495

10596
::Call HYPRE and SUNDIALS build script
10697
cd %SCRIPTDIR%\HYPRE

Build/Scripts/build_thirdparty_libs.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#!/bin/bash
2+
3+
# Decide compilers
4+
source ../Scripts/set_compilers.sh
5+
6+
17
# PARSE OPTIONS FOR CLEAN LIBRARY BUILDS ####################################
28

39
# Set FIREMODELS environment variable if it is not already exists.
@@ -64,8 +70,6 @@ fi
6470

6571
# FINISHED WITH CLEANING OPTIONS ###########################################
6672

67-
# Decide compilers
68-
source ../Scripts/set_thirdparty_compilers.sh
6973

7074
# build hypre
7175
source ../Scripts/HYPRE/build_hypre.sh confmake.sh $clean_hypre

Build/Scripts/set_compilers.bat

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@echo off
2+
3+
:: Initialize compiler flags
4+
set set_COMP_CC=0
5+
set set_COMP_FC=0
6+
7+
:: Check and set C compiler
8+
if defined FIREMODELS_CC (
9+
set COMP_CC=%FIREMODELS_CC%
10+
where /q %COMP_CC% && (
11+
set set_COMP_CC=1
12+
) || (
13+
echo Warning: %FIREMODELS_CC% is not available. Searching for an alternative.
14+
)
15+
)
16+
if %set_COMP_CC%==0 (
17+
for %%C in (icx icc) do (
18+
where /q %%C && set COMP_CC=%%C && set set_COMP_CC=1 && goto :found_cc
19+
)
20+
echo Error: Neither icx nor icc is available. Thirdparty libs will not be built.
21+
)
22+
:found_cc
23+
24+
:: Check and set Fortran compiler
25+
if defined FIREMODELS_FC (
26+
set COMP_FC=%FIREMODELS_FC%
27+
where /q %COMP_FC% && (
28+
set set_COMP_FC=1
29+
) || (
30+
echo Warning: %FIREMODELS_FC% is not available. Searching for an alternative.
31+
)
32+
)
33+
if %set_COMP_FC%==0 (
34+
for %%F in (ifx ifort) do (
35+
where /q %%F && set COMP_FC=%%F && set set_COMP_FC=1 && goto :found_fc
36+
)
37+
echo Error: Neither ifx nor ifort is available. & exit /b 1
38+
)
39+
:found_fc
40+
41+
:: Display selected compilers
42+
echo.
43+
echo Third-party libs C Compiler: %COMP_CC%
44+
echo Firemodels and Third-party libs Fortran Compiler: %COMP_FC%
45+
echo.
46+
47+
48+
::Check if make.bat or make.exe exists, and set CMAKE_MAKE_PROGRAM accordingly
49+
::------------------------------------------------------------------------------
50+
set CMAKE_MAKE_PROGRAM=
51+
for /f "delims=" %%i in ('where make.bat 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
52+
if not defined CMAKE_MAKE_PROGRAM (
53+
for /f "delims=" %%i in ('where make.exe 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
54+
)
55+
if not defined CMAKE_MAKE_PROGRAM (
56+
echo Error: Neither make.bat nor make.exe found in PATH.
57+
exit /b 1
58+
)
59+
60+
echo.
61+
echo make proram is %CMAKE_MAKE_PROGRAM%
62+
echo.
63+
64+
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#!/bin/bash
2+
13
echo "FDS build target = $FDS_BUILD_TARGET"
24

35
# Initialize variables and check environment variables
4-
set_compiler_var() {
5-
local var_name=$1 # Variable name to set (e.g., CC, CXX, FC)
6-
local env_var=$2 # Environment variable to check (e.g., FIREMODELS_LIBS_CC)
7-
local set_flag_var=$3 # Flag variable name (e.g., set_CC, set_CXX, set_FC)
6+
set_compiler_from_env_var() {
7+
local var_name=$1 # Variable name to set (e.g., COMP_CC, COMP_CXX, COMP_FC)
8+
local env_var=$2 # Environment variable to check (e.g., FIREMODELS_CC)
9+
local set_flag_var=$3 # Flag variable name (e.g., set_COMP_CC, set_COMP_CXX, set_COMP_FC)
810

911
if [ -n "${!env_var}" ]; then
1012
eval "$var_name=${!env_var}"
@@ -18,8 +20,8 @@ set_compiler_var() {
1820

1921

2022
# Set compilers based on the build target
21-
select_compiler() {
22-
local var_name=$1 # Variable to set (CC, CXX, FC)
23+
select_compiler_from_system() {
24+
local var_name=$1 # Variable to set (COMP_CC, COMP_CXX, COMP_FC)
2325
shift
2426
local compilers=("$@") # List of compilers to check in order
2527
local set_flag_var="set_$var_name"
@@ -41,39 +43,35 @@ select_compiler() {
4143
}
4244

4345

44-
# Following variables indicate if compilers are set using environment variables FIREMODELS_LIBS_XXX.
45-
set_CC=0
46-
set_CXX=0
47-
set_FC=0
46+
# Following variables indicate if compilers are set using environment variables FIREMODELS_XXX.
47+
set_COMP_CC=0
48+
set_COMP_CXX=0
49+
set_COMP_FC=0
4850

4951
# Check environment variables for compilers
50-
set_compiler_var CC FIREMODELS_LIBS_CC set_CC
51-
set_compiler_var CXX FIREMODELS_LIBS_CXX set_CXX
52-
set_compiler_var FC FIREMODELS_LIBS_FC set_FC
52+
set_compiler_from_env_var COMP_CC FIREMODELS_CC set_COMP_CC
53+
set_compiler_from_env_var COMP_CXX FIREMODELS_CXX set_COMP_CXX
54+
set_compiler_from_env_var COMP_FC FIREMODELS_FC set_COMP_FC
5355

5456
# Determine compiler list based on build target
5557
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then
56-
select_compiler CC mpicc clang gcc
57-
select_compiler CXX mpicxx clang++ g++
58-
select_compiler FC mpifort gfortran
58+
select_compiler_from_system COMP_CC mpicc clang gcc
59+
select_compiler_from_system COMP_CXX mpicxx clang++ g++
60+
select_compiler_from_system COMP_FC mpifort
5961
elif [[ "$FDS_BUILD_TARGET" == *"intel"* ]]; then
60-
select_compiler CC mpiicx icx mpiicc icc
61-
select_compiler CXX mpiicpx icpx mpiicpc icpc
62-
select_compiler FC ifort mpiifx ifx
62+
select_compiler_from_system COMP_CC mpiicx icx mpiicc icc
63+
select_compiler_from_system COMP_CXX mpiicpx icpx mpiicpc icpc
64+
select_compiler_from_system COMP_FC mpiifx mpiifort
6365
else # Default to GNU compilers
64-
select_compiler CC mpicc gcc
65-
select_compiler CXX mpicxx g++
66-
select_compiler FC mpifort gfortran
66+
select_compiler_from_system COMP_CC mpicc gcc
67+
select_compiler_from_system COMP_CXX mpicxx g++
68+
select_compiler_from_system COMP_FC mpifort
6769
fi
6870

71+
echo "Thirdparty libs C Compiler COMP_CC=$COMP_CC"
72+
echo "Thirdparty libs C++ compiler COMP_CXX=$COMP_CXX"
73+
echo "Firemodels and Thirdparty libs Fortran compiler COMP_FC=$COMP_FC"
6974

70-
echo "Third-party libs C Compiler=$CC"
71-
echo "Third-party libs C++ compiler=$CXX"
72-
echo "Third-party libs Fortran compiler=$FC"
73-
74-
export CC=$CC
75-
export CXX=$CXX
76-
export FC=$FC
77-
78-
79-
75+
export COMP_CC=$COMP_CC
76+
export COMP_CXX=$COMP_CXX
77+
export COMP_FC=$COMP_FC

0 commit comments

Comments
 (0)