[test-suite] r317483 - [test-suite] Adding the HACCKernels Benchmark

Brian Homerding via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 06:56:26 PST 2017


Author: homerdin
Date: Mon Nov  6 06:56:25 2017
New Revision: 317483

URL: http://llvm.org/viewvc/llvm-project?rev=317483&view=rev
Log:
[test-suite] Adding the HACCKernels Benchmark

Description:
The Hardware/Hybrid Accelerated Cosmology Code (HACC), a cosmology N-body-code
framework, is designed to run efficiently on diverse computing architectures
and to scale to millions of cores and beyond. The gravitational force is the
only significant force between particles at cosmological scales, and, in HACC,
this force is divided into two components: a long-range component and a
short-range component. The long-range component is handled using a distributed
grid-based solver, and the short-range component is by more-direct
particle-particle computations. On many systems, a tree-based multipole
approximation is used to further reduce the computational complexity of the
short-range force. The inner-most computation is a direct N^2 particle-particle
force calculation of the short-range part of the gravitational force. It is this
inner-most calculation that consumes most of the simulation time, is
computationally bound, and is what is represented by this benchmark.

Link:
Web: https://xgitlab.cels.anl.gov/hacc/HACCKernels

When run on Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.2GHz:
compile_time: 11.6126 
exec_time: 13.3000

Differential Revision: https://reviews.llvm.org/D38417

Added:
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/COPYING
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/GravityForceKernel.cpp
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.h
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.reference_output
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/Makefile
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/README
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/main.cpp
Modified:
    test-suite/trunk/LICENSE.TXT
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/Makefile

Modified: test-suite/trunk/LICENSE.TXT
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/LICENSE.TXT?rev=317483&r1=317482&r2=317483&view=diff
==============================================================================
--- test-suite/trunk/LICENSE.TXT (original)
+++ test-suite/trunk/LICENSE.TXT Mon Nov  6 06:56:25 2017
@@ -93,6 +93,7 @@ CLAMR:              llvm-test/MultiSourc
 HPCCG:              llvm-test/MultiSource/Benchmarks/DOE-ProxyApps-C++/HPCCG
 PENNANT:            llvm-test/MultiSource/Benchmarks/DOE-ProxyApps-C++/PENNANT
 miniFE:             llvm-test/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE
+HACCKernels:        llvm-test/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels
 Fhourstones:        llvm-test/MultiSource/Benchmarks/Fhourstones
 Fhourstones-3.1:    llvm-test/MultiSource/Benchmarks/Fhourstones-3.1
 McCat:              llvm-test/MultiSource/Benchmarks/McCat

Modified: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/CMakeLists.txt?rev=317483&r1=317482&r2=317483&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CMakeLists.txt Mon Nov  6 06:56:25 2017
@@ -2,3 +2,4 @@ add_subdirectory(HPCCG)
 add_subdirectory(PENNANT)
 add_subdirectory(miniFE)
 add_subdirectory(CLAMR)
