{"id":22,"date":"2021-04-15T06:00:00","date_gmt":"2021-04-15T06:00:00","guid":{"rendered":"https:\/\/school.moongames.eu\/?p=22"},"modified":"2022-07-14T13:55:26","modified_gmt":"2022-07-14T13:55:26","slug":"julia-hogwild","status":"publish","type":"post","link":"https:\/\/school.moongames.eu\/index.php\/2021\/04\/15\/julia-hogwild\/","title":{"rendered":"The Hogwild! idea"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">the Diploma thesis learning \u2013 April 15, 2021<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have been working on a project based on the paper &#8220;<em>HOGWILD!: A Lock-Free Approach to Parallelizing Stochastic Gradient Descent<\/em>&#8220;. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/papers.nips.cc\/paper\/2011\/file\/218a0aefd1d1a4be65601cc6ddc1520e-Paper.pdf\">https:\/\/papers.nips.cc\/paper\/2011\/file\/218a0aefd1d1a4be65601cc6ddc1520e-Paper.pdf<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First iteration was reading the paper and preparing the logical model how Stochastic Gradient Descent, a.k.a. SGD, works and how it would be possible to paralelize.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Creating the Julia project<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@everywhere function run_SSP_worker(batch, server, channel, model, ps, loss)\n    id = myid()\n    println(\"&#36;(id) has started!\")\n    while fetch(channel) != nothing\n        println(\"&#36;(myid()) is bamboozled!\")\n        xs = take!(channel)\n        println(\"&#36;(myid()) has\\n &#36;(ps)\\n &#36;(xs)\")\n        data = batch()\n        # WHY AM I NOT ALLOWED TO REMOVE MODEL HERE??\n        gs = calculate_gradient(loss, model, ps, xs, data)\n        information = Information(id, gs)\n        println(\"&#36;(data)\\n # &#36;(xs)\\n # &#36;(gs)\")\n        @sync put!(server, information)\n    end\nend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Math code is <code><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-be0f0eec93a68eb578aeeb7ed0569532_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#69;&#61;&#109;&#99;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"69\" style=\"vertical-align: 0px;\"\/><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>At first, we sample <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-a7ee323bc5a3f73ad5e066b13bed5504_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#102;&#40;&#120;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"34\" style=\"vertical-align: -5px;\"\/> in the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-5793832f979c2268e3694c246d53b1bb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#78;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"16\" style=\"vertical-align: 0px;\"\/> (<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-5793832f979c2268e3694c246d53b1bb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#78;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"16\" style=\"vertical-align: 0px;\"\/> is odd) equidistant points around <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-c674b8a19afef366cde8b4327cf616a6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#94;&#42;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"16\" style=\"vertical-align: 0px;\"\/>:<br><p class=\"ql-center-displayed-equation\" style=\"line-height: 37px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-453e8b590617b0bb07de5f80094c3d91_l3.png\" height=\"37\" width=\"394\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#102;&#95;&#107;&#32;&#61;&#32;&#102;&#40;&#120;&#95;&#107;&#41;&#44;&#92;&#58;&#32;&#120;&#95;&#107;&#32;&#61;&#32;&#120;&#94;&#42;&#43;&#107;&#104;&#44;&#92;&#58;&#32;&#107;&#61;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#78;&#45;&#49;&#125;&#123;&#50;&#125;&#44;&#92;&#100;&#111;&#116;&#115;&#44;&#92;&#102;&#114;&#97;&#99;&#123;&#78;&#45;&#49;&#125;&#123;&#50;&#125;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><br>where <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-14b463d0ecd5b350ced6cf1d6a12eef3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#104;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"10\" style=\"vertical-align: 0px;\"\/> is some step.<br>Then we interpolate points <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-54ebc25fab8a3f087833bf91e9816a92_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#123;&#40;&#120;&#95;&#107;&#44;&#102;&#95;&#107;&#41;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"55\" style=\"vertical-align: -5px;\"\/> by polynomial<br><a name=\"id4251117877\"><\/a><p class=\"ql-center-displayed-equation\" style=\"line-height: 55px;\"><span class=\"ql-right-eqno\"> (1) <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-90b9e7e2804f1d17d7146fd4ba44de9a_l3.png\" height=\"55\" width=\"155\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#101;&#113;&#117;&#97;&#116;&#105;&#111;&#110;&#42;&#125;&#32;&#80;&#95;&#123;&#78;&#45;&#49;&#125;&#40;&#120;&#41;&#61;&#92;&#115;&#117;&#109;&#95;&#123;&#106;&#61;&#48;&#125;&#94;&#123;&#78;&#45;&#49;&#125;&#123;&#97;&#95;&#106;&#120;&#94;&#106;&#125;&#92;&#101;&#110;&#100;&#123;&#101;&#113;&#117;&#97;&#116;&#105;&#111;&#110;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><br>Its coefficients <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-e6e7601eff44e8a5f7892b23fbbbf29e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#123;&#97;&#95;&#106;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"14\" width=\"15\" style=\"vertical-align: -6px;\"\/> are found as a solution of system of linear equations:<br><a name=\"id4065533911\"><\/a><p class=\"ql-center-displayed-equation\" style=\"line-height: 37px;\"><span class=\"ql-right-eqno\"> (2) <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/school.moongames.eu\/wp-content\/ql-cache\/quicklatex.com-6998772f8434326cc9c05c954cd5f82e_l3.png\" height=\"37\" width=\"332\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#101;&#113;&#117;&#97;&#116;&#105;&#111;&#110;&#42;&#125;&#32;&#92;&#108;&#101;&#102;&#116;&#123;&#32;&#80;&#95;&#123;&#78;&#45;&#49;&#125;&#40;&#120;&#95;&#107;&#41;&#32;&#61;&#32;&#102;&#95;&#107;&#92;&#114;&#105;&#103;&#104;&#116;&#125;&#44;&#92;&#113;&#117;&#97;&#100;&#32;&#107;&#61;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#78;&#45;&#49;&#125;&#123;&#50;&#125;&#44;&#92;&#100;&#111;&#116;&#115;&#44;&#92;&#102;&#114;&#97;&#99;&#123;&#78;&#45;&#49;&#125;&#123;&#50;&#125;&#92;&#101;&#110;&#100;&#123;&#101;&#113;&#117;&#97;&#116;&#105;&#111;&#110;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><br>Here are references to existing equations: (<a href=\"#id4251117877\">1<\/a>), (<a href=\"#id4065533911\">2<\/a>).<br>Here is reference to non-existing equation (??).<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>the Diploma thesis learning \u2013 April 15, 2021 I have been working on a project based on the paper &#8220;HOGWILD!:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[16,13],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-implementation","tag-julia","tag-ml","comments-off"],"_links":{"self":[{"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":31,"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/posts\/22\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/school.moongames.eu\/index.php\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}