mirror of
https://github.com/RustyRaptor/parallel-programming.git
synced 2026-12-03 15:55:15 -07:00
midterm
This commit is contained in:
1 parent
b412974220
commit
4c5835625d
5 files changed
+816
-215
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int main()
|
||||
{
|
||||
int a[10][10], b[10][10], mul[10][10], r, c, i, j, k;
|
||||
system("cls");
|
||||
printf("enter the number of row=");
|
||||
scanf("%d", &r);
|
||||
printf("enter the number of column=");
|
||||
scanf("%d", &c);
|
||||
printf("enter the first matrix element=\n");
|
||||
for (i = 0; i < r; i++) {
|
||||
for (j = 0; j < c; j++) {
|
||||
scanf("%d", &a[i][j]);
|
||||
}
|
||||
}
|
||||
printf("enter the second matrix element=\n");
|
||||
for (i = 0; i < r; i++) {
|
||||
for (j = 0; j < c; j++) {
|
||||
scanf("%d", &b[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
printf("multiply of the matrix=\n");
|
||||
for (i = 0; i < r; i++) {
|
||||
for (j = 0; j < c; j++) {
|
||||
mul[i][j] = 0;
|
||||
for (k = 0; k < c; k++) {
|
||||
mul[i][j] += a[i][k] * b[k][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
//for printing result
|
||||
for (i = 0; i < r; i++) {
|
||||
for (j = 0; j < c; j++) {
|
||||
printf("%d\t", mul[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
<!DOCTYPE html><html><head>
|
||||
<title>midterm</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" href="file:////home/doge/.vscode/extensions/shd101wyy.markdown-preview-enhanced-0.6.0/node_modules/@shd101wyy/mume/dependencies/katex/katex.min.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
/**
|
||||
* prism.js Github theme based on GitHub's theme.
|
||||
* @author Sam Clarke
|
||||
*/
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: #333;
|
||||
background: none;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
line-height: 1.4;
|
||||
|
||||
-moz-tab-size: 8;
|
||||
-o-tab-size: 8;
|
||||
tab-size: 8;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
padding: .8em;
|
||||
overflow: auto;
|
||||
/* border: 1px solid #ddd; */
|
||||
border-radius: 3px;
|
||||
/* background: #fff; */
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
white-space: normal;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.blockquote {
|
||||
color: #969896;
|
||||
}
|
||||
|
||||
.token.cdata {
|
||||
color: #183691;
|
||||
}
|
||||
|
||||
.token.doctype,
|
||||
.token.punctuation,
|
||||
.token.variable,
|
||||
.token.macro.property {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
.token.important,
|
||||
.token.keyword,
|
||||
.token.rule,
|
||||
.token.builtin {
|
||||
color: #a71d5d;
|
||||
}
|
||||
|
||||
.token.string,
|
||||
.token.url,
|
||||
.token.regex,
|
||||
.token.attr-value {
|
||||
color: #183691;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
.token.number,
|
||||
.token.boolean,
|
||||
.token.entity,
|
||||
.token.atrule,
|
||||
.token.constant,
|
||||
.token.symbol,
|
||||
.token.command,
|
||||
.token.code {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
.token.tag,
|
||||
.token.selector,
|
||||
.token.prolog {
|
||||
color: #63a35c;
|
||||
}
|
||||
|
||||
.token.function,
|
||||
.token.namespace,
|
||||
.token.pseudo-element,
|
||||
.token.class,
|
||||
.token.class-name,
|
||||
.token.pseudo-class,
|
||||
.token.id,
|
||||
.token.url-reference .token.variable,
|
||||
.token.attr-name {
|
||||
color: #795da3;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.token.title,
|
||||
.token.title .token.punctuation {
|
||||
font-weight: bold;
|
||||
color: #1d3e81;
|
||||
}
|
||||
|
||||
.token.list {
|
||||
color: #ed6a43;
|
||||
}
|
||||
|
||||
.token.inserted {
|
||||
background-color: #eaffea;
|
||||
color: #55a532;
|
||||
}
|
||||
|
||||
.token.deleted {
|
||||
background-color: #ffecec;
|
||||
color: #bd2c00;
|
||||
}
|
||||
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
/* JSON */
|
||||
.language-json .token.property {
|
||||
color: #183691;
|
||||
}
|
||||
|
||||
.language-markup .token.tag .token.punctuation {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* CSS */
|
||||
code.language-css,
|
||||
.language-css .token.function {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
/* YAML */
|
||||
.language-yaml .token.atrule {
|
||||
color: #63a35c;
|
||||
}
|
||||
|
||||
code.language-yaml {
|
||||
color: #183691;
|
||||
}
|
||||
|
||||
/* Ruby */
|
||||
.language-ruby .token.function {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* Markdown */
|
||||
.language-markdown .token.url {
|
||||
color: #795da3;
|
||||
}
|
||||
|
||||
/* Makefile */
|
||||
.language-makefile .token.symbol {
|
||||
color: #795da3;
|
||||
}
|
||||
|
||||
.language-makefile .token.variable {
|
||||
color: #183691;
|
||||
}
|
||||
|
||||
.language-makefile .token.builtin {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
/* Bash */
|
||||
.language-bash .token.keyword {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
/* highlight */
|
||||
pre[data-line] {
|
||||
position: relative;
|
||||
padding: 1em 0 1em 3em;
|
||||
}
|
||||
pre[data-line] .line-highlight-wrapper {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: transparent;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
pre[data-line] .line-highlight {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: inherit 0;
|
||||
margin-top: 1em;
|
||||
background: hsla(24, 20%, 50%,.08);
|
||||
background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
|
||||
pointer-events: none;
|
||||
line-height: inherit;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
pre[data-line] .line-highlight:before,
|
||||
pre[data-line] .line-highlight[data-end]:after {
|
||||
content: attr(data-start);
|
||||
position: absolute;
|
||||
top: .4em;
|
||||
left: .6em;
|
||||
min-width: 1em;
|
||||
padding: 0 .5em;
|
||||
background-color: hsla(24, 20%, 50%,.4);
|
||||
color: hsl(24, 20%, 95%);
|
||||
font: bold 65%/1.5 sans-serif;
|
||||
text-align: center;
|
||||
vertical-align: .3em;
|
||||
border-radius: 999px;
|
||||
text-shadow: none;
|
||||
box-shadow: 0 1px white;
|
||||
}
|
||||
|
||||
pre[data-line] .line-highlight[data-end]:after {
|
||||
content: attr(data-end);
|
||||
top: auto;
|
||||
bottom: .4em;
|
||||
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]Line truncated
|
||||
/* Please visit the URL below for more information: */
|
||||
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body for="html-export">
|
||||
<div class="mume markdown-preview ">
|
||||
<h1 class="mume-header" id="parallel-programming-midterm">Parallel Programming Midterm</h1>
|
||||
|
||||
<h3 class="mume-header" id="1">1</h3>
|
||||
|
||||
<h5 class="mume-header" id="q">Q</h5>
|
||||
|
||||
<ol>
|
||||
<li>Provide a clear example of how the “localize()” function works in Peril-L and why it is an important concept in parallel programming.</li>
|
||||
</ol>
|
||||
<h5 class="mume-header" id="a">A</h5>
|
||||
|
||||
<ul>
|
||||
<li><code>localize()</code> allows us to map the global memory to a local memory of a thread.</li>
|
||||
<li>This is important because we need a standard way to talk about how we distribute and access the global data accross threads without going into detail of how that's being done in pseudocode.</li>
|
||||
<li>It also allows us to think about the section of global data allocated for a thread in a relative way.
|
||||
<ul>
|
||||
<li>Such that if we give a thread the last quarter of a global array we can access that section of the array starting at 0 rather than having to compute where we are in the global array.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Here is an example of how we could use localize in Peril-L
|
||||
<ul>
|
||||
<li>This is a modified version of the example used in the book p.93.</li>
|
||||
<li>This version will also demonstrate writing to the local reference.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<pre data-role="codeBlock" data-info="c" class="language-c"><span class="token keyword">int</span> _allData_ <span class="token punctuation">[</span>n<span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token comment">// This is a global array</span>
|
||||
|
||||
<span class="token function">forall</span><span class="token punctuation">(</span> threadID <span class="token function">in</span><span class="token punctuation">(</span><span class="token number">0.</span><span class="token punctuation">.</span>P<span class="token operator">-</span>l<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token comment">// let's spawn P threads</span>
|
||||
<span class="token punctuation">{</span>
|
||||
<span class="token keyword">int</span> size<span class="token operator">=</span>n<span class="token operator">/</span>P<span class="token punctuation">;</span> <span class="token comment">// The size of the section for this thread</span>
|
||||
|
||||
<span class="token comment">// This will map the appropriate section of</span>
|
||||
<span class="token comment">// the _allData_ array based on size to the locData array. </span>
|
||||
<span class="token keyword">int</span> locData<span class="token punctuation">[</span>size<span class="token punctuation">]</span><span class="token operator">=</span><span class="token function">localize</span><span class="token punctuation">(</span>_allData_<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token comment">// This will set all the values of our chunk of the array</span>
|
||||
<span class="token comment">// to be equal to our threadID. Since this is mapped to </span>
|
||||
<span class="token comment">// the global array we can assume the global array will be</span>
|
||||
<span class="token comment">// updated because the local and global are references to</span>
|
||||
<span class="token comment">// the same location. </span>
|
||||
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator"><</span> size<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
locData<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">=</span> threadID<span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span>
|
||||
<span class="token punctuation">}</span>
|
||||
</pre><h3 class="mume-header" id="2">2</h3>
|
||||
|
||||
<h5 class="mume-header" id="q-1">Q</h5>
|
||||
|
||||
<ol start="2">
|
||||
<li>Provide a description, detailed history, and performance characteristics of the Infiniband communications infrastructure. I am interested in when the subsystem becomes saturated, what is the normal connection topology, what systems support it, studies on how it performs both as a bench requirement as well as how well it performs with real applications. You need to have more than 3 references.</li>
|
||||
</ol>
|
||||
<h5 class="mume-header" id="a-1">A</h5>
|
||||
|
||||
<ul>
|
||||
<li>The Infiniband Trade Association started when two competing ideas, Future I/O and Next Generation I/O merged in 1999 [1]</li>
|
||||
<li></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>References
|
||||
<ol>
|
||||
<li><a href="https://www.eetimes.com/warring-ngio-and-future-i-o-groups-to-merge/">https://www.eetimes.com/warring-ngio-and-future-i-o-groups-to-merge/</a></li>
|
||||
<li></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ul>
|
||||
<h3 class="mume-header" id="3">3</h3>
|
||||
|
||||
<h5 class="mume-header" id="q-2">Q</h5>
|
||||
|
||||
<ol start="3">
|
||||
<li>What are the differences between Speedup and<br>
|
||||
Relative Speedup. Convince me that you<br>
|
||||
understand why we have the two terms.</li>
|
||||
</ol>
|
||||
<h5 class="mume-header" id="a-2">A</h5>
|
||||
|
||||
<ul>
|
||||
<li>Speedup tells us the difference in performance between the Parallel computation using <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>P</mi></mrow><annotation encoding="application/x-tex">P</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span></span></span></span> processors and the best serial computation <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">T_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.83333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">T</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.13889em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>.</li>
|
||||
<li>Relative Speedup on the other hand doesn't use the performance of the serial program <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">T_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.83333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">T</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.13889em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span> but rather the performance of the parallel program with only one Process/Thread so it compares the parallel code when <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>P</mi><mo>=</mo><mn>1</mn></mrow><annotation encoding="application/x-tex">P=1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span></span></span></span> vs when we add more processors.</li>
|
||||
<li>The reason we have these separate terms is because the overhead of setting up a parallel program will mean that using 1 processor in a parallel version will be different from running it in serial sometimes.</li>
|
||||
<li>Another reason is that Relative Speedup allows us to analyze how the parallel code scales up starting with one process.</li>
|
||||
</ul>
|
||||
<h3 class="mume-header" id="4">4</h3>
|
||||
|
||||
<h5 class="mume-header" id="q-3">Q</h5>
|
||||
|
||||
<ol start="4">
|
||||
<li>Define and explain “efficiency” as it applies to parallel computing. Is it possible to have an efficiency greater than 1? If so, give examples. If not, state why not.</li>
|
||||
</ol>
|
||||
<h5 class="mume-header" id="a-3">A</h5>
|
||||
|
||||
<ul>
|
||||
<li><strong>Efficiency</strong> is defined as the <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>p</mi><mi>e</mi><mi>e</mi><mi>d</mi><mi>u</mi><mi>p</mi><mi mathvariant="normal">/</mi><mi>P</mi></mrow><annotation encoding="application/x-tex">speedup / P</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">p</span><span class="mord mathnormal">ee</span><span class="mord mathnormal">d</span><span class="mord mathnormal">u</span><span class="mord mathnormal">p</span><span class="mord">/</span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span></span></span></span> where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>P</mi></mrow><annotation encoding="application/x-tex">P</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span></span></span></span> is the number of processors used and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>p</mi><mi>e</mi><mi>e</mi><mi>d</mi><mi>u</mi><mi>p</mi></mrow><annotation encoding="application/x-tex">speedup</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">p</span><span class="mord mathnormal">ee</span><span class="mord mathnormal">d</span><span class="mord mathnormal">u</span><span class="mord mathnormal">p</span></span></span></span> is the improvement in performance from the serial algorithm to the parallel algorithm.</li>
|
||||
<li>Because speedup is based on the serial time divided by the parallel time we can only expect to get something higher than 1 if the serial time is significantly higher than the parallel time.</li>
|
||||
<li>This can happen if the serial time is artificially inflated whether on accident or on purpose.</li>
|
||||
<li>It can also happen in rare cases like Program 1 in the book when all the memory needed by the processes can fit into the cache of the processors and so the parallel code has more efficient memory access.</li>
|
||||
</ul>
|
||||
<h3 class="mume-header" id="5">5</h3>
|
||||
|
||||
<h5 class="mume-header" id="q-4">Q</h5>
|
||||
|
||||
<h5 class="mume-header" id="a-4">A</h5>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
@@ -0,0 +1,85 @@
|
||||
# Parallel Programming Midterm
|
||||
|
||||
### 1
|
||||
|
||||
##### Q
|
||||
1) Provide a clear example of how the “localize()” function works in Peril-L and why it is an important concept in parallel programming.
|
||||
|
||||
##### A
|
||||
|
||||
- `localize()` allows us to map the global memory to a local memory of a thread.
|
||||
- This is important because we need a standard way to talk about how we distribute and access the global data accross threads without going into detail of how that's being done in pseudocode.
|
||||
- It also allows us to think about the section of global data allocated for a thread in a relative way.
|
||||
- Such that if we give a thread the last quarter of a global array we can access that section of the array starting at 0 rather than having to compute where we are in the global array.
|
||||
- Here is an example of how we could use localize in Peril-L
|
||||
- This is a modified version of the example used in the book p.93.
|
||||
- This version will also demonstrate writing to the local reference.
|
||||
|
||||
```c
|
||||
int _allData_ [n]; // This is a global array
|
||||
|
||||
forall( threadID in(0..P-l)) // let's spawn P threads
|
||||
{
|
||||
int size=n/P; // The size of the section for this thread
|
||||
|
||||
// This will map the appropriate section of
|
||||
// the _allData_ array based on size to the locData array.
|
||||
int locData[size]=localize(_allData_[]);
|
||||
|
||||
// This will set all the values of our chunk of the array
|
||||
// to be equal to our threadID. Since this is mapped to
|
||||
// the global array we can assume the global array will be
|
||||
// updated because the local and global are references to
|
||||
// the same location.
|
||||
for (int i = 0; i < size; i++) {
|
||||
locData[i] = threadID;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2
|
||||
|
||||
##### Q
|
||||
2) Provide a description, detailed history, and performance characteristics of the Infiniband communications infrastructure. I am interested in when the subsystem becomes saturated, what is the normal connection topology, what systems support it, studies on how it performs both as a bench requirement as well as how well it performs with real applications. You need to have more than 3 references.
|
||||
|
||||
##### A
|
||||
|
||||
- The Infiniband Trade Association started when two competing ideas, Future I/O and Next Generation I/O merged in 1999 [1]
|
||||
-
|
||||
|
||||
|
||||
- References
|
||||
1. https://www.eetimes.com/warring-ngio-and-future-i-o-groups-to-merge/
|
||||
2.
|
||||
|
||||
### 3
|
||||
|
||||
##### Q
|
||||
3) What are the differences between Speedup and
|
||||
Relative Speedup. Convince me that you
|
||||
understand why we have the two terms.
|
||||
|
||||
##### A
|
||||
|
||||
- Speedup tells us the difference in performance between the Parallel computation using $P$ processors and the best serial computation $T_s$.
|
||||
- Relative Speedup on the other hand doesn't use the performance of the serial program $T_s$ but rather the performance of the parallel program with only one Process/Thread so it compares the parallel code when $P=1$ vs when we add more processors.
|
||||
- The reason we have these separate terms is because the overhead of setting up a parallel program will mean that using 1 processor in a parallel version will be different from running it in serial sometimes.
|
||||
- Another reason is that Relative Speedup allows us to analyze how the parallel code scales up starting with one process.
|
||||
|
||||
### 4
|
||||
|
||||
##### Q
|
||||
4) Define and explain “efficiency” as it applies to parallel computing. Is it possible to have an efficiency greater than 1? If so, give examples. If not, state why not.
|
||||
##### A
|
||||
- **Efficiency** is defined as the $speedup / P$ where $P$ is the number of processors used and $speedup$ is the improvement in performance from the serial algorithm to the parallel algorithm.
|
||||
- Because speedup is based on the serial time divided by the parallel time we can only expect to get something higher than 1 if the serial time is significantly higher than the parallel time.
|
||||
- This can happen if the serial time is artificially inflated whether on accident or on purpose.
|
||||
- It can also happen in rare cases like Program 1 in the book when all the memory needed by the processes can fit into the cache of the processors and so the parallel code has more efficient memory access.
|
||||
|
||||
### 5
|
||||
|
||||
##### Q
|
||||
|
||||
|
||||
|
||||
##### A
|
||||
+294
-211
@@ -3,191 +3,254 @@
|
||||
##### 1 Thread
|
||||
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> make
|
||||
gcc -O0 -Wall -Werror -Wextra -pedantic -pthread -lpthread -o padded padded.c
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 1
|
||||
Time parallel: 79589173
|
||||
Time serial: 76582925
|
||||
parallel count is 2499295
|
||||
serial count is 2499295
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 1
|
||||
Time parallel: 77817021
|
||||
Time serial: 76191186
|
||||
parallel count is 2501600
|
||||
serial count is 2501600
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 1
|
||||
Time parallel: 78369396
|
||||
Time serial: 76075458
|
||||
parallel count is 2501212
|
||||
serial count is 2501212
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 1
|
||||
Time parallel: 77878131
|
||||
Time serial: 75789878
|
||||
parallel count is 2497788
|
||||
serial count is 2497788
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 1
|
||||
Time parallel: 78617891
|
||||
Time serial: 76074550
|
||||
parallel count is 2499979
|
||||
serial count is 2499979
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> make clean
|
||||
rm -rf padded_shm
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> make
|
||||
gcc -O0 -Wall -Werror -Wextra -pedantic -pthread -o padded_shm padded_shm.c
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 1
|
||||
Time process: 31300629
|
||||
Time thread: 27381486
|
||||
Time serial: 38851311
|
||||
process count is 2500157
|
||||
thread count is 2500157
|
||||
serial count is 2500157
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 1
|
||||
Time process: 30117308
|
||||
Time thread: 28445308
|
||||
Time serial: 38232656
|
||||
process count is 2498865
|
||||
thread count is 2498865
|
||||
serial count is 2498865
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 1
|
||||
Time process: 33679214
|
||||
Time thread: 27455518
|
||||
Time serial: 38993926
|
||||
process count is 2498865
|
||||
thread count is 2498865
|
||||
serial count is 2498865
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 1
|
||||
Time process: 36710465
|
||||
Time thread: 27729854
|
||||
Time serial: 38804797
|
||||
process count is 2501939
|
||||
thread count is 2501939
|
||||
serial count is 2501939
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 1
|
||||
Time process: 31838897
|
||||
Time thread: 28574026
|
||||
Time serial: 38197665
|
||||
process count is 2501939
|
||||
thread count is 2501939
|
||||
serial count is 2501939
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
```
|
||||
|
||||
##### 2 Threads
|
||||
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 2
|
||||
Time parallel: 39898720
|
||||
Time serial: 76881427
|
||||
parallel count is 2498665
|
||||
serial count is 2498665
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 2
|
||||
Time parallel: 38993717
|
||||
Time serial: 75975306
|
||||
parallel count is 2498665
|
||||
serial count is 2498665
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 2
|
||||
Time parallel: 43756962
|
||||
Time serial: 75922017
|
||||
parallel count is 2499470
|
||||
serial count is 2499470
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 2
|
||||
Time parallel: 39628155
|
||||
Time serial: 75874106
|
||||
parallel count is 2499470
|
||||
serial count is 2499470
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 2
|
||||
Time parallel: 38768479
|
||||
Time serial: 83936863
|
||||
parallel count is 2499249
|
||||
serial count is 2499249
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 2
|
||||
Time process: 19765293
|
||||
Time thread: 14919286
|
||||
Time serial: 38001761
|
||||
process count is 2500756
|
||||
thread count is 2500756
|
||||
serial count is 2500756
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 2
|
||||
Time process: 16166721
|
||||
Time thread: 17203375
|
||||
Time serial: 39284676
|
||||
process count is 2500756
|
||||
thread count is 2500756
|
||||
serial count is 2500756
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 2
|
||||
Time process: 19934239
|
||||
Time thread: 17330976
|
||||
Time serial: 38693330
|
||||
process count is 2501132
|
||||
thread count is 2501132
|
||||
serial count is 2501132
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 2
|
||||
Time process: 18905617
|
||||
Time thread: 16755903
|
||||
Time serial: 39231666
|
||||
process count is 2501132
|
||||
thread count is 2501132
|
||||
serial count is 2501132
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 2
|
||||
Time process: 16863108
|
||||
Time thread: 14817806
|
||||
Time serial: 38020199
|
||||
process count is 2495477
|
||||
thread count is 2495477
|
||||
serial count is 2495477
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
|
||||
|
||||
```
|
||||
|
||||
##### 4 Threads
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 4
|
||||
Time parallel: 20135731
|
||||
Time serial: 76379757
|
||||
parallel count is 2500818
|
||||
serial count is 2500818
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 4
|
||||
Time parallel: 20184131
|
||||
Time serial: 76066309
|
||||
parallel count is 2500619
|
||||
serial count is 2500619
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 4
|
||||
Time parallel: 20012671
|
||||
Time serial: 76159618
|
||||
parallel count is 2500619
|
||||
serial count is 2500619
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 4
|
||||
Time parallel: 20407135
|
||||
Time serial: 76091592
|
||||
parallel count is 2501896
|
||||
serial count is 2501896
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 4
|
||||
Time parallel: 19932075
|
||||
Time serial: 75735192
|
||||
parallel count is 2501896
|
||||
serial count is 2501896
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 4
|
||||
Time process: 11948587
|
||||
Time thread: 9570700
|
||||
Time serial: 39345088
|
||||
process count is 2500645
|
||||
thread count is 2500645
|
||||
serial count is 2500645
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 4
|
||||
Time process: 11596517
|
||||
Time thread: 9400218
|
||||
Time serial: 38839228
|
||||
process count is 2502182
|
||||
thread count is 2502182
|
||||
serial count is 2502182
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 4
|
||||
Time process: 12134085
|
||||
Time thread: 9552821
|
||||
Time serial: 39723767
|
||||
process count is 2502182
|
||||
thread count is 2502182
|
||||
serial count is 2502182
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 4
|
||||
Time process: 11011317
|
||||
Time thread: 8547107
|
||||
Time serial: 38454333
|
||||
process count is 2502182
|
||||
thread count is 2502182
|
||||
serial count is 2502182
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 4
|
||||
Time process: 11576543
|
||||
Time thread: 9165971
|
||||
Time serial: 39198422
|
||||
process count is 2496859
|
||||
thread count is 2496859
|
||||
serial count is 2496859
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
|
||||
|
||||
```
|
||||
|
||||
##### 8 Threads
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 8
|
||||
Time parallel: 10802910
|
||||
Time serial: 76379477
|
||||
parallel count is 2499488
|
||||
serial count is 2499488
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 8
|
||||
Time parallel: 10938262
|
||||
Time serial: 75819630
|
||||
parallel count is 2499488
|
||||
serial count is 2499488
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 8
|
||||
Time parallel: 10780422
|
||||
Time serial: 75986271
|
||||
parallel count is 2499970
|
||||
serial count is 2499970
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 8
|
||||
Time parallel: 10738028
|
||||
Time serial: 75738055
|
||||
parallel count is 2499970
|
||||
serial count is 2499970
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 8
|
||||
Time parallel: 10694446
|
||||
Time serial: 76413770
|
||||
parallel count is 2498866
|
||||
serial count is 2498866
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 8
|
||||
Time process: 11371838
|
||||
Time thread: 12433425
|
||||
Time serial: 39216161
|
||||
process count is 2503298
|
||||
thread count is 2503298
|
||||
serial count is 2503298
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 8
|
||||
Time process: 10912631
|
||||
Time thread: 7882986
|
||||
Time serial: 38051697
|
||||
process count is 2503298
|
||||
thread count is 2503298
|
||||
serial count is 2503298
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 8
|
||||
Time process: 11806390
|
||||
Time thread: 8301336
|
||||
Time serial: 38027532
|
||||
process count is 2498370
|
||||
thread count is 2498370
|
||||
serial count is 2498370
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 8
|
||||
Time process: 11366879
|
||||
Time thread: 8129595
|
||||
Time serial: 39016136
|
||||
process count is 2498370
|
||||
thread count is 2498370
|
||||
serial count is 2498370
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 8
|
||||
Time process: 11057761
|
||||
Time thread: 7882287
|
||||
Time serial: 39576961
|
||||
process count is 2500216
|
||||
thread count is 2500216
|
||||
serial count is 2500216
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
|
||||
```
|
||||
|
||||
##### 16 Threads
|
||||
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 16
|
||||
Time parallel: 15428848
|
||||
Time serial: 76461611
|
||||
parallel count is 2499356
|
||||
serial count is 2499356
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 16
|
||||
Time parallel: 10718332
|
||||
Time serial: 76038093
|
||||
parallel count is 2497083
|
||||
serial count is 2497083
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 16
|
||||
Time parallel: 11129069
|
||||
Time serial: 76266824
|
||||
parallel count is 2497083
|
||||
serial count is 2497083
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 16
|
||||
Time parallel: 12962264
|
||||
Time serial: 76701516
|
||||
parallel count is 2500337
|
||||
serial count is 2500337
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 16
|
||||
Time parallel: 12169984
|
||||
Time serial: 76016583
|
||||
parallel count is 2500337
|
||||
serial count is 2500337
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 16
|
||||
Time process: 11814072
|
||||
Time thread: 6241576
|
||||
Time serial: 38765056
|
||||
process count is 2497673
|
||||
thread count is 2497673
|
||||
serial count is 2497673
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 16
|
||||
Time process: 9966212
|
||||
Time thread: 6230471
|
||||
Time serial: 38180415
|
||||
process count is 2500316
|
||||
thread count is 2500316
|
||||
serial count is 2500316
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 16
|
||||
Time process: 9616237
|
||||
Time thread: 6556700
|
||||
Time serial: 37949799
|
||||
process count is 2500316
|
||||
thread count is 2500316
|
||||
serial count is 2500316
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 16
|
||||
Time process: 9161779
|
||||
Time thread: 5917163
|
||||
Time serial: 38628656
|
||||
process count is 2499673
|
||||
thread count is 2499673
|
||||
serial count is 2499673
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 16
|
||||
Time process: 10823443
|
||||
Time thread: 7500745
|
||||
Time serial: 38676428
|
||||
process count is 2499673
|
||||
thread count is 2499673
|
||||
serial count is 2499673
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
```
|
||||
|
||||
##### 32 Threads
|
||||
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 32
|
||||
Time parallel: 13191343
|
||||
Time serial: 76977528
|
||||
parallel count is 2501573
|
||||
serial count is 2501573
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 32
|
||||
Time parallel: 11433019
|
||||
Time serial: 75182119
|
||||
parallel count is 2499230
|
||||
serial count is 2499230
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 32
|
||||
Time parallel: 11259742
|
||||
Time serial: 76361110
|
||||
parallel count is 2499230
|
||||
serial count is 2499230
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 32
|
||||
Time parallel: 13108860
|
||||
Time serial: 76463636
|
||||
parallel count is 2497643
|
||||
serial count is 2497643
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 32
|
||||
Time parallel: 12005927
|
||||
Time serial: 76738602
|
||||
parallel count is 2500608
|
||||
serial count is 2500608
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 32
|
||||
Time process: 12711114
|
||||
Time thread: 6997469
|
||||
Time serial: 38191590
|
||||
process count is 2500219
|
||||
thread count is 2500219
|
||||
serial count is 2500219
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 32
|
||||
Time process: 11968282
|
||||
Time thread: 6127246
|
||||
Time serial: 38613780
|
||||
process count is 2501608
|
||||
thread count is 2501608
|
||||
serial count is 2501608
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 32
|
||||
Time process: 11430993
|
||||
Time thread: 5560414
|
||||
Time serial: 37915367
|
||||
process count is 2501608
|
||||
thread count is 2501608
|
||||
serial count is 2501608
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 32
|
||||
Time process: 14200340
|
||||
Time thread: 6254566
|
||||
Time serial: 37790770
|
||||
process count is 2499008
|
||||
thread count is 2499008
|
||||
serial count is 2499008
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 32
|
||||
Time process: 12473234
|
||||
Time thread: 5559227
|
||||
Time serial: 38884904
|
||||
process count is 2499008
|
||||
thread count is 2499008
|
||||
serial count is 2499008
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
|
||||
|
||||
|
||||
@@ -196,62 +259,82 @@ doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
##### 64 Threads
|
||||
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 64
|
||||
Time parallel: 13443889
|
||||
Time serial: 75998703
|
||||
parallel count is 2501406
|
||||
serial count is 2501406
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 64
|
||||
Time parallel: 13066536
|
||||
Time serial: 80285631
|
||||
parallel count is 2498365
|
||||
serial count is 2498365
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 64
|
||||
Time parallel: 12961145
|
||||
Time serial: 76057230
|
||||
parallel count is 2497858
|
||||
serial count is 2497858
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 64
|
||||
Time parallel: 13297153
|
||||
Time serial: 76248665
|
||||
parallel count is 2497858
|
||||
serial count is 2497858
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 64
|
||||
Time parallel: 12780816
|
||||
Time serial: 75720945
|
||||
parallel count is 2500354
|
||||
serial count is 2500354
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 64
|
||||
Time process: 24745535
|
||||
Time thread: 6127106
|
||||
Time serial: 38006859
|
||||
process count is 2497175
|
||||
thread count is 2497175
|
||||
serial count is 2497175
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 64
|
||||
Time process: 28722368
|
||||
Time thread: 7104116
|
||||
Time serial: 37991215
|
||||
process count is 2497175
|
||||
thread count is 2497175
|
||||
serial count is 2497175
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 64
|
||||
Time process: 21233986
|
||||
Time thread: 8111716
|
||||
Time serial: 38107081
|
||||
process count is 2500353
|
||||
thread count is 2500353
|
||||
serial count is 2500353
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 64
|
||||
Time process: 22752056
|
||||
Time thread: 6638275
|
||||
Time serial: 38377438
|
||||
process count is 2500353
|
||||
thread count is 2500353
|
||||
serial count is 2500353
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 64
|
||||
Time process: 23279567
|
||||
Time thread: 7179544
|
||||
Time serial: 38014053
|
||||
process count is 2500353
|
||||
thread count is 2500353
|
||||
serial count is 2500353
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
```
|
||||
|
||||
##### 128 Threads
|
||||
|
||||
```bash
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 128
|
||||
Time parallel: 14702009
|
||||
Time serial: 75864468
|
||||
parallel count is 2497320
|
||||
serial count is 2497320
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 128
|
||||
Time parallel: 15708353
|
||||
Time serial: 76406018
|
||||
parallel count is 2497320
|
||||
serial count is 2497320
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 128
|
||||
Time parallel: 14599762
|
||||
Time serial: 76125185
|
||||
parallel count is 2499108
|
||||
serial count is 2499108
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 128
|
||||
Time parallel: 18146093
|
||||
Time serial: 76192373
|
||||
parallel count is 2496782
|
||||
serial count is 2496782
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)> ./padded 10000000 128
|
||||
Time parallel: 15152136
|
||||
Time serial: 76688875
|
||||
parallel count is 2496782
|
||||
serial count is 2496782
|
||||
doge@godemperordoge1998 ~/D/p/padded (main)>
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 128
|
||||
Time process: 39314847
|
||||
Time thread: 7729894
|
||||
Time serial: 38421158
|
||||
process count is 2497777
|
||||
thread count is 2497777
|
||||
serial count is 2497777
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 128
|
||||
Time process: 50211345
|
||||
Time thread: 6592179
|
||||
Time serial: 38824352
|
||||
process count is 2497777
|
||||
thread count is 2497777
|
||||
serial count is 2497777
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 128
|
||||
Time process: 48485636
|
||||
Time thread: 7374960
|
||||
Time serial: 37748656
|
||||
process count is 2500180
|
||||
thread count is 2500180
|
||||
serial count is 2500180
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 128
|
||||
Time process: 49846494
|
||||
Time thread: 6228096
|
||||
Time serial: 37988352
|
||||
process count is 2500180
|
||||
thread count is 2500180
|
||||
serial count is 2500180
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)> ./padded_shm 10000000 128
|
||||
Time process: 40951717
|
||||
Time thread: 7092033
|
||||
Time serial: 38300263
|
||||
process count is 2500334
|
||||
thread count is 2500334
|
||||
serial count is 2500334
|
||||
doge@godemperordoge1998 ~/D/p/P/padded_shm (main)>
|
||||
|
||||
```
|
||||
+15
-4
@@ -7,9 +7,11 @@ times of the runs. outs.txt must contain the raw console outputs
|
||||
from statistics import mean
|
||||
par = []
|
||||
ser = []
|
||||
pro = []
|
||||
|
||||
avgp = []
|
||||
avgs = []
|
||||
avgpr = []
|
||||
|
||||
threads = 0
|
||||
vals = 0
|
||||
@@ -22,18 +24,27 @@ with open('./outs.txt') as reader:
|
||||
if vals == 5:
|
||||
avgp.append(mean(par))
|
||||
avgs.append(mean(ser))
|
||||
avgpr.append(mean(pro))
|
||||
par=[]
|
||||
ser=[]
|
||||
pro = []
|
||||
vals = 0
|
||||
threads += 1
|
||||
word = line.split(' ')
|
||||
if 'parallel:' in word:
|
||||
par.append(int(word[2]))
|
||||
if 'process:' in word:
|
||||
pro.append(int(word[2]))
|
||||
# print(word)
|
||||
if 'thread:' in word:
|
||||
par.append(int(word[3]))
|
||||
# print(word)
|
||||
if 'serial:' in word:
|
||||
ser.append(int(word[4]))
|
||||
# print(word)
|
||||
ser.append(int(word[3]))
|
||||
vals += 1
|
||||
|
||||
|
||||
|
||||
print("ser: ", avgs, "par: ", avgp, threads)
|
||||
print("ser: ", avgs, "par: ", avgp, "pro: ", avgpr, "threads: ", threads)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user