Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/new-tests/global-minmax-test.diderot
ViewVC logotype

View of /tests/new-tests/global-minmax-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 9 months ago) by glk
File size: 758 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
#version 2.0

/* global-minmax-test.diderot
 *
 * This program tests the use of global reductions in a program.
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 */

const int N = 10;

strand S (int i) {
  output int id = i;
  int cnt = 0;

  update {
    cnt += 1;
    if (cnt > id) { stabilize; }
  }

}

update {
  int minimum = 0;
  int maximum = 0;
  if (numActive() > 0) {
      minimum = min { p.id | p in S.active };
      maximum = max { p.id | p in S.active };
  }
  int total = sum { p.id | p in S.stable };
  print ("min = ", minimum, ", max = ", maximum, ", stable sum = ", total, "\n");
}

create_collection { S(i) | i in 1..N }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0