This is an archive of the discontinued LLVM Phabricator instance.

[test-suite]: Adding SimpleMOC proxy-app.
ClosedPublic

Authored by pavanravikanth.kprk on Aug 11 2017, 9:52 AM.

Details

Summary

Description:

SimpleMOC: The purpose of this mini-app is to demonstrate the performance characterterics and viability of the Method of Characteristics (MOC) for 3D neutron transport calculations in the context of full scale light water reactor simulation.

GitHub: SimpleMOC @git

Test timing on my machine (IBM x3550 M4):

compile_time: 14.7580 
exec_time: 2.8769 
link_time: 0.0165
Maximum resident set size (kbytes): 92016

Diff Detail

Repository
rL LLVM

Event Timeline

pavanravikanth.kprk edited the summary of this revision. (Show Details)Aug 11 2017, 9:54 AM
hfinkel added inline comments.Aug 11 2017, 10:04 AM
LICENSE.TXT
115 ↗(On Diff #110746)

The spacing seems a bit off here.

File: test-suite/LICENCE.txt - Fixed the spacing issue.

pavanravikanth.kprk edited the summary of this revision. (Show Details)Aug 11 2017, 12:22 PM
pavanravikanth.kprk edited the summary of this revision. (Show Details)Aug 11 2017, 12:50 PM
hfinkel edited edge metadata.Aug 15 2017, 10:31 AM

This test does not have a numerical verification output, but nevertheless, I'd prefer that we not depend explicitly on libc's rand. Different libc implementations have different implementations of rand, and I'd rather not have that be a cause of any latter difficultly tracking down performance differences between systems/configurations.

The easiest way to deal with this is probably to substitute our own rand implementation. I wrote one of these for the original XSBench patch (see glibc_compat_rand.{c.h} in https://reviews.llvm.org/D27311). Can you grab those files from there and add them to this patch and then, in SimpleMOC_header.h, add something like:

#ifndef NO_GLIBC_COMPAT_RAND
#define rand glibc_compat_rand
#define srand glibc_compat_srand
#endif

Updated SimpleMOC with custom rand and srand functions instead of using libc functions.

This test does not have a numerical verification output, but nevertheless, I'd prefer that we not depend explicitly on libc's rand. Different libc implementations have different implementations of rand, and I'd rather not have that be a cause of any latter difficultly tracking down performance differences between systems/configurations.

The easiest way to deal with this is probably to substitute our own rand implementation. I wrote one of these for the original XSBench patch (see glibc_compat_rand.{c.h} in https://reviews.llvm.org/D27311). Can you grab those files from there

As it turns out, those files were pretty broken. Here's a working source file:

/*===------------ glibc_compat_rand.c - glibc rand emulation --------------===*\
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is distributed under the University of Illinois Open Source
 * License. See LICENSE.TXT for details.
 *
\*===----------------------------------------------------------------------===*/

#include "glibc_compat_rand.h"

/**
 * This rand implementation is designed to emulate the implementation of
 * rand/srand in recent versions of glibc. This is used for programs which
 * require this specific rand implementation in order to pass verification
 * tests.
 *
 * For more information, see: http://www.mathstat.dal.ca/~selinger/random/
 **/

#define TABLE_SIZE 344
static unsigned int table[TABLE_SIZE];
static int next;

int glibc_compat_rand(void) {
  /* Calculate the indices i-3 and i-31 in the circular vector. */
  int i3 = (next < 3) ? (TABLE_SIZE + next - 3) : (next - 3);
  int i31 = (next < 31) ? (TABLE_SIZE + next - 31) : (next - 31);

  table[next] = table[i3] + table[i31];
  unsigned int r = table[next] >> 1;

  ++next;
  if (next >= TABLE_SIZE)
    next = 0;

  return r;
}

void glibc_compat_srand(unsigned int seed) {
  if (seed == 0)
    seed = 1;

  table[0] = seed;

  for (int i = 1; i < 31; i++) {
    int r = (16807ll * table[i - 1]) % 2147483647;
    if (r < 0)
      r += 2147483647;

    table[i] = r;
  }

  for (int i = 31; i < 34; i++)
    table[i] = table[i - 31];
  for (int i = 34; i < TABLE_SIZE; i++)
    table[i] = table[i - 31] + table[i - 3];

  next = 0;
}

Please use that instead.

and add them to this patch and then, in SimpleMOC_header.h, add something like:

#ifndef NO_GLIBC_COMPAT_RAND
#define rand glibc_compat_rand
#define srand glibc_compat_srand
#endif

added Makefile support and updated with upgraded random generation code.

Added Makefile support.

Added SimpleMOC in Parallel Dirs.

Added LEVEL to SimpleMOC Makefile.

MatzeB accepted this revision.Aug 31 2017, 7:13 PM
  • MultiSource/Benchmarks/DOE-ProxyApps-C/SimpleMOC/LICENSE doesn't need to have the executable flag set
  • Otherwise integration LGTM.
This revision is now accepted and ready to land.Aug 31 2017, 7:13 PM
This revision was automatically updated to reflect the committed changes.