{"id":3177,"date":"2015-09-07T13:56:53","date_gmt":"2015-09-07T13:56:53","guid":{"rendered":"http:\/\/www.dyalog.com\/blog\/?p=3177"},"modified":"2023-04-03T13:45:02","modified_gmt":"2023-04-03T13:45:02","slug":"parallel-programming-with-futuresisolates","status":"publish","type":"post","link":"https:\/\/www.dyalog.com\/blog\/2015\/09\/parallel-programming-with-futuresisolates\/","title":{"rendered":"Parallel Programming with Futures\/Isolates"},"content":{"rendered":"<p><span lang=\"EN-GB\"><a href=\"http:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05195.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3186\" src=\"http:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05195-300x168.jpg\" alt=\"DSC05195\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05195-300x168.jpg 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05195-1024x576.jpg 1024w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05195-500x281.jpg 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Morten Kromberg went right to it with his well-prepared workshop on the prototype features that were introduced in version 14.0 of Dyalog APL. The features are still partly modelled in APL to allow the first wave of users to pass judgement on the design. <\/span> <span lang=\"EN-GB\">Throughout the workshop, we were asked for feedback, to ensure that the new primitives will be as well implemented as possible.<\/span><\/p>\n<p><span lang=\"EN-GB\">Everyone is encouraged to apply the new tools in practice so they\u00a0can be adjusted and possibly get expanded functionality based on feedback from actual use-cases.<\/span><\/p>\n<p><span lang=\"EN-GB\">There is no denying the the obvious performance gains that Morten demonstrated:\u00a0He was able to let the computer waste\u00a09 idle seconds in only slightly more than 3 seconds!<\/span><\/p>\n<p><span lang=\"EN-GB\">Joking aside, one practical example that showed how useful parallel processing can be, was collating character counts from online news sites. Because of latency in\u00a0loading these pages over the internet, starting many parallel threads that each requested a page greatly reduced the wait time.<\/span> <a href=\"http:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05197.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3183\" src=\"http:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05197-300x168.jpg\" alt=\"DSC05197\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05197-300x168.jpg 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05197-1024x576.jpg 1024w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2015\/09\/DSC05197-500x281.jpg 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> One workshop participant volunteered a piece of code that needed to be parallelized got up and pair programmed this with immediately achieving significant performance gains.<\/p>\n<p>The idea of Futures is allowing the continuation of other work before an asynchronously launched calculation is finished. All selection and structural functions can be used on an array containing futures without blocking to wait for the result, as long as no actual data values are required. Meanwhile, other processes (or computers!) could be finishing the evaluation in the background.<\/p>\n<p>It was captivating to observe\u00a0output being printed and check the status while the calculation work progressed, or accessing parts of an array while other parts still reported as in progress. Morten even had a graphical representation of how load is distributed across processor cores.<\/p>\n<p>Maybe the most exciting thing about all this is that we will\u00a0soon\u00a0welcome\u00a0several new APL squiggles; Isolate (<code>\u00a4<\/code>) and Parallel (<code>\u2225<\/code>). And at the end of the day, Morten even pulled a pet (pun intended) card out of his sleeve: A <a href=\"https:\/\/en.wikipedia.org\/wiki\/Schr%C3%B6dinger%27s_cat\">Schr\u00f6dinger\u2019s cat <\/a>operator! The\u00a0symbol is of course a question mark in a box (<code>\u2370<\/code>), signifying how the evaluation of the cat\u2019s life (or in our case \u2013 the result) does not even begin until actually queried. This is a novel way to specify specific lazy evaluation.<\/p>\n<p>All in all, an exciting look at\u00a0what possibilities for\u00a0parallelism the future will bring.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Morten Kromberg went right to it with his well-prepared workshop on the prototype features that were introduced in version 14.0 of Dyalog APL. The features are still partly modelled in APL to allow the first wave of users to pass &hellip; <a href=\"https:\/\/www.dyalog.com\/blog\/2015\/09\/parallel-programming-with-futuresisolates\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,26,4],"tags":[],"class_list":["post-3177","post","type-post","status-publish","format-standard","hentry","category-apl-language","category-dyalog-15","category-events"],"_links":{"self":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/3177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/comments?post=3177"}],"version-history":[{"count":11,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/3177\/revisions"}],"predecessor-version":[{"id":3209,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/3177\/revisions\/3209"}],"wp:attachment":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/media?parent=3177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/categories?post=3177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/tags?post=3177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}