Skip to content

Commit e02e9f6

Browse files
committed
add fastmath flag and bug fix
1 parent 37b1768 commit e02e9f6

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ option(MFC_MPI "Build with MPI" ON
2020
option(MFC_OpenACC "Build with OpenACC" OFF)
2121
option(MFC_GCov "Build with GCov" OFF)
2222
option(MFC_Unified "Build with unified CPU & GPU memory (GH-200 only)" OFF)
23+
option(MFC_Fastmath "Build with -fastmath on NV GPUs" OFF)
2324
option(MFC_PRE_PROCESS "Build pre_process" OFF)
2425
option(MFC_SIMULATION "Build simulation" OFF)
2526
option(MFC_POST_PROCESS "Build post_process" OFF)
@@ -487,6 +488,9 @@ function(MFC_SETUP_TARGET)
487488
"-foffload=amdgcn-amdhsa='-march=gfx90a'"
488489
"-foffload-options=-lgfortran\ -lm"
489490
"-fno-exceptions")
491+
if (MFC_Fastmath)
492+
message(WARNING "--fastmath has no effect with the GNU compiler")
493+
endif()
490494
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" OR CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
491495
foreach (cc ${MFC_CUDA_CC})
492496
target_compile_options(${a_target}
@@ -498,6 +502,12 @@ function(MFC_SETUP_TARGET)
498502
PRIVATE -gpu=keep,ptxinfo,lineinfo
499503
)
500504

505+
if (MFC_Fastmath)
506+
target_compile_options(${a_target}
507+
PRIVATE -gpu=fastmath
508+
)
509+
endif()
510+
501511
# GH-200 Unified Memory Support
502512
if (MFC_Unified)
503513
target_compile_options(${ARGS_TARGET}
@@ -521,11 +531,18 @@ function(MFC_SETUP_TARGET)
521531
PRIVATE -DFRONTIER_UNIFIED)
522532
endif()
523533

534+
if (MFC_Fastmath)
535+
message(WARNING "--fastmath has no effect with the CCE")
536+
endif()
537+
524538
find_package(hipfort COMPONENTS hip CONFIG REQUIRED)
525539
target_link_libraries(${a_target} PRIVATE hipfort::hip hipfort::hipfort-amdgcn)
526540
endif()
527541
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
528542
target_compile_options(${a_target} PRIVATE "SHELL:-h noacc" "SHELL:-x acc")
543+
if (MFC_Fastmath)
544+
message(WARNING "--fastmath has no effect with the CCE")
545+
endif()
529546
endif()
530547

531548
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" OR CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")

toolchain/mfc/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ def configure(self, case: Case):
147147
flags.append(f"-DMFC_OpenACC={'ON' if ARG('gpu') else 'OFF'}")
148148
flags.append(f"-DMFC_GCov={ 'ON' if ARG('gcov') else 'OFF'}")
149149
flags.append(f"-DMFC_Unified={'ON' if ARG('unified') else 'OFF'}")
150+
flags.append(f"-DMFC_Fastmath={'ON' if ARG('fastmath') else 'OFF'}")
150151

151152
command = ["cmake"] + flags + ["-S", cmake_dirpath, "-B", build_dirpath]
152153

toolchain/mfc/lock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .printer import cons
66

77

8-
MFC_LOCK_CURRENT_VERSION: int = 5
8+
MFC_LOCK_CURRENT_VERSION: int = 6
99

1010

1111
@dataclasses.dataclass

toolchain/mfc/state.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
@dataclasses.dataclass
55
class MFCConfig:
6-
mpi: bool = True
7-
gpu: bool = False
8-
debug: bool = False
9-
gcov: bool = False
10-
unified: bool = False
11-
single: bool = False
6+
mpi: bool = True
7+
gpu: bool = False
8+
debug: bool = False
9+
gcov: bool = False
10+
unified: bool = False
11+
single: bool = False
12+
fastmath : bool = False
1213

1314
@staticmethod
1415
def from_dict(d: dict):

toolchain/templates/santis.mako

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
<%namespace name="helpers" file="helpers.mako"/>
44

55
% if engine == 'batch':
6-
#SBATCH --uenv=icon/25.2:v1
6+
#SBATCH --uenv=icon/25.2:v1@santis
77
#SBATCH --nodes=${nodes}
8-
#SBATCH --reservation=g183
98
#SBATCH --ntasks-per-node=${tasks_per_node}
109
#SBATCH --job-name="${name}"
1110
#SBATCH --output="${name}.out"
@@ -78,9 +77,9 @@ echo
7877
--gpus-per-task 1 \
7978
% endif
8079
--wait 200 --bcast=/tmp/${target.name} \
81-
"${target.get_home_dirpath(case)}/misc/nvidia_uvm/bind.sh" \
80+
"${target.get_home_dirpath()}/misc/nvidia_uvm/bind.sh" \
8281
% if target.name == 'simulation':
83-
"${target.get_home_dirpath(case)}/misc/nvidia_uvm/nsys.sh" \
82+
"${target.get_home_dirpath()}/misc/nvidia_uvm/nsys.sh" \
8483
% endif
8584
"${target.get_install_binpath(case)}")
8685
% endif

0 commit comments

Comments
 (0)