Project-4/docs/index.html
2023-12-04 22:23:30 +01:00

274 lines
14 KiB
HTML

<!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.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>2 Dimensional Ising Model: Ising Model</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.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">2 Dimensional Ising Model
</div>
<div id="projectbrief">Simulate the change in energy and magnetization in a ferro magnet</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<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>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('index.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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><div class="header">
<div class="headertitle"><div class="title">Ising Model </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="md_README"></a> <a href="https://github.uio.no/FYS3150-G2-2023/Project-4">Repo</a></p>
<p><a href="https://pages.github.uio.no/FYS3150-G2-2023/Project-4/">Documentation</a></p>
<h1><a class="anchor" id="autotoc_md1"></a>
Requirements</h1>
<h2><a class="anchor" id="autotoc_md2"></a>
Operating systems</h2>
<ul>
<li>Linux<ul>
<li>Has been tested on <a href="https://fedoraproject.org/">Fedora 38</a></li>
<li>Will most likely work on other Linux distributions</li>
</ul>
</li>
<li>MacOS<ul>
<li>Might work, but hasn't been tested</li>
</ul>
</li>
<li>Windows<ul>
<li>Will most likely not work</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md3"></a>
Tools</h2>
<ul>
<li>Profiling<ul>
<li><a href="https://www.vi-hps.org/projects/score-p">score-p</a></li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md4"></a>
Libraries</h2>
<ul>
<li>Python<ul>
<li><a href="https://matplotlib.org/">matplotlib</a></li>
<li><a href="https://numpy.org/">numpy</a></li>
</ul>
</li>
<li>C++<ul>
<li><a href="https://www.openmp.org/">Openmp</a></li>
<li><a href="https://www.open-mpi.org/">OpenMPI</a></li>
<li><a href="https://arma.sourceforge.net/">Armadillo</a></li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md5"></a>
Compiling</h1>
<p>The commands shown here should be run from the root of this project.</p>
<h2><a class="anchor" id="autotoc_md6"></a>
Normal binaries</h2>
<p>Compiling regular binaries is as easy as running this command:</p>
<div class="fragment"><div class="line">make</div>
</div><!-- fragment --><p>The binaries will then be inside the **./bin** directory.</p>
<h2><a class="anchor" id="autotoc_md7"></a>
Profiling binaries</h2>
<p>If you want to profile the programs (specifically the MPI program), then run this command</p>
<div class="fragment"><div class="line">make profile</div>
</div><!-- fragment --><p>The binaries will then be inside the **./prof** directory.</p>
<h2><a class="anchor" id="autotoc_md8"></a>
Debugging binaries</h2>
<p>If you want to debug the code, then use this command:</p>
<div class="fragment"><div class="line">make debug</div>
</div><!-- fragment --><p>The binaries will then be inside the **./debug** directory.</p>
<h1><a class="anchor" id="autotoc_md9"></a>
Running programs</h1>
<h2><a class="anchor" id="autotoc_md10"></a>
C++ binaries</h2>
<p>To run any of the programs, just use the following command:</p>
<div class="fragment"><div class="line">./&lt;bin|prof|debug&gt;/&lt;program-name&gt; &lt;args&gt;</div>
</div><!-- fragment --><p>If you need help with any of the programs, you can use the <b>-h</b> or <b>&ndash;help</b> flag to show you how to use the programs. Here is an example:</p>
<div class="fragment"><div class="line">./bin/main --help</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md11"></a>
Python scripts</h2>
<h3><a class="anchor" id="autotoc_md12"></a>
Install libraries</h3>
<p>Before running the scripts, make sure that all libraries are installed. Using pip, you can install all requirements like this:</p>
<div class="fragment"><div class="line">pip install -r requirements.txt</div>
</div><!-- fragment --><p>This recursively install all the packages that are listed in <b>requirements.txt</b>.</p>
<h3><a class="anchor" id="autotoc_md13"></a>
Running scripts</h3>
<p>For the Python scripts, run them from the root of the project:</p>
<div class="fragment"><div class="line">python python_scripts/&lt;script-name&gt;</div>
</div><!-- fragment --><p>If you have any problems running the scripts, you might have to run this instead:</p>
<div class="fragment"><div class="line">python3 python_scripts/&lt;script-name&gt;</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md14"></a>
Batch system</h2>
<p>For the <b>phase_transition_mpi</b> program, there are scripts in the **./slurm_scripts** directory that come along with it. This is to be able to run it on a batch system using Slurm if you have access to one. The only program that should be executed by the user is the **./slurm_scripts/execute.script** script. You can see how to use this script by doing:</p>
<div class="fragment"><div class="line">./slurm_scripts/execute.script --help</div>
</div><!-- fragment --><p>This is the recommended way to use this program as it takes approximately 90 minutes to complete when using 8 processes where each process has 10 threads.</p>
<p>If you happen to have such a system available to you, then you should clone this repo on that system, then compile the MPI program like this:</p>
<div class="fragment"><div class="line">make bin/phase_transition_mpi</div>
</div><!-- fragment --><p>After compiling, you can schedule it by using the **./slurm_scripts/execute.script**:</p>
<div class="fragment"><div class="line">./slurm_scripts/execute.script &lt;parameters&gt;</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md15"></a>
Performance</h1>
<p>This section aims to give an idea to the time it takes for the phase transition program to run so that you know a bit what to expect if you decide to run it for yourself.</p>
<h2><a class="anchor" id="autotoc_md16"></a>
CPU</h2>
<p>The times mentioned here are times achieved on a computer with these specifications:</p>
<ul>
<li>CPU model<ul>
<li>Intel i7-9850H</li>
</ul>
</li>
<li>Threads<ul>
<li>12</li>
</ul>
</li>
<li>Clock speed<ul>
<li>4.6GHz</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md17"></a>
Times</h2>
<p>Note that all times here are recorded using the OpenMP implementation of the MCMC algorithm.</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">lattice size </th><th class="markdownTableHeadNone">points </th><th class="markdownTableHeadNone">samples </th><th class="markdownTableHeadNone">burn-in time </th><th class="markdownTableHeadNone">time (seconds) </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">3.20 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">40 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">6.17 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">80 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">12.11 </td></tr>
</table>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">lattice size </th><th class="markdownTableHeadNone">points </th><th class="markdownTableHeadNone">samples </th><th class="markdownTableHeadNone">burn-in time </th><th class="markdownTableHeadNone">time (seconds) </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">3.20 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">40 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">11.91 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">80 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">47.88 </td></tr>
</table>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">lattice size </th><th class="markdownTableHeadNone">points </th><th class="markdownTableHeadNone">samples </th><th class="markdownTableHeadNone">burn-in time </th><th class="markdownTableHeadNone">time (seconds) </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">3.20 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">1000000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">29.95 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">10000000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">305.849 </td></tr>
</table>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">lattice size </th><th class="markdownTableHeadNone">points </th><th class="markdownTableHeadNone">samples </th><th class="markdownTableHeadNone">burn-in time </th><th class="markdownTableHeadNone">time (seconds) </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">3.20 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">5000 </td><td class="markdownTableBodyNone">4.93 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">100000 </td><td class="markdownTableBodyNone">10000 </td><td class="markdownTableBodyNone">6.58 </td></tr>
</table>
<p>We can see that changing the number of points, samples and burn-in time changes the time in a linear fashion, while changing the size of the lattice changes the time in a square fashion.</p>
<h1><a class="anchor" id="autotoc_md18"></a>
Credits</h1>
<p>The Doxygen theme used here is <a href="https://github.com/jothepro/doxygen-awesome-css">doxygen-awesome-css</a>. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>