<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>rendra.net. &#187; 2005 &#187; May &#187; 11</title>
	<atom:link href="http://rendra.net/2005/05/11/feed/" rel="self" type="application/rss+xml" />
	<link>http://rendra.net</link>
	<description>Do One Thing, Do It Well</description>
	<pubDate>Sat, 01 Nov 2008 16:27:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Tugas Kuliah Pemrosesan Paralel</title>
		<link>http://rendra.net/2005/05/11/tugas-kuliah-pemrosesan-paralel/</link>
		<comments>http://rendra.net/2005/05/11/tugas-kuliah-pemrosesan-paralel/#comments</comments>
		<pubDate>Wed, 11 May 2005 16:54:03 +0000</pubDate>
		<dc:creator>Rendra</dc:creator>
		
		<category><![CDATA[Kuliah]]></category>

		<category><![CDATA[Lain-Lain]]></category>

		<guid isPermaLink="false">http://rendra.blogdns.com/?p=3</guid>
		<description><![CDATA[Tadi saya sudah mengumpulkan tugas ini :
// Nama : Muhamad Rendra
// NRP : G6410xxxx
// Perkalian Matriks Dengan Collective Communication

#include &#60;stdio.h&#62;
#include &#60;mpi.h&#62;

int main (int argc, char **argv)
{
  int size, my_rank, i , m[16],a[4],b[4], hasil ;

  MPI_Init(&#38;argc,&#38;argv);
  MPI_Comm_size (MPI_COMM_WORLD, &#38;size);
  MPI_Comm_rank (MPI_COMM_WORLD, &#38;my_rank);

  if (size != 4)
  {
    [...]]]></description>
			<content:encoded><![CDATA[<p>Tadi saya sudah mengumpulkan tugas ini :</p>
<pre>// Nama : Muhamad Rendra
// NRP : G6410xxxx
// Perkalian Matriks Dengan Collective Communication

#include &lt;stdio.h&gt;
#include &lt;mpi.h&gt;</pre>
<p><span id="more-3"></span></p>
<pre>int main (int argc, char **argv)
{
  int size, my_rank, i , m[16],a[4],b[4], hasil ;

  MPI_Init(&amp;argc,&amp;argv);
  MPI_Comm_size (MPI_COMM_WORLD, &amp;size);
  MPI_Comm_rank (MPI_COMM_WORLD, &amp;my_rank);

  if (size != 4)
  {
    if(my_rank == 0)printf(&quot;Error : Jumlah proses harus 4\n&#038;quot<img src='http://rendra.net/wrdp/smilies/yahoo_wink.gif' alt='&#59;&#41;' class='wp-smiley' width='18' height='18' title='&#59;&#41;' />;
      MPI_Finalize();
    return 0;
  }

  if (my_rank == 0)
    for (i = 0;i&lt;4;i++)
    {
      m[i] = 4*i+1;
      m[i+4] = 4*i+2;
      m[i+8] = 4*i+3;
      m[i+12] = 4*i+4;
      b[i]=i+17;
    }

  MPI_Scatter(m,4,MPI_INT,&amp;a,4,MPI_INT,0,MPI_COMM_WORLD);

  MPI_Bcast(b,4,MPI_INT,0,MPI_COMM_WORLD);

  hasil = 0;
  for (i=0;i&lt;4;i++)
    hasil+=a[i]*b[i];

  MPI_Gather(&amp;hasil,1,MPI_INT,b,1,MPI_INT,0,MPI_COMM_WORLD);

  if(my_rank == 0)
    printf(&quot;Hasilnya : \n%d\n%d\n%d\n%d\n&quot;,b[0],b[1],b[2],b[3]);

  MPI_Finalize();

  return 0;
}

// Nama : Muhamad Rendra
// NRP : G6410xxxx
// Perkalian Matriks Dengan Point To Point Communication

#include &lt;stdio.h&gt;
#include &lt;mpi.h&gt;

int main (int argc, char **argv)
{
  int size, my_rank, i , m[16],a[4],b[4], hasil ;

  MPI_Init(&amp;argc,&amp;argv);
  MPI_Comm_size (MPI_COMM_WORLD, &amp;size);
  MPI_Comm_rank (MPI_COMM_WORLD, &amp;my_rank);
  MPI_Status stat;

  if (size != 4)
  {
    if(my_rank == 0)printf(&quot; Error : Jumlah proses harus 4\n&#038;quot<img src='http://rendra.net/wrdp/smilies/yahoo_wink.gif' alt='&#59;&#41;' class='wp-smiley' width='18' height='18' title='&#59;&#41;' />;
    MPI_Finalize();
    return 0;
  }
  if (my_rank == 0)
  {
    for (i = 0;i&lt;4;i++)
    {
      m[i] = 4*i+1;
      m[i+4] = 4*i+2;
      m[i+8] = 4*i+3;
      m[i+12] = 4*i+4;
      b[i]=i+17;
      a[i] = m[i];
    }
    for (i = 1;i&lt;4;i++)
    {
      MPI_Send(&amp;m[i*4],4,MPI_INT,i,66,MPI_COMM_WORLD);
      MPI_Send(b,4,MPI_INT,i,67,MPI_COMM_WORLD);
    }
  }
  else
  {
    MPI_Recv(a,4,MPI_INT,0,66,MPI_COMM_WORLD,&amp;stat);
    MPI_Recv(b,4,MPI_INT,0,67,MPI_COMM_WORLD,&amp;stat);
  }

  hasil = 0;
  for (i=0;i&lt;4;i++)
    hasil+=a[i]*b[i];

  if(my_rank == 0)
  {
    for(i=1;i&lt;4;i++)
      MPI_Recv(&amp;b[i],1,MPI_INT,i,68,MPI_COMM_WORLD,&amp;stat);
    b[0] = hasil;
    printf(&quot;Hasilnya : \n%d\n%d\n%d\n%d\n&quot;,b[0],b[1],b[2],b[3]);
  }
  else
  MPI_Send(&amp;hasil,1,MPI_INT,0,68,MPI_COMM_WORLD);

  MPI_Finalize();
  return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://rendra.net/2005/05/11/tugas-kuliah-pemrosesan-paralel/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
