tsphere_internals.html - sphere - GPU-based 3D discrete element method algorith… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
tsphere_internals.html (20735B) | |
--- | |
1 | |
2 <!DOCTYPE html> | |
3 | |
4 <html xmlns="http://www.w3.org/1999/xhtml"> | |
5 <head> | |
6 <meta charset="utf-8" /> | |
7 <title>sphere internals — sphere 2.15-beta documentation</titl… | |
8 <link rel="stylesheet" href="_static/classic.css" type="text/css" /> | |
9 <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> | |
10 | |
11 <script type="text/javascript" id="documentation_options" data-url_r… | |
12 <script type="text/javascript" src="_static/jquery.js"></script> | |
13 <script type="text/javascript" src="_static/underscore.js"></script> | |
14 <script type="text/javascript" src="_static/doctools.js"></script> | |
15 <script type="text/javascript" src="_static/language_data.js"></scri… | |
16 | |
17 <link rel="index" title="Index" href="genindex.html" /> | |
18 <link rel="search" title="Search" href="search.html" /> | |
19 <link rel="prev" title="Python API" href="python_api.html" /> | |
20 </head><body> | |
21 <div class="related" role="navigation" aria-label="related navigatio… | |
22 <h3>Navigation</h3> | |
23 <ul> | |
24 <li class="right" style="margin-right: 10px"> | |
25 <a href="genindex.html" title="General Index" | |
26 accesskey="I">index</a></li> | |
27 <li class="right" > | |
28 <a href="py-modindex.html" title="Python Module Index" | |
29 >modules</a> |</li> | |
30 <li class="right" > | |
31 <a href="python_api.html" title="Python API" | |
32 accesskey="P">previous</a> |</li> | |
33 <li class="nav-item nav-item-0"><a href="index.html">sphere 2.15… | |
34 </ul> | |
35 </div> | |
36 | |
37 <div class="document"> | |
38 <div class="documentwrapper"> | |
39 <div class="bodywrapper"> | |
40 <div class="body" role="main"> | |
41 | |
42 <div class="section" id="sphere-internals"> | |
43 <h1>sphere internals<a class="headerlink" href="#sphere-internals" title… | |
44 <p>The <em>sphere</em> executable has the following options:</p> | |
45 <div class="highlight-text notranslate"><div class="highlight"><pre><spa… | |
46 ../../sphere: particle dynamics simulator | |
47 Usage: ../../sphere [OPTION[S]]... [FILE1 ...] | |
48 Options: | |
49 -h, --help print help | |
50 -V, --version print version information and exit | |
51 -q, --quiet suppress status messages to stdout | |
52 -d <device> execute on device with specified id | |
53 -n, --dry show key experiment parameters and quit | |
54 -f, --fluid simulate fluid between particles | |
55 -r, --render render input files to images instead of | |
56 simulating the temporal evolution | |
57 -dc, --dont-check don't check values before running | |
58 | |
59 Raytracer (-r) specific options: | |
60 -m <method> <maxval> [-l <lower cutoff val>], or | |
61 --method <method> <maxval> [-l <lower cutoff val>] | |
62 color visualization method, possible values: | |
63 normal, pres, vel, angvel, xdisp, angpos | |
64 'normal' is the default mode | |
65 if -l is appended, don't render particles with value below | |
66 -c, --contacts Print a list of particle-particle contacts | |
67 </pre></div> | |
68 </div> | |
69 <p>The most common way to invoke <em>sphere</em> is however via the Pyth… | |
70 <p>subsection{The <em>sphere</em> algorithm} | |
71 label{subsec:spherealgo} | |
72 The <em>sphere</em>-binary is launched from the system terminal by passi… | |
73 #. System check, including search for NVIDIA CUDA compatible devices (te… | |
74 <ol class="arabic simple"> | |
75 <li><p>Initial data import from binary input file (texttt{main.cpp}).</p… | |
76 <li><p>Allocation of memory for all host variables (particles, grid, wal… | |
77 <li><p>Continued import from binary input file (texttt{main.cpp}).</p></… | |
78 <li><p>Control handed to GPU-specific function texttt{gpuMain(ldots)} (t… | |
79 <li><p>Memory allocation of device memory (texttt{device.cu}).</p></li> | |
80 <li><p>Transfer of data from host to device variables (texttt{device.cu}… | |
81 <li><p>Initialization of Thrustfootnote{url{<a class="reference external… | |
82 <li><p>Calculation of GPU workload configuration (thread and block layou… | |
83 <li><p>Status and data written to verb”<simulation_ID>.status.da… | |
84 <li><p>Main loop (while texttt{time.current <= time.total}) (function… | |
85 </ol> | |
86 <blockquote> | |
87 <div><ol class="arabic"> | |
88 <li><p>label{loopstart}CUDA thread synchronization point.</p></li> | |
89 <li><p>texttt{calcParticleCellID<<<,>>>(ldots)}: Parti… | |
90 <li><p>CUDA thread synchronization point.</p></li> | |
91 <li><p>texttt{thrust::sort_by_key(ldots)}: Thrust radix sort of particle… | |
92 <li><p>texttt{cudaMemset(ldots)}: Writing zero value (texttt{0xffffffff}… | |
93 <li><p>texttt{reorderArrays<<<,>>>(ldots)}: Reordering… | |
94 <li><p>CUDA thread synchronization point.</p></li> | |
95 <li><p>Optional: texttt{topology<<<,>>>(ldots)}: If pa… | |
96 <li><p>CUDA thread synchronization point.</p></li> | |
97 <li><p>texttt{interact<<<,>>>(ldots)}: For each partic… | |
98 <li><p>CUDA thread synchronization point.</p></li> | |
99 <li><p>texttt{integrate<<<,>>>(ldots)}: Updating of sp… | |
100 <li><p>CUDA thread synchronization point.</p></li> | |
101 <li><p>texttt{summation<<<,>>>(ldots)}: Particle contr… | |
102 <li><p>CUDA thread synchronization point.</p></li> | |
103 <li><p>texttt{integrateWalls<<<,>>>(ldots)}: Updating … | |
104 <li><p>Update of timers and loop-related counters (e.g. texttt{time.curr… | |
105 <li><p>If file output interval is reached:</p> | |
106 <blockquote> | |
107 <div><blockquote> | |
108 <div><p>item Optional write of data to output binary (verb”<simulat… | |
109 item Update of verb”<simulation_ID>.status#..bin” (texttt{devi… | |
110 </div></blockquote> | |
111 <p>item Return to point ref{loopstart}, unless texttt{time.current >=… | |
112 </div></blockquote> | |
113 </li> | |
114 </ol> | |
115 </div></blockquote> | |
116 <ol class="arabic simple"> | |
117 <li><p>label{loopend}Liberation of device memory (texttt{device.cu}).</p… | |
118 <li><p>Control returned to texttt{main(ldots)}, liberation of host memor… | |
119 <li><p>End of program, return status equal to zero (0) if no problems wh… | |
120 </ol> | |
121 <div class="section" id="numerical-algorithm"> | |
122 <h2>Numerical algorithm<a class="headerlink" href="#numerical-algorithm"… | |
123 <p>The <em>sphere</em>-binary is launched from the system terminal by pa… | |
124 <ol class="arabic simple"> | |
125 <li><p>System check, including search for NVIDIA CUDA compatible devices… | |
126 <li><p>Initial data import from binary input file (texttt{main.cpp}).</p… | |
127 <li><p>Allocation of memory for all host variables (particles, grid, wal… | |
128 <li><p>Continued import from binary input file (texttt{main.cpp}).</p></… | |
129 <li><p>Control handed to GPU-specific function texttt{gpuMain(ldots)} (t… | |
130 <li><p>Memory allocation of device memory (texttt{device.cu}).</p></li> | |
131 <li><p>Transfer of data from host to device variables (texttt{device.cu}… | |
132 <li><p>Initialization of Thrustfootnote{url{<a class="reference external… | |
133 <li><p>Calculation of GPU workload configuration (thread and block layou… | |
134 <li><p>Status and data written to verb”<simulation_ID>.status.da… | |
135 <li><p>Main loop (while texttt{time.current <= time.total}) (function… | |
136 </ol> | |
137 <blockquote> | |
138 <div><ol class="arabic"> | |
139 <li><p>label{loopstart}CUDA thread synchronization point.</p></li> | |
140 <li><p>texttt{calcParticleCellID<<<,>>>(ldots)}: Parti… | |
141 <li><p>CUDA thread synchronization point.</p></li> | |
142 <li><p>texttt{thrust::sort_by_key(ldots)}: Thrust radix sort of particle… | |
143 <li><p>texttt{cudaMemset(ldots)}: Writing zero value (texttt{0xffffffff}… | |
144 <li><p>texttt{reorderArrays<<<,>>>(ldots)}: Reordering… | |
145 <li><p>CUDA thread synchronization point.</p></li> | |
146 <li><p>Optional: texttt{topology<<<,>>>(ldots)}: If pa… | |
147 <li><p>CUDA thread synchronization point.</p></li> | |
148 <li><p>texttt{interact<<<,>>>(ldots)}: For each partic… | |
149 <li><p>CUDA thread synchronization point.</p></li> | |
150 <li><p>texttt{integrate<<<,>>>(ldots)}: Updating of sp… | |
151 <li><p>CUDA thread synchronization point.</p></li> | |
152 <li><p>texttt{summation<<<,>>>(ldots)}: Particle contr… | |
153 <li><p>CUDA thread synchronization point.</p></li> | |
154 <li><p>texttt{integrateWalls<<<,>>>(ldots)}: Updating … | |
155 <li><p>Update of timers and loop-related counters (e.g. texttt{time.curr… | |
156 <li><p>If file output interval is reached:</p> | |
157 <blockquote> | |
158 <div><ul class="simple"> | |
159 <li><p>Optional write of data to output binary (verb”<simulation_ID… | |
160 <li><p>Update of verb”<simulation_ID>.status#..bin” (texttt{de… | |
161 </ul> | |
162 </div></blockquote> | |
163 </li> | |
164 <li><p>Return to point ref{loopstart}, unless texttt{time.current >= … | |
165 </ol> | |
166 </div></blockquote> | |
167 <ol class="arabic simple"> | |
168 <li><p>label{loopend}Liberation of device memory (texttt{device.cu}).</p… | |
169 <li><p>Control returned to texttt{main(ldots)}, liberation of host memor… | |
170 <li><p>End of program, return status equal to zero (0) if no problems wh… | |
171 </ol> | |
172 <p>The length of the computational time steps (texttt{time.dt}) is calcu… | |
173 <div class="math"> | |
174 <p><img src="_images/math/e721d97e515c11c9ef7209be37e1c98029ffdfa2.png" … | |
175 </div><p>where <img class="math" src="_images/math/e9bc7da808d33a16a8347… | |
176 The time step is set by this relationship in <code class="xref py py-fun… | |
177 This equation ensures that the elastic wave (traveling at the speed of s… | |
178 <p>subsubsection{Host and device memory types} | |
179 label{subsubsec:memorytypes} | |
180 A full, listed description of the <em>sphere</em> source code variables … | |
181 <p>The floating point precision operating internally in <em>sphere</em> … | |
182 <p>Three-dimensional variables (e.g. spatial vectors in <cite>E^3</cite>… | |
183 <p>paragraph{Host memory} is the main random-access computer memory (RAM… | |
184 <p>paragraph{Device memory} is the main, global device memory. It reside… | |
185 <p>marginpar{Todo: Expand section on device memory types}</p> | |
186 <p>paragraph{Constant memory} values cannot be changed after they are se… | |
187 <p>%subsection{The main loop} | |
188 %label{subsec:mainloop} | |
189 %The <em>sphere</em> software calculates particle movement and rotation … | |
190 <p>subsection{Performance} | |
191 marginpar{Todo: insert graph of performance vs. np and performance vs. <… | |
192 subsubsection{Particles and computational time}</p> | |
193 <p>subsection{Compilation} | |
194 label{subsec:compilation} | |
195 An important note is that the texttt{C} examples of the NVIDIA CUDA SDK … | |
196 <p><em>sphere</em> is supplied with several Makefiles, which automate th… | |
197 </div> | |
198 <div class="section" id="c-reference"> | |
199 <h2>C++ reference<a class="headerlink" href="#c-reference" title="Permal… | |
200 <dl class="class"> | |
201 <dt id="_CPPv43DEM"> | |
202 <span id="_CPPv33DEM"></span><span id="_CPPv23DEM"></span><span id="DEM"… | |
203 <dd></dd></dl> | |
204 | |
205 </div> | |
206 </div> | |
207 | |
208 | |
209 </div> | |
210 </div> | |
211 </div> | |
212 <div class="sphinxsidebar" role="navigation" aria-label="main navi… | |
213 <div class="sphinxsidebarwrapper"> | |
214 <h3><a href="index.html">Table of Contents</a></h3> | |
215 <ul> | |
216 <li><a class="reference internal" href="#">sphere internals</a><ul> | |
217 <li><a class="reference internal" href="#numerical-algorithm">Numerical … | |
218 <li><a class="reference internal" href="#c-reference">C++ reference</a><… | |
219 </ul> | |
220 </li> | |
221 </ul> | |
222 | |
223 <h4>Previous topic</h4> | |
224 <p class="topless"><a href="python_api.html" | |
225 title="previous chapter">Python API</a></p> | |
226 <div role="note" aria-label="source link"> | |
227 <h3>This Page</h3> | |
228 <ul class="this-page-menu"> | |
229 <li><a href="_sources/sphere_internals.rst.txt" | |
230 rel="nofollow">Show Source</a></li> | |
231 </ul> | |
232 </div> | |
233 <div id="searchbox" style="display: none" role="search"> | |
234 <h3 id="searchlabel">Quick search</h3> | |
235 <div class="searchformwrapper"> | |
236 <form class="search" action="search.html" method="get"> | |
237 <input type="text" name="q" aria-labelledby="searchlabel" /> | |
238 <input type="submit" value="Go" /> | |
239 </form> | |
240 </div> | |
241 </div> | |
242 <script type="text/javascript">$('#searchbox').show(0);</script> | |
243 </div> | |
244 </div> | |
245 <div class="clearer"></div> | |
246 </div> | |
247 <div class="related" role="navigation" aria-label="related navigatio… | |
248 <h3>Navigation</h3> | |
249 <ul> | |
250 <li class="right" style="margin-right: 10px"> | |
251 <a href="genindex.html" title="General Index" | |
252 >index</a></li> | |
253 <li class="right" > | |
254 <a href="py-modindex.html" title="Python Module Index" | |
255 >modules</a> |</li> | |
256 <li class="right" > | |
257 <a href="python_api.html" title="Python API" | |
258 >previous</a> |</li> | |
259 <li class="nav-item nav-item-0"><a href="index.html">sphere 2.15… | |
260 </ul> | |
261 </div> | |
262 <div class="footer" role="contentinfo"> | |
263 © Copyright 2014, Anders Damsgaard. | |
264 Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.0. | |
265 </div> | |
266 </body> | |
267 |