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

SCM Repository

[diderot] Diff of /branches/vis12-cl/doc/report/api.tex
ViewVC logotype

Diff of /branches/vis12-cl/doc/report/api.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2727, Wed Sep 24 19:24:48 2014 UTC revision 2728, Thu Sep 25 13:13:02 2014 UTC
# Line 54  Line 54 
54      functions to shutdown and deallocation the runtime system structures.      functions to shutdown and deallocation the runtime system structures.
55  \end{itemize}%  \end{itemize}%
56    
57    \subsection{Initialization}
58    Initialization of a Diderot program involves several steps.
59    First, one must create a world object using the \texttt{New} function:\footnote{
60      In this example, we are assuming that the option \texttt{--namespace=NS} option
61      was specified on the \texttt{diderotc} command line.
62    }
63    \begin{quote}
64    \begin{lstlisting}[language=C]
65    NS_World_t *wrld = NS_New ();
66    if (wrld == 0) { /* error */ }
67    \end{lstlisting}%
68    \end{quote}%
69    
70    Once the world has been created, we can set generic runtime properties, such
71    as verbosity.
72    For parallel and GPU targets, we can query the available hardware resources and
73    specify the desired runtime properties.
74    \begin{quote}
75    \begin{lstlisting}[language=C]
76    NS_SetVerbose (wrld, true);
77    #ifdef DIDEROT_TARGET_PARALLEL
78      NS_SetNumWorkers(wrld, 0); /* use all available processors */
79    #endif
80    \end{lstlisting}%
81    \end{quote}%
82    
83    The next step in intialization is to allocate the computational resources
84    needed to support the program's execution, which is done using the \texttt{Init}
85    function.
86    \begin{quote}
87    \begin{lstlisting}[language=C]
88    if (NS_Init (wrld)) { /* error */ }
89    \end{lstlisting}%
90    \end{quote}%
91    
92    Once the world is initialized, we can then set program inputs using the
93    generated functions.
94    
95    The final step of initialization is to create the initial grid or collection
96    of strands.
97    \begin{quote}
98    \begin{lstlisting}[language=C]
99    if (NS_Initially (wrld)) { /* error */ }
100    \end{lstlisting}%
101    \end{quote}%
102    This function call initializes the Diderot globals and allocates the initial strands.
103    
104  % structure of header file  % structure of header file
105  % world creation  % world creation
106  % initializing inputs; descriptions; defaults  % initializing inputs; descriptions; defaults

Legend:
Removed from v.2727  
changed lines
  Added in v.2728

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