spack/var/spack/repos/builtin/packages/miniqmc/pgi-cmake.patch
Scott McMillan 0015dd0bf8
Enable packages to use the NVIDIA HPC SDK (#19452)
* Enable packages to use the NVIDIA HPC SDK

* fix linter and review items

* fix linter issue

Co-authored-by: Scott McMillan <smcmillan@nvidia.com>
2020-10-22 16:42:48 -05:00

44 lines
1.6 KiB
Diff

diff --git a/CMake/PGICompilers.cmake b/CMake/PGICompilers.cmake
new file mode 100644
index 000000000..ec9d976a9
--- /dev/null
+++ b/CMake/PGICompilers.cmake
@@ -0,0 +1,26 @@
+# Enable OpenMP
+# If just -mp is specified, OMP_NUM_THREADS must be set in order to run in parallel
+# Specifying 'allcores' will run on all cores if OMP_NUM_THREADS is not set (which seems
+# to be the default for other OpenMP implementations)
+IF(QMC_OMP)
+ SET(ENABLE_OPENMP 1)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mp=allcores")
+ENDIF(QMC_OMP)
+
+ADD_DEFINITIONS( -Drestrict=__restrict__ )
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__forceinline=inline")
+
+# Set extra optimization specific flags
+SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fast" )
+SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fast" )
+
+
+# Setting this to 'OFF' adds the -A flag, which enforces strict standard compliance
+# and causes the compilation to fail with some GNU header files
+SET(CMAKE_CXX_EXTENSIONS ON)
+
+# Add static flags if necessary
+IF(QMC_BUILD_STATIC)
+ SET(CMAKE_CXX_LINK_FLAGS " -Bstatic")
+ENDIF(QMC_BUILD_STATIC)
--- a/CMakeLists.txt 2020-09-16 13:15:18.296609121 -0700
+++ b/CMakeLists.txt 2020-09-16 13:15:52.661916219 -0700
@@ -260,6 +260,8 @@
INCLUDE(${PROJECT_CMAKE}/IntelCompilers.cmake)
ELSEIF( ${COMPILER} MATCHES "GNU" )
INCLUDE(${PROJECT_CMAKE}/GNUCompilers.cmake)
+ ELSEIF( ${COMPILER} MATCHES "PGI" )
+ INCLUDE(${PROJECT_CMAKE}/PGICompilers.cmake)
ELSEIF( ${COMPILER} MATCHES "Clang" )
INCLUDE(${PROJECT_CMAKE}/ClangCompilers.cmake)
ELSE()