Skip to content

Commit

Permalink
deploy: 0572628
Browse files Browse the repository at this point in the history
  • Loading branch information
s-mayani committed Sep 25, 2024
1 parent 7a695da commit b1bd472
Show file tree
Hide file tree
Showing 7 changed files with 347 additions and 45 deletions.
206 changes: 206 additions & 0 deletions Profiling.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>IPPL (Independent Parallel Particle Layer): Profiling in IPPL</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">IPPL (Independent Parallel Particle Layer)
</div>
<div id="projectbrief">IPPL</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div><div class="header">
<div class="headertitle"><div class="title">Profiling in IPPL </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p ><a class="anchor" id="md_extras_Profiling"></a> In certain applications, you might want to use profiling tools for debugging and testing. Since IPPL uses <b><a class="el" href="namespaceKokkos.html">Kokkos</a></b> as a backend, you can leverage <a class="el" href="namespaceKokkos.html">Kokkos</a>' built-in profiling tools.</p>
<p >This guide explains how to use <a class="el" href="namespaceKokkos.html">Kokkos</a>' profiling tools, using the <b>MemoryEvents</b> tool as an example.</p>
<h2><a class="anchor" id="autotoc_md49"></a>
Description of MemoryEvents</h2>
<p >MemoryEvents tracks a timeline of allocation and deallocation events in <a class="el" href="namespaceKokkos.html">Kokkos</a> Memory Spaces. It records time, pointer, size, memory-space-name, and allocation-name. This is in particular useful for debugging purposes to understand where all the memory is going.</p>
<p >Additionally, the tool provides a timeline of memory usage for each individual <a class="el" href="namespaceKokkos.html">Kokkos</a> Memory Space.</p>
<p >The tool is located at: <a href="https://github.com/kokkos/kokkos-tools/tree/develop/profiling/memory-events">https://github.com/kokkos/kokkos-tools/tree/develop/profiling/memory-events</a></p>
<hr />
<h1><a class="anchor" id="autotoc_md51"></a>
Steps to Use Kokkos Profiling Tools</h1>
<h2><a class="anchor" id="autotoc_md52"></a>
1. Clone the Kokkos Tools Repository</h2>
<p >First, clone the <a class="el" href="namespaceKokkos.html">Kokkos</a> tools repository, which contains a variety of profiling tools: </p><div class="fragment"><div class="line">git clone https://github.com/kokkos/kokkos-tools</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md53"></a>
2. Build and Install the Tools</h2>
<p >Navigate into the repository and build the tools using CMake:</p>
<div class="fragment"><div class="line">cd kokkos-tools</div>
<div class="line">cmake ..</div>
<div class="line">make -j</div>
<div class="line">sudo make install</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md54"></a>
3. Set Up the Profiling Tool</h2>
<p >Before running your application, export the <a class="el" href="namespaceKokkos.html">Kokkos</a> Tools environment variable to point to the <code>kp_memory_events.so</code> tool: </p><div class="fragment"><div class="line">export KOKKOS_TOOLS_LIBS={PATH_TO_TOOL_DIRECTORY}/kp_memory_events.so </div>
</div><!-- fragment --><p> Replace <code>{PATH_TO_TOOL_DIRECTORY}</code> with the actual path where the tool is located.</p>
<h2><a class="anchor" id="autotoc_md55"></a>
4. Run your Application</h2>
<p >Execute your application normally. The MemoryEvents tool will automatically collect data during execution. For example:</p>
<div class="fragment"><div class="line">./application COMMANDS</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md56"></a>
5. Output Files</h2>
<p >The MemoryEvents tool will generate the following files:</p>
<ul>
<li><code>HOSTNAME-PROCESSID.mem_events:</code> Lists memory events.</li>
<li><code>HOSTNAME-PROCESSID-MEMSPACE.memspace_usage:</code> Provides a utilization timeline for each active memory space.</li>
</ul>
<h2><a class="anchor" id="autotoc_md57"></a>
6. Example on with SLURM</h2>
<p >Here’s an example of how to run the profiling with a SLURM system using <code>sbatch</code>: </p><div class="fragment"><div class="line">sbatch -n 2 --wrap=&quot;export KOKKOS_TOOLS_LIBS=$HOME/kokkos-tools/kp_memory_events.so; \</div>
<div class="line">mpirun -n 2 LandauDamping 128 128 128 10000 10 FFT 0.01 LeapFrog --overallocate 2.0 --info 10&quot;</div>
</div><!-- fragment --><p >In this example:</p>
<ul>
<li><code>sbatch -n 2</code> specifies 2 nodes.</li>
<li>The <a class="el" href="namespaceKokkos.html">Kokkos</a> tool is exported and applied to the <code>LandauDamping</code> application.</li>
</ul>
<p >This guide provides the basic steps for integrating <a class="el" href="namespaceKokkos.html">Kokkos</a> profiling tools into your IPPL-based projects. You can adjust the commands as needed depending on your specific application and environment.</p>
<h1><a class="anchor" id="autotoc_md58"></a>
Example</h1>
<p >Consider the following code:</p>
<div class="fragment"><div class="line">#include &lt;Kokkos_Core.hpp&gt;</div>
<div class="line"> </div>
<div class="line"> typedef Kokkos::View&lt;int*,Kokkos::CudaSpace&gt; a_type;</div>
<div class="line"> typedef Kokkos::View&lt;int*,Kokkos::CudaUVMSpace&gt; b_type;</div>
<div class="line"> typedef Kokkos::View&lt;int*,Kokkos::CudaHostPinnedSpace&gt; c_type;</div>
<div class="line"> </div>
<div class="line">int main() {</div>
<div class="line"> Kokkos::initialize();</div>
<div class="line"> {</div>
<div class="line"> int N = 10000000;</div>
<div class="line"> for(int i =0; i&lt;2; i++) { </div>
<div class="line"> a_type a(&quot;A&quot;,N);</div>
<div class="line"> {</div>
<div class="line"> b_type b(&quot;B&quot;,N);</div>
<div class="line"> c_type c(&quot;C&quot;,N);</div>
<div class="line"> for(int j =0; j&lt;N; j++) {</div>
<div class="line"> b(j)=2*j;</div>
<div class="line"> c(j)=3*j;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> Kokkos::finalize();</div>
<div class="line"> </div>
<div class="line">}</div>
</div><!-- fragment --><p >This will produce the following output:</p>
<p ><b>HOSTNAME-PROCESSID.mem_events</b></p>
<div class="fragment"><div class="line"># Memory Events</div>
<div class="line"># Time Ptr Size MemSpace Op Name</div>
<div class="line">0.311749 0x2048a0080 128 CudaHostPinned Allocate InternalScratchUnified</div>
<div class="line">0.311913 0x2305ca0080 2048 Cuda Allocate InternalScratchFlags</div>
<div class="line">0.312108 0x2305da0080 16384 Cuda Allocate InternalScratchSpace</div>
<div class="line">0.312667 0x23060a0080 40000000 Cuda Allocate A</div>
<div class="line">0.317260 0x23086e0080 40000000 CudaUVM Allocate B</div>
<div class="line">0.335289 0x2049a0080 40000000 CudaHostPinned Allocate C</div>
<div class="line">0.368485 0x2049a0080 -40000000 CudaHostPinned DeAllocate C</div>
<div class="line">0.377285 0x23086e0080 -40000000 CudaUVM DeAllocate B</div>
<div class="line">0.379795 0x23060a0080 -40000000 Cuda DeAllocate A</div>
<div class="line">0.380185 0x23060a0080 40000000 Cuda Allocate A</div>
<div class="line">0.384785 0x23086e0080 40000000 CudaUVM Allocate B</div>
<div class="line">0.400073 0x2049a0080 40000000 CudaHostPinned Allocate C</div>
<div class="line">0.433218 0x2049a0080 -40000000 CudaHostPinned DeAllocate C</div>
<div class="line">0.441988 0x23086e0080 -40000000 CudaUVM DeAllocate B</div>
<div class="line">0.444391 0x23060a0080 -40000000 Cuda DeAllocate A</div>
</div><!-- fragment --><p> <b>HOSTNAME-PROCESSID-Cuda.memspace_usage</b></p>
<div class="fragment"><div class="line"># Space Cuda</div>
<div class="line"># Time(s) Size(MB) HighWater(MB) HighWater-Process(MB)</div>
<div class="line">0.311913 0.0 0.0 81.8</div>
<div class="line">0.312108 0.0 0.0 81.8</div>
<div class="line">0.312667 38.2 38.2 81.8</div>
<div class="line">0.379795 0.0 38.2 158.1</div>
<div class="line">0.380185 38.2 38.2 158.1</div>
<div class="line">0.444391 0.0 38.2 158.1</div>
</div><!-- fragment --><p> <b>HOSTNAME-PROCESSID-CudaUVM.memspace_usage</b></p>
<div class="fragment"><div class="line"># Space CudaUVM</div>
<div class="line"># Time(s) Size(MB) HighWater(MB) HighWater-Process(MB)</div>
<div class="line">0.317260 38.1 38.1 81.8</div>
<div class="line">0.377285 0.0 38.1 158.1</div>
<div class="line">0.384785 38.1 38.1 158.1</div>
<div class="line">0.441988 0.0 38.1 158.1</div>
</div><!-- fragment --><p ><b>HOSTNAME-PROCESSID-CudaHostPinned.memspace_usage</b></p>
<div class="fragment"><div class="line"># Space CudaHostPinned</div>
<div class="line"># Time(s) Size(MB) HighWater(MB) HighWater-Process(MB)</div>
<div class="line">0.311749 0.0 0.0 81.8</div>
<div class="line">0.335289 38.1 38.1 120.0</div>
<div class="line">0.368485 0.0 38.1 158.1</div>
<div class="line">0.400073 38.1 38.1 158.1</div>
<div class="line">0.433218 0.0 38.1 158.1</div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
89 changes: 89 additions & 0 deletions Profiling_8md.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>IPPL (Independent Parallel Particle Layer): Profiling.md File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">IPPL (Independent Parallel Particle Layer)
</div>
<div id="projectbrief">IPPL</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">Profiling.md File Reference</div></div>
</div><!--header-->
<div class="contents">
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
1 change: 1 addition & 0 deletions menudata.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var menudata={children:[
{text:"Main Page",url:"index.html"},
{text:"Basics Usage",url:"Basics.html"},
{text:"Installation",url:"Installation.html"},
{text:"Profiling",url:"Profiling.html"},
{text:"Namespaces",url:"namespaces.html",children:[
{text:"Namespace List",url:"namespaces.html"},
{text:"Namespace Members",url:"namespacemembers.html",children:[
Expand Down
Loading

0 comments on commit b1bd472

Please sign in to comment.