{"id":40,"date":"2007-05-18T12:38:00","date_gmt":"2007-05-18T19:38:00","guid":{"rendered":"http:\/\/sp2hari.com\/?p=40"},"modified":"2020-06-20T08:59:49","modified_gmt":"2020-06-20T08:59:49","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/sp2hari.com\/index.php\/2007\/05\/18\/hello-world\/","title":{"rendered":"Hello World &#8230;"},"content":{"rendered":"<p>I love Hello World programs.<br \/>\nThe reason is simple. Whenever i code a hello world, it means i am learning something new. I once found a huge collection of hello world programs <a href=\"http:\/\/lava404.wordpress.com\/2007\/04\/19\/hello-world\/\">here.<\/a><\/p>\n<p>And yes, i did a hello world program today. It is related <a href=\"http:\/\/en.wikipedia.org\/wiki\/Computer_cluster\">cluster<\/a> programming using <a href=\"http:\/\/en.wikipedia.org\/wiki\/Message_Passing_Interface\">MPI<\/a> . \ud83d\ude42 .<\/p>\n<p>The code for the hello world<\/p>\n<p><span style=\"font-family: 'courier new', courier;\"><span style=\"font-style: italic;\">#include &lt;stdio.h&gt;<br \/>\n<\/span><span style=\"font-style: italic;\">#include &lt;mpi\/mpi.h&gt;<br \/>\n<\/span><span style=\"font-style: italic;\">int main(int argc, char *argv[]) {<br \/>\n<\/span><span style=\"font-style: italic;\"> int err;<br \/>\n<\/span><span style=\"font-style: italic;\"> err = MPI_Init(&amp;argc, &amp;argv);<br \/>\n<\/span><span style=\"font-style: italic;\"> printf (&#8220;Hello World\\n&#8221;);<br \/>\n<\/span><span style=\"font-style: italic;\"> err = MPI_Finalize();<br \/>\n<\/span><\/span><span style=\"font-family: verdana; font-style: italic;\"><span style=\"font-family: 'courier new', courier;\">}<\/span><br \/>\n<\/span><br \/>\nSince i dont have a cluster at home, i had to simulate a cluster. That can be done using the <a href=\"http:\/\/www.die.net\/doc\/linux\/man\/man1\/mpirun.1.html\">mpirun<\/a> command .<\/p>\n<p><span style=\"font-style: italic;\">hari@home:~\/spider\/cluster$ mpirun -np 3 a.out<br \/>\n<\/span><span style=\"font-style: italic;\">Hello World<br \/>\n<\/span><span style=\"font-style: italic;\">Hello World<br \/>\n<\/span><span style=\"font-style: italic;\">Hello World<br \/>\n<\/span><span style=\"font-style: italic;\">hari@home:~\/spider\/cluster$<br \/>\n<\/span><br \/>\nFor the first time, this asked for my password 3 times ( the number of process i mentioned ) . After that i <a href=\"http:\/\/kimmo.suominen.com\/docs\/ssh\/\">created a keygen<\/a> for myself and then things went fine . But it took a long time when i gave the number of processes as 100 .<\/p>\n<p>Planning to code for a fractal using MPI in my free time \ud83d\ude42 .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I love Hello World programs. The reason is simple. Whenever i code a hello world, it means i am learning something new. I once found a huge collection of hello world programs here. And yes, i did a hello world program today. It is related cluster programming using MPI . &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/comments?post=40"}],"version-history":[{"count":3,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/40\/revisions"}],"predecessor-version":[{"id":1454,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/40\/revisions\/1454"}],"wp:attachment":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/media?parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/categories?post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/tags?post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}