<commit_before><html xmlns="http://www.w3.org/1999/xhtml"> 
  <!--
    Copyright 2010-2011 Fabric Technologies Inc. All rights reserved.
    -->
  <head> 
    <title>FABRIC - Tutorial 06 - Dependencies between Nodes</title> 
    
    <meta charset="iso-8859-1"/>
    <script type="text/javascript" src="../../../ThirdParty/jQuery/jquery-1.4.2.min.js"></script>

    <script type="text/javascript" src="../../../Core/FABRIC.js" charset="utf-8"></script>
    

<script type="text/javascript">

 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-25833362-1']);
 _gaq.push(['_trackPageview']);

 (function() {
   var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true;
   ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
   var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
 })();

</script>

<script type="text/javascript">

$(document).ready(function() {
  
  // create a context and store it
  var context = FABRIC.createContext();

  // create a new dgnode
  var dgnode1 = context.DependencyGraph.createNode("myNode1");
  var dgnode2 = context.DependencyGraph.createNode("myNode2");
  
  // add some members
  dgnode1.addMember('a','Scalar');
  dgnode1.addMember('b','Scalar');
  dgnode1.addMember('result','Scalar');
  
  dgnode2.addMember('result','Scalar');
  
  // increase the slicecount of the nodes
  var count = 1000000;
  dgnode1.setCount(count);
  dgnode2.setCount(count);
  
  // create dependencies between the nodes
  dgnode2.setDependency(dgnode1, 'otherNode');
  
  // create three operators, one to initiate the data, one to add, and one to mul
  var operatorInit = context.DependencyGraph.createOperator("initiate");
  operatorInit.setSourceCode(
    'operator initiate(in Size index, io Scalar a, io Scalar b) {\n'+
    '  a = 12.5 * Scalar(index);\n'+
    '  b = 1.73 * Scalar(index);\n'+
    '}\n');
  operatorInit.setEntryFunctionName('initiate');
  
  var operatorAdd = context.DependencyGraph.createOperator("add");
  operatorAdd.setSourceCode(
    'operator add(io Scalar a, io Scalar b, io Scalar result) {\n'+
    '  result = a + b;\n'+
    '}\n');
  operatorAdd.setEntryFunctionName('add');
  
  var operatorMul = context.DependencyGraph.createOperator("operatorMul");
  operatorMul.setSourceCode(
    'operator mul(io Scalar input[], io Scalar result, in Size index) {\n'+
    '  result = 3.0 * input[index];\n'+
    '}\n');
  operatorMul.setEntryFunctionName('mul');
  
  // create bindings between the nodes and the operator
  var binding1init = context.DependencyGraph.createBinding();
  binding1init.setOperator(operatorInit);
  binding1init.setParameterLayout([
    'self.index',
    'self.a',
    'self.b'
  ]);
  var binding1add = context.DependencyGraph.createBinding();
  binding1add.setOperator(operatorAdd);
  binding1add.setParameterLayout([
    'self.a',
    'self.b',
    'self.result'
  ]);
  var binding2 = context.DependencyGraph.createBinding();
  binding2.setOperator(operatorMul);
  binding2.setParameterLayout([
    'otherNode.result[]',
    'self.result',
    'self.index'
  ]);
  
  // append the new binding to the node
  dgnode1.bindings.append(binding1init);
  dgnode1.bindings.append(binding1add);
  dgnode2.bindings.append(binding2);
  <commit_msg>bugzid:81 Fix crash when using optimized IR in certain trivial operators<commit_after><html xmlns="http://www.w3.org/1999/xhtml"> 
  <!--
    Copyright 2010-2011 Fabric Technologies Inc. All rights reserved.
    -->
  <head> 
    <title>FABRIC - Tutorial 06 - Dependencies between Nodes</title> 
    
    <meta charset="iso-8859-1"/>
    <script type="text/javascript" src="../../../ThirdParty/jQuery/jquery-1.4.2.min.js"></script>

    <script type="text/javascript" src="../../../Core/FABRIC.js" charset="utf-8"></script>
    

<script type="text/javascript">

 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-25833362-1']);
 _gaq.push(['_trackPageview']);

 (function() {
   var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true;
   ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
   var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
 })();

</script>

<script type="text/javascript">

$(document).ready(function() {
  
  // create a context and store it
  var context = FABRIC.createContext();

  // create a new dgnode
  var dgnode1 = context.DependencyGraph.createNode("myNode1");
  var dgnode2 = context.DependencyGraph.createNode("myNode2");
  
  // add some members
  dgnode1.addMember('a','Scalar');
  dgnode1.addMember('b','Scalar');
  dgnode1.addMember('result','Scalar');
  
  dgnode2.addMember('result','Scalar');
  
  // increase the slicecount of the nodes
  var count = 1000000;
  dgnode1.setCount(count);
  dgnode2.setCount(count);
  
  // create dependencies between the nodes
  dgnode2.setDependency(dgnode1, 'otherNode');
  
  // create three operators, one to initiate the data, one to add, and one to mul
  var operatorInit = context.DependencyGraph.createOperator("initiate");
  operatorInit.setSourceCode(
    'operator initiate(in Size index, io Scalar a, io Scalar b) {\n'+
    '  a = 12.5 * Scalar(index);\n'+
    '  b = 1.73 * Scalar(index);\n'+
    '}\n');
  operatorInit.setEntryFunctionName('initiate');
  
  var operatorAdd = context.DependencyGraph.createOperator("add");
  operatorAdd.setSourceCode(
    'operator add(io Scalar a, io Scalar b, io Scalar result) {\n'+
    '  result = a + b;\n'+
    '}\n');
  operatorAdd.setEntryFunctionName('add');
  
  var operatorMul = context.DependencyGraph.createOperator("operatorMul");
  operatorMul.setSourceCode(
    'operator mul(io Scalar input<>, io Scalar result, in Size index) {\n'+
    '  result = 3.0 * input[index];\n'+
    '}\n');
  operatorMul.setEntryFunctionName('mul');
  
  // create bindings between the nodes and the operator
  var binding1init = context.DependencyGraph.createBinding();
  binding1init.setOperator(operatorInit);
  binding1init.setParameterLayout([
    'self.index',
    'self.a',
    'self.b'
  ]);
  var binding1add = context.DependencyGraph.createBinding();
  binding1add.setOperator(operatorAdd);
  binding1add.setParameterLayout([
    'self.a',
    'self.b',
    'self.result'
  ]);
  var binding2 = context.DependencyGraph.createBinding();
  binding2.setOperator(operatorMul);
  binding2.setParameterLayout([
    'otherNode.result<>',
    'self.result',
    'self.index'
  ]);
  
  // append the new binding to the node
  dgnode1.bindings.append(binding1init);
  dgnode1.bindings.append(binding1add);
  dgnode2.bindings.append(binding2);
  
{'fraction_non_alphanumeric': 0.16090760788966335, 'fraction_numerical': 0.022838499184339316, 'mean_word_length': 3.8344086021505377, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '969291', 'n_tokens_mistral': 2318, 'n_tokens_neox': 2204, 'n_words': 452}