Skip to content

Commit

Permalink
Reduces amount of Unchecked code in Olden/TreeAdd node.c
Browse files Browse the repository at this point in the history
  • Loading branch information
lenary committed Jun 5, 2017
1 parent 66e8a2b commit da9c9f1
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions MultiSource/Benchmarks/Olden/treeadd/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
extern int NumNodes;
#endif

unchecked int dealwithargs(int argc, array_ptr<char*> argv : count(argc));
unchecked
int dealwithargs(int argc, array_ptr<char*> argv : count(argc));

typedef struct {
long level;
} startmsg_t;

unchecked int main (int argc, array_ptr<char*> argv : count(argc))
unchecked
int main (int argc, array_ptr<char*> argv : count(argc))
{
ptr<tree_t> root = NULL;
int level,result;
Expand All @@ -42,33 +44,34 @@ unchecked int main (int argc, array_ptr<char*> argv : count(argc))
#endif
level = dealwithargs(argc, argv);
#endif
checked {
#ifndef TORONTO
CMMD_node_timer_clear(0);
CMMD_node_timer_clear(1);
#endif
#ifdef TORONTO
chatting("Treeadd with %d levels on %d processors \n",
level, NumNodes);
unchecked { chatting("Treeadd with %d levels on %d processors \n",
level, NumNodes); }
#else
chatting("Treeadd with %d levels on %d processors \n",
level, __NumNodes);
unchecked { chatting("Treeadd with %d levels on %d processors \n",
level, __NumNodes); }
#endif
/* only processor 0 will continue here. */
chatting("About to enter TreeAlloc\n");
unchecked { chatting("About to enter TreeAlloc\n"); }
#ifndef TORONTO
CMMD_node_timer_start(0);
#endif

#ifdef TORONTO
checked {root = TreeAlloc (level, 0, NumNodes);}
root = TreeAlloc (level, 0, NumNodes);
#else
checked {root = TreeAlloc (level, 0, __NumNodes);}
root = TreeAlloc (level, 0, __NumNodes);
#endif

#ifndef TORONTO
CMMD_node_timer_stop(0);
#endif
chatting("About to enter TreeAdd\n");
unchecked { chatting("About to enter TreeAdd\n"); }

#ifndef PLAIN
ClearAllStats();
Expand All @@ -77,24 +80,23 @@ unchecked int main (int argc, array_ptr<char*> argv : count(argc))
CMMD_node_timer_start(1);
#endif
{ int i; for (i = 0; i < 100; ++i)
checked {result = TreeAdd (root);}
result = TreeAdd (root);
}
#ifndef TORONTO
CMMD_node_timer_stop(1);
#endif
chatting("Received result of %d\n",result);
unchecked { chatting("Received result of %d\n",result); }

#ifndef TORONTO
chatting("Alloc Time = %f seconds\n", CMMD_node_timer_elapsed(0));
chatting("Add Time = %f seconds\n", CMMD_node_timer_elapsed(1));
unchecked { chatting("Alloc Time = %f seconds\n", CMMD_node_timer_elapsed(0)); }
unchecked { chatting("Add Time = %f seconds\n", CMMD_node_timer_elapsed(1)); }
#endif

#ifdef FUTURES
__ShutDown();
#endif
exit(0);


}
}

/* TreeAdd:
Expand Down

0 comments on commit da9c9f1

Please sign in to comment.