+add_subdirectory(HACCKernels)

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/CMakeLists.txt?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/CMakeLists.txt (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/CMakeLists.txt Mon Nov  6 06:56:25 2017
@@ -0,0 +1,4 @@
+set(PROG HACCKernels)
+list(APPEND CPPFLAGS -ffast-math -DVERIFICATION_OUTPUT_ONLY=ON)
+set(RUN_OPTIONS 450)
+llvm_multisource()

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/COPYING
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/COPYING?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/COPYING (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/COPYING Mon Nov  6 06:56:25 2017
@@ -0,0 +1,50 @@
+                   Copyright (C) 2017, UChicago Argonne, LLC
+                              All Rights Reserved
+
+             Hardware/Hybrid Cosmology Code (HACC), Version 1.0
+
+  Salman Habib, Adrian Pope, Hal Finkel, Nicholas Frontiere, Katrin Heitmann,
+       Vitali Morozov, Jeffrey Emberson, Thomas Uram, Esteban Rangel
+                         (Argonne National Laboratory)
+
+   David Daniel, Patricia Fasel, Chung-Hsing Hsu, Zarija Lukic, James Ahrens
+                       (Los Alamos National Laboratory)
+
+                                George Zagaris
+                                  (Kitware)
+
+                             OPEN SOURCE LICENSE
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  1. Redistributions of source code must retain the above copyright notice,
+     this list of conditions and the following disclaimer. Software changes,
+     modifications, or derivative works, should be noted with comments and the
+     author and organization’s name.
+
+  2. Redistributions in binary form must reproduce the above copyright notice,
+     this list of conditions and the following disclaimer in the documentation
+     and/or other materials provided with the distribution.
+
+  3. Neither the names of UChicago Argonne, LLC or the Department of Energy nor
+     the names of its contributors may be used to endorse or promote products
+     derived from this software without specific prior written permission.
+
+  4. The software and the end-user documentation included with the
+     redistribution, if any, must include the following acknowledgment:
+
+    "This product includes software produced by UChicago Argonne, LLC under
+     Contract No. DE-AC02-06CH11357 with the Department of Energy."
+
+********************************************************************************
+                                 DISCLAIMER
+THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. NEITHER THE
+UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR 
+UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS
+OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURARY,
+COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS, PRODUCT, OR
+PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
+OWNED RIGHTS.
+
+********************************************************************************

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/GravityForceKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/GravityForceKernel.cpp?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/GravityForceKernel.cpp (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/GravityForceKernel.cpp Mon Nov  6 06:56:25 2017
@@ -0,0 +1,165 @@
+/*
+ *                 Copyright (C) 2017, UChicago Argonne, LLC
+ *                            All Rights Reserved
+ *
+ *           Hardware/Hybrid Cosmology Code (HACC), Version 1.0
+ *
+ * Salman Habib, Adrian Pope, Hal Finkel, Nicholas Frontiere, Katrin Heitmann,
+ *      Vitali Morozov, Jeffrey Emberson, Thomas Uram, Esteban Rangel
+ *                        (Argonne National Laboratory)
+ *
+ *  David Daniel, Patricia Fasel, Chung-Hsing Hsu, Zarija Lukic, James Ahrens
+ *                      (Los Alamos National Laboratory)
+ *
+ *                               George Zagaris
+ *                                 (Kitware)
+ *
+ *                            OPEN SOURCE LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer. Software changes,
+ *      modifications, or derivative works, should be noted with comments and
+ *      the author and organization’s name.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *   3. Neither the names of UChicago Argonne, LLC or the Department of Energy
+ *      nor the names of its contributors may be used to endorse or promote
+ *      products derived from this software without specific prior written
+ *      permission.
+ *
+ *   4. The software and the end-user documentation included with the
+ *      redistribution, if any, must include the following acknowledgment:
+ *
+ *     "This product includes software produced by UChicago Argonne, LLC under
+ *      Contract No. DE-AC02-06CH11357 with the Department of Energy."
+ *
+ * *****************************************************************************
+ *                                DISCLAIMER
+ * THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. NEITHER THE
+ * UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR 
+ * UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, 
+ * EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE
+ * ACCURARY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS,
+ * PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE
+ * PRIVATELY OWNED RIGHTS.
+ *
+ * *****************************************************************************
+ */
+
+#include "HACCKernels.h"
+#include <cmath>
+
+extern const float PolyCoefficients4[] = {
+  0.263729f, -0.0686285f, 0.00882248f, -0.000592487f, 0.0000164622f
+};
+
+extern const float PolyCoefficients5[] = {
+  0.269327f, -0.0750978f, 0.0114808f, -0.00109313f, 0.0000605491f,
+  -0.00000147177f
+};
+
+extern const float PolyCoefficients6[] = {
+  0.271431f, -0.0783394f, 0.0133122f, -0.00159485f, 0.000132336f,
+  -0.00000663394f, 0.000000147305f
+};
+
+// HACC's gravity short-range-force kernel represents the part of the 1/r^2
+// gravitational force that is not computed by the long-range grid solver. This
+// kernel computes the acceleration of a target particle from all of the other
+// particles in the provided interaction lists. It is assumed that the target
+// particle has unit mass while the interaction-list can contain pseudo
+// particles with larger mass values. Beyond a distance of MaxSep, the
+// inter-particle force should be completely accounted for by the long-range
+// grid solver (and thus we filter out such interactions here). Closer than
+// MaxSep, we directly compute the inter-particle force, subtracting the
+// long-range part of the force (as fit to a polynomial of the specified
+// degree). A softening length, SofteningLen, is also used, as is standard in
+// N-body codes.
+
+template <int PolyOrder, const float (&PolyCoefficients)[PolyOrder+1]>
+static void GravityForceKernel(int n, float *RESTRICT x, float *RESTRICT y,
+                               float *RESTRICT z, float *RESTRICT mass,
+                               float x0, float y0, float z0,
+                               float MaxSepSqrd, float SofteningLenSqrd,
+                               float &RESTRICT ax, float &RESTRICT ay,
+                               float &RESTRICT az) {
+  float lax = 0.0f, lay = 0.0f, laz = 0.0f;
+
+// As written below, the mass array is conditionally accessed (i.e. accessed
+// only if the interaction is not filtered by the distance checks). This will
+// tend to inhibit vectorization on architectures without masked vector loads.
+// With OpenMP 4+, we can explicitly inform the compiler that vectorization is
+// safe. 
+//
+// For the test suite: Clang does not report a high-enough version of OpenMP
+// to enable the pragma below. Moreover, vectorization is desirable regardless
+// of whether OpenMP is enabled (even if Clang's reported version were high
+// enough), so we also use the Clang loop pragma to assume vectorization safety.
+#if _OPENMP >= 201307
+#pragma omp simd reduction(+:lax,lay,laz)
+#elif defined(clang)
+#pragma clang loop vectorize(assume_safety)
+#endif
+  for (int i = 0; i < n; ++i) {
+    float dx = x[i] - x0, dy = y[i] - y0, dz = z[i] - z0;
+    float r2 = dx * dx + dy * dy + dz * dz;
+
+    if (r2 >= MaxSepSqrd || r2 == 0.0f)
+      continue;
+
+    float r2s = r2 + SofteningLenSqrd;
+    float f = PolyCoefficients[PolyOrder];
+    for (int p = 1; p <= PolyOrder; ++p)
+      f = PolyCoefficients[PolyOrder-p] + r2*f;
+
+    f = (1.0f / (r2s * std::sqrt(r2s)) - f) * mass[i];
+
+    lax += f * dx;
+    lay += f * dy;
+    laz += f * dz; 
+  }
+
+  ax += lax;
+  ay += lay;
+  az += laz;
+}
+
+void GravityForceKernel4(int n, float *RESTRICT x, float *RESTRICT y,
+                         float *RESTRICT z, float *RESTRICT mass,
+                         float x0, float y0, float z0,
+                         float MaxSepSqrd, float SofteningLenSqrd,
+                         float &RESTRICT ax, float &RESTRICT ay,
+                         float &RESTRICT az) {
+  GravityForceKernel<4, PolyCoefficients4>(n, x, y, z, mass, x0, y0, z0,
+                                           MaxSepSqrd, SofteningLenSqrd,
+                                           ax, ay, az);
+}
+
+void GravityForceKernel5(int n, float *RESTRICT x, float *RESTRICT y,
+                         float *RESTRICT z, float *RESTRICT mass,
+                         float x0, float y0, float z0,
+                         float MaxSepSqrd, float SofteningLenSqrd,
+                         float &RESTRICT ax, float &RESTRICT ay,
+                         float &RESTRICT az) {
+  GravityForceKernel<5, PolyCoefficients5>(n, x, y, z, mass, x0, y0, z0,
+                                           MaxSepSqrd, SofteningLenSqrd,
+                                           ax, ay, az);
+}
+
+void GravityForceKernel6(int n, float *RESTRICT x, float *RESTRICT y,
+                         float *RESTRICT z, float *RESTRICT mass,
+                         float x0, float y0, float z0,
+                         float MaxSepSqrd, float SofteningLenSqrd,
+                         float &RESTRICT ax, float &RESTRICT ay,
+                         float &RESTRICT az) {
+  GravityForceKernel<6, PolyCoefficients6>(n, x, y, z, mass, x0, y0, z0,
+                                           MaxSepSqrd, SofteningLenSqrd,
+                                           ax, ay, az);
+}
+

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/HACCKernels.h?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.h (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.h Mon Nov  6 06:56:25 2017
@@ -0,0 +1,93 @@
+/*
+ *                 Copyright (C) 2017, UChicago Argonne, LLC
+ *                            All Rights Reserved
+ *
+ *           Hardware/Hybrid Cosmology Code (HACC), Version 1.0
+ *
+ * Salman Habib, Adrian Pope, Hal Finkel, Nicholas Frontiere, Katrin Heitmann,
+ *      Vitali Morozov, Jeffrey Emberson, Thomas Uram, Esteban Rangel
+ *                        (Argonne National Laboratory)
+ *
+ *  David Daniel, Patricia Fasel, Chung-Hsing Hsu, Zarija Lukic, James Ahrens
+ *                      (Los Alamos National Laboratory)
+ *
+ *                               George Zagaris
+ *                                 (Kitware)
+ *
+ *                            OPEN SOURCE LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer. Software changes,
+ *      modifications, or derivative works, should be noted with comments and
+ *      the author and organization’s name.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *   3. Neither the names of UChicago Argonne, LLC or the Department of Energy
+ *      nor the names of its contributors may be used to endorse or promote
+ *      products derived from this software without specific prior written
+ *      permission.
+ *
+ *   4. The software and the end-user documentation included with the
+ *      redistribution, if any, must include the following acknowledgment:
+ *
+ *     "This product includes software produced by UChicago Argonne, LLC under
+ *      Contract No. DE-AC02-06CH11357 with the Department of Energy."
+ *
+ * *****************************************************************************
+ *                                DISCLAIMER
+ * THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. NEITHER THE
+ * UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR 
+ * UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, 
+ * EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE
+ * ACCURARY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS,
+ * PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE
+ * PRIVATELY OWNED RIGHTS.
+ *
+ * *****************************************************************************
+ */
+
+#ifndef RESTRICT
+#if defined(__GNUC__) || defined(__clang__)
+#define RESTRICT __restrict__
+#elif defined(_MSC_VER)
+#define RESTRICT __restrict
+#else
+#define RESTRICT /* empty */
+#endif
+#endif
+
+typedef void
+  (*GravityForceKernelFunc)(int n, float *RESTRICT x, float *RESTRICT y,
+                            float *RESTRICT z, float *RESTRICT mass,
+                            float x0, float y0, float z0,
+                            float MaxSepSqrd, float SofteningLenSqrd,
+                            float &RESTRICT ax, float &RESTRICT ay,
+                            float &RESTRICT az);
+
+void GravityForceKernel4(int n, float *RESTRICT x, float *RESTRICT y,
+                         float *RESTRICT z, float *RESTRICT mass,
+                         float x0, float y0, float z0,
+                         float MaxSepSqrd, float SofteningLenSqrd,
+                         float &RESTRICT ax, float &RESTRICT ay,
+                         float &RESTRICT az);
+
+void GravityForceKernel5(int n, float *RESTRICT x, float *RESTRICT y,
+                         float *RESTRICT z, float *RESTRICT mass,
+                         float x0, float y0, float z0,
+                         float MaxSepSqrd, float SofteningLenSqrd,
+                         float &RESTRICT ax, float &RESTRICT ay,
+                         float &RESTRICT az);
+
+void GravityForceKernel6(int n, float *RESTRICT x, float *RESTRICT y,
+                         float *RESTRICT z, float *RESTRICT mass,
+                         float x0, float y0, float z0,
+                         float MaxSepSqrd, float SofteningLenSqrd,
+                         float &RESTRICT ax, float &RESTRICT ay,
+                         float &RESTRICT az);
+

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/HACCKernels.reference_output?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.reference_output (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/HACCKernels.reference_output Mon Nov  6 06:56:25 2017
@@ -0,0 +1,5 @@
+Iterations: 450
+Gravity Short-Range-Force Kernel (4th Order): 34376.3 689.584 -2378.97
+Gravity Short-Range-Force Kernel (5th Order): 34361.8 689.281 -2378.1
+Gravity Short-Range-Force Kernel (6th Order): 34360.9 689.252 -2378.1
+exit 0

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/Makefile?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/Makefile (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/Makefile Mon Nov  6 06:56:25 2017
@@ -0,0 +1,6 @@
+LEVEL = ../../../..
+
+PROG     = HACCKernels
+CXXFLAGS = -ffast-math -DVERIFICATION_OUTPUT_ONLY=ON
+RUN_OPTIONS = 450
+include $(LEVEL)/MultiSource/Makefile.multisrc

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/README
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/README?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/README (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/README Mon Nov  6 06:56:25 2017
@@ -0,0 +1,59 @@
+CCKernels: A Benchmark for HACC's Particle Force Kernels
+
+The Hardware/Hybrid Accelerated Cosmology Code (HACC), a cosmology N-body-code
+framework, is designed to run efficiently on diverse computing architectures
+and to scale to millions of cores and beyond. The gravitational force is the
+only significant force between particles at cosmological scales, and, in HACC,
+this force is divided into two components: a long-range component and a
+short-range component. The long-range component is handled using a distributed
+grid-based solver, and the short-range component is by more-direct
+particle-particle computations. On many systems, a tree-based multipole
+approximation is used to further reduce the computational complexity of the
+short-range force. The inner-most computation is a direct N^2 particle-particle
+force calculation of the short-range part of the gravitational force. It is this
+inner-most calculation that consumes most of the simulation time, is
+computationally bound, and is what is represented by this benchmark.
+
+Because this inner-most force calculation is algorithmically isolated from the
+overall scale of the problem, the parameters don't need to be adjusted to
+represent the workload on different machine scales (e.g. petascale or
+exascale).
+
+For more information on HACC, see:
+
+Salman Habib, et al. HACC: Simulating Sky Surveys on State-of-the-Art
+Supercomputing Architectures. New Astronomy Volume 42, January 2016, pp. 49-65.
+http://doi.org/10.1016/j.newast.2015.06.003
+https://arxiv.org/abs/1410.2805
+
+The benchmark can be compiled using cmake (or make directly using
+Makefile.simple) and then run like this:
+
+$ ./HACCKernels 
+Maximum OpenMP Threads: 1
+Iterations: 2000
+Gravity Short-Range-Force Kernel (4th Order): 26307.2 -122.385 -1369.32: 4.45269 s
+Gravity Short-Range-Force Kernel (5th Order): 26297.5 -123.056 -1368.67: 4.51347 s
+Gravity Short-Range-Force Kernel (6th Order): 26297.6 -123.225 -1368.66: 4.8256 s
+
+The accumulated acceleration in each direction for all particles in the last
+iteration, which is a function of the total number of iterations, is printed as
+a diagnostic. It should be similar for all polynomial kernel orders.
+
+If you'd like the benchmark only to display deterministic output (i.e.
+omitting information on the number of threads, timing, and the like), then
+define the preprocessor symbol VERIFICATION_OUTPUT_ONLY when compiling.
+You can enable this option when configuring by passing
+-DVERIFICATION_OUTPUT_ONLY=ON to cmake.
+
+Compared to the older HACCmk procurement benchmark
+(https://asc.llnl.gov/CORAL-benchmarks/#haccmk), this benchmark:
+
+ * More closely matches the parallelization scheme used by the production code.
+ * Uses a more-realistic distribution of interaction-list lengths and
+   out-of-bounds particles.
+ * Includes 4th-, 5th-, and 6th-order kernels.
+
+For more information, contact: Hal Finkel <hfinkel at anl.gov>
+
+

Added: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/main.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/HACCKernels/main.cpp?rev=317483&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/main.cpp (added)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/HACCKernels/main.cpp Mon Nov  6 06:56:25 2017
@@ -0,0 +1,193 @@
+/*
+ *                 Copyright (C) 2017, UChicago Argonne, LLC
+ *                            All Rights Reserved
+ *
+ *           Hardware/Hybrid Cosmology Code (HACC), Version 1.0
+ *
+ * Salman Habib, Adrian Pope, Hal Finkel, Nicholas Frontiere, Katrin Heitmann,
+ *      Vitali Morozov, Jeffrey Emberson, Thomas Uram, Esteban Rangel
+ *                        (Argonne National Laboratory)
+ *
+ *  David Daniel, Patricia Fasel, Chung-Hsing Hsu, Zarija Lukic, James Ahrens
+ *                      (Los Alamos National Laboratory)
+ *
+ *                               George Zagaris
+ *                                 (Kitware)
+ *
+ *                            OPEN SOURCE LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer. Software changes,
+ *      modifications, or derivative works, should be noted with comments and
+ *      the author and organization’s name.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *   3. Neither the names of UChicago Argonne, LLC or the Department of Energy
+ *      nor the names of its contributors may be used to endorse or promote
+ *      products derived from this software without specific prior written
+ *      permission.
+ *
+ *   4. The software and the end-user documentation included with the
+ *      redistribution, if any, must include the following acknowledgment:
+ *
+ *     "This product includes software produced by UChicago Argonne, LLC under
+ *      Contract No. DE-AC02-06CH11357 with the Department of Energy."
+ *
+ * *****************************************************************************
+ *                                DISCLAIMER
+ * THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. NEITHER THE
+ * UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR 
+ * UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, 
+ * EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE
+ * ACCURARY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS,
+ * PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE
+ * PRIVATELY OWNED RIGHTS.
+ *
+ * *****************************************************************************
+ */
+
+#include "HACCKernels.h"
+#include <ctime>
+#include <cstdlib>
+#include <limits>
+#include <vector>
+#include <iostream>
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+// This number of iterations, which can be changed via the command line, is set
+// so that the benchmark will run for a few seconds per polynomial degree of
+// the force kernel on a single core of a modern CPU.
+int NumIters = 2000;
+
+// The interaction lists range is size between a few hundred and a few thousand.
+int IListMin = 250;
+int IListMax = 2250;
+
+// The number of particles to update, which represents the number of particles
+// per leaf node of the force evaluation tree in HACC, varies between tends of
+// particles to around a hundred particles depending on the platform. These
+// numbers represent the high side of the production range.
+int PMin = 75;
+int PMax = 150;
+
+// The softening length and maximum separation similar to those used in HACC
+// high-resolution configurations.
+float SofteningLen = 0.1;
+float MaxSep = 3.2;
+
+// In this benchmark we offset the positions of the particles being updated
+// from the particles in the interaction list so that some of the interactions
+// will be filtered for being out of range. 0.1 yields ~5% of interactions
+// filtered for being out of range.
+float OffsetAdjFrac = 0.1;
+
+// A simple random-number generator, see: https://en.wikipedia.org/wiki/Xorshift
+static unsigned int rand32(unsigned int &state) {
+  unsigned int x = state;
+  x ^= x << 13;
+  x ^= x >> 17;
+  x ^= x << 5;
+  return (state = x);
+}
+
+static float randflt(unsigned int &state) {
+  return ((float) rand32(state)) / ((float) 0xffffffff);
+}
+
+void run(GravityForceKernelFunc GravityForceKernel, const char *Desc) {
+#ifndef VERIFICATION_OUTPUT_ONLY
+  std::clock_t Start, End;
+#endif
+
+  std::cout << "Gravity Short-Range-Force Kernel (" << Desc << "): ";
+#ifndef VERIFICATION_OUTPUT_ONLY
+  Start = std::clock();
+#endif
+
+  float ax, ay, az;
+
+  // We use lastprivate for (ax,ay,az) so that the reported output, which can
+  // be used for validation, does not depend on the order in which parallel
+  // loop iterations are executed.
+
+  // Because each iteration has a different amount of work, dynamic or guided
+  // scheduling is used here. guided gives the implementation more scheduling
+  // freedom.
+#ifdef _OPENMP
+#pragma omp parallel for schedule(guided) lastprivate(ax,ay,az)
+#endif
+  for (int i = 0; i < NumIters; ++i) {
+    // Set the random seed used by each iteration to be a function of the
+    // iteration number only. This allows information from any fixed iteration
+    // (e.g. first or last) to be used for numerical validation.
+    unsigned int seed = i+1;
+    ax = ay = az = 0.0f;
+
+    int ILParticleCount = IListMin + rand32(seed) % (IListMax - IListMin);
+    int ParticleCount = PMin + rand32(seed) % (PMax - PMin);
+    std::vector<float> px(ParticleCount), py(ParticleCount),
+                       pz(ParticleCount);
+    std::vector<float> x(ILParticleCount), y(ILParticleCount),
+                       z(ILParticleCount), mass(ILParticleCount);
+
+    // Fill the particle arrays and the interaction list. The interaction-list
+    // particles are offset in the x direction based on OffsetAdjFrac.
+    for (int j = 0; j < ParticleCount; ++j) {
+      px[j] = randflt(seed)*0.5*MaxSep;
+      py[j] = randflt(seed)*0.5*MaxSep;
+      pz[j] = randflt(seed)*0.5*MaxSep;
+    }
+
+    for (int j = 0; j < ILParticleCount; ++j) {
+      x[j] = randflt(seed)*0.5*MaxSep + (0.5+OffsetAdjFrac)*MaxSep;
+      y[j] = randflt(seed)*0.5*MaxSep;
+      z[j] = randflt(seed)*0.5*MaxSep;
+      mass[j] = 1.0f + randflt(seed);
+    }
+
+
+    for (int j = 0; j < ParticleCount; ++j)
+      GravityForceKernel(ILParticleCount, &x[0], &y[0], &z[0], &mass[0],
+                         px[j], py[j], pz[j], MaxSep*MaxSep,
+                         SofteningLen*SofteningLen, ax, ay, az);
+  }
+
+#ifndef VERIFICATION_OUTPUT_ONLY
+  End = std::clock();
+#endif
+
+  std::cout << ax << " " << ay << " " << az;
+
+#ifndef VERIFICATION_OUTPUT_ONLY
+  std::cout << ": ";
+  std::cout << ((float)(End - Start))/CLOCKS_PER_SEC << " s\n";
+#else
+  std::cout << "\n";
+#endif
+}
+
+int main(int argc, char *argv[]) {
+#if defined(_OPENMP) && !defined(VERIFICATION_OUTPUT_ONLY)
+  std::cout << "Maximum OpenMP Threads: " << omp_get_max_threads() << "\n";
+#endif
+
+  if (argc > 1)
+    NumIters = atoi(argv[1]);
+  std::cout << "Iterations: " << NumIters << "\n";
+
+  run(GravityForceKernel4, "4th Order");
+  run(GravityForceKernel5, "5th Order");
+  run(GravityForceKernel6, "6th Order");
+
+  return 0;
+}
+

Modified: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/Makefile?rev=317483&r1=317482&r2=317483&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/Makefile (original)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/Makefile Mon Nov  6 06:56:25 2017
@@ -1,6 +1,6 @@
 # MultiSource/DOE-ProxyApps-C++ Makefile: Build all subdirectories automatically
 
 LEVEL = ../../..
-PARALLEL_DIRS = HPCCG PENNANT miniFE CLAMR
+PARALLEL_DIRS = HPCCG PENNANT miniFE CLAMR HACCKernels
 
 include $(LEVEL)/Makefile.programs




More information about the llvm-commits mailing list