Add tweaks to support ARMPL for FFTs
authorSzilárd Páll <pall.szilard@gmail.com>
Mon, 29 Oct 2018 13:59:21 +0000 (14:59 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 27 Nov 2018 14:12:38 +0000 (15:12 +0100)
Support added through the FFTW compatibilty layer; the FFTW guru
interface is not implemented in ARMPL, so this is disabled in builds
that use ARMPL. The detection is basic and it is used only for these
purposes, the lirbary and header location needs to be passed manually
(we prefer ARM to implement a Find module).

Fixes #2684

Change-Id: I5afd7c200e2d02ac699bb668d14f0a85bf0a2369

cmake/gmxManageFFTLibraries.cmake
docs/install-guide/index.rst
docs/release-notes/2019/major/portability.rst
src/config.h.cmakein
src/gromacs/fft/CMakeLists.txt
src/gromacs/fft/fft.cpp
src/gromacs/utility/binaryinformation.cpp

index 3216e8a27bf41f5fc9ff0e49fe11105a0565e53a..b05ec2b6b10bcab9605847d05d3a9c433a74e7da 100644 (file)
@@ -101,11 +101,23 @@ if(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
                 set(FFT_WARNING_MESSAGE "The FFTW library was compiled with neither --enable-sse nor --enable-sse2; those would have enabled SSE(2) SIMD instructions. This will give suboptimal performance. You should (re)compile the FFTW library with --enable-sse2 and --enable-avx (and --enable-avx2 or --enable-avx512 if supported).")
             endif()
         endif()
-        set(FFT_STATUS_MESSAGE "Using external FFT library - FFTW3")
+
+        find_path(ARMPL_INCLUDE_DIR "armpl.h" HINTS ${${FFTW}_INCLUDE_DIRS}
+            NO_DEFAULT_PATH
+            NO_CMAKE_ENVIRONMENT_PATH
+            NO_CMAKE_PATH
+            NO_SYSTEM_ENVIRONMENT_PATH
+            NO_CMAKE_SYSTEM_PATH)
+        if (ARMPL_INCLUDE_DIR)
+            set(GMX_FFT_ARMPL_FFTW3 1)
+            set(FFT_STATUS_MESSAGE "Using external FFT library - ARM Performance Library (FFTW3 compatibility mode)")
+        else()
+            set(GMX_FFT_FFTW3 1)
+            set(FFT_STATUS_MESSAGE "Using external FFT library - FFTW3")
+        endif()
     endif()
 
     set(FFT_LIBRARIES ${${FFTW}_LIBRARIES})
-    set(GMX_FFT_FFTW3 1)
 elseif(${GMX_FFT_LIBRARY} STREQUAL "MKL")
     # Intel 11 and up makes life somewhat easy if you just want to use
     # all their stuff. It's not easy if you only want some of their
index 61492800d1aacdaa4b80875c982f2da9ff79c9f7..3e899a76812ced803c02b485c4a912453324cce5 100644 (file)
@@ -334,6 +334,24 @@ If you need to customize this further, use
 
 The full list and order(!) of libraries you require are found in Intel's MKL documentation for your system.
 
+Using ARM Performance Libraries
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ARM Performance Libraries provides FFT transforms implementation for ARM
+architectures.
+Preliminary support is provided for ARMPL in |Gromacs| through its FFTW-compatible API.
+Assuming that the ARM HPC toolchain environment including the ARMPL paths
+are set up (e.g. through loading the appropriate modules like
+``module load Module-Prefix/arm-hpc-compiler-X.Y/armpl/X.Y``) use the following cmake
+options:
+
+::
+
+    cmake -DGMX_FFT_LIBRARY=fftw3 \
+          -DFFTWF_LIBRARY="${ARMPL_DIR}/lib/libarmpl_lp64.so" \
+          -DFFTWF_INCLUDE_DIR=${ARMPL_DIR}/include
+
+
 Other optional build components
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -821,7 +839,8 @@ is found, and otherwise fall back on a version of BLAS internal to
 accordingly. The internal versions are fine for normal use. If you
 need to specify a non-standard path to search, use
 ``-DCMAKE_PREFIX_PATH=/path/to/search``. If you need to specify a
-library with a non-standard name (e.g. ESSL on Power machines), then
+library with a non-standard name (e.g. ESSL on Power machines
+or ARMPL on ARM machines), then
 set ``-DGMX_BLAS_USER=/path/to/reach/lib/libwhatever.a``.
 
 If you are using Intel MKL_ for FFT, then the BLAS and
index 1994c1c95775eb3649be736750269852a937d400..b39b4331b1ba8d1f67f200d99050ced682d8a857 100644 (file)
@@ -17,3 +17,9 @@ Updated the OpenCL requirement to version 1.2
 We now require at least OpenCL version 1.2 both for API and kernels. All
 currently targeted vendors' libraries do support it, so this is not a
 restriction in any way.
+
+Preliminary support for ARM Performance Libraries
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+The ARM Performance Libraries can now be used for FFT transforms through
+the FFTW compatiblity layer. This can provide performance benefits over using
+a vanilla FFTW3 on recent ARMv8 architectures.
index c8f21c9fa083fcdc098f14aab9d61df153d659c8..5fdeeb61f10cb78a02c86724c8d1e73f0712188f 100644 (file)
@@ -56,6 +56,9 @@
 /* Use FFTW3 FFT library */
 #cmakedefine01 GMX_FFT_FFTW3
 
+/* Use the ARM Performance library with FFTW3 compatibility */
+#cmakedefine01 GMX_FFT_ARMPL_FFTW3
+
 /* Use MKL FFT library */
 #cmakedefine01 GMX_FFT_MKL
 
index 2e5502b8dbb921b8ec5bcdba1cdca7c4c078d23c..072ca88af3aeb10114848c4504fb6a787f594729 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -44,7 +44,7 @@ if (GMX_FFT_FFTPACK)
         fft_fftpack.cpp
         ${CMAKE_SOURCE_DIR}/src/external/fftpack/fftpack.c)
 endif()
-if (GMX_FFT_FFTW3)
+if (GMX_FFT_FFTW3 OR GMX_FFT_ARMPL_FFTW3)
     gmx_add_libgromacs_sources(fft_fftw3.cpp)
 endif()
 if (GMX_FFT_MKL)
index 2c799ca2ff54d1a41add1eba7bf6b67bb115a7f7..a141db16bc1d6a7fc5c613c6bd2bbf44bda94b42 100644 (file)
@@ -53,7 +53,7 @@
  * files like fft_fftw3.c or fft_mkl.c for that.
  */
 
-#if !GMX_FFT_FFTW3
+#if !GMX_FFT_FFTW3 && !GMX_FFT_ARMPL_FFTW3
 
 struct gmx_many_fft {
     int       howmany;
index 8533ec51c1cd4854c7ad653d16ed89d988c0e9f8..68bb1243e6b279fa8920e8ac9255273197fc9de9 100644 (file)
@@ -46,7 +46,7 @@
 
 #include "config.h"
 
-#if GMX_FFT_FFTW3
+#if GMX_FFT_FFTW3 || GMX_FFT_ARMPL_FFTW3
 // Needed for construction of the FFT library description string
 #include <fftw3.h>
 #endif
@@ -202,7 +202,7 @@ void printCopyright(gmx::TextWriter *writer)
 const char *getFftDescriptionString()
 {
 // Define the FFT description string
-#if GMX_FFT_FFTW3
+#if GMX_FFT_FFTW3 || GMX_FFT_ARMPL_FFTW3
 #  if GMX_NATIVE_WINDOWS
     // Don't buy trouble
     return "fftw3";