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

Add autotools config files for NVIDIA compilers, always add -fPIC flag for nvfortran. #3642

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion config/cmake/HDFCXXCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED)
endif ()
endif ()

if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Minform=warn")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c++11 flag should have a CMake option available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC" AND CMAKE_CXX_COMPILER_LOADED)
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
endif ()
endif ()
endif ()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this code.

if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O4")
else ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Mbounds -gopt -O2")
endif ()
endif ()

if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
Expand Down Expand Up @@ -97,7 +106,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
endif ()

#-----------------------------------------------------------------------------
# HDF5 library compile options
# HDF5 library compile options - to be made available to all targets
#-----------------------------------------------------------------------------

if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
Expand Down
11 changes: 10 additions & 1 deletion config/cmake/HDFCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGN
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000")
endif()

if(CMAKE_C_COMPILER_ID STREQUAL "NVHPC" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=warn")
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fast -O4")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mbounds -O2")
endif ()
endif()

if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
Expand Down Expand Up @@ -106,7 +115,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
endif ()

#-----------------------------------------------------------------------------
# HDF5 library compile options
# HDF5 library compile options - to be made available to all targets
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
Expand Down
11 changes: 10 additions & 1 deletion config/cmake/HDFFortranCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
endif ()

#-----------------------------------------------------------------------------
# HDF5 library compile options
# HDF5 library compile options - to be made available to all targets
#-----------------------------------------------------------------------------
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
if (HDF5_ENABLE_BUILD_DIAGS)
Expand All @@ -57,6 +57,15 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ieee=full")
endif ()

if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fPIC")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be needed as CMake should handle this flag.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does

if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fast -Mnoframe")
else ()
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mbounds -Mchkptr -Mdclchk")
endif ()
endif ()

if (NOT MSVC AND NOT MINGW)
# General flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
Expand Down
Loading