{"id":6344,"date":"2014-10-21T11:05:50","date_gmt":"2014-10-21T09:05:50","guid":{"rendered":"http:\/\/blog.zhaw.ch\/icclab\/?p=6344"},"modified":"2014-10-29T14:19:58","modified_gmt":"2014-10-29T12:19:58","slug":"numerical-dosimetry-in-the-cloud","status":"publish","type":"post","link":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/","title":{"rendered":"Numerical Dosimetry in the cloud"},"content":{"rendered":"<p><strong>What is it all about?<\/strong><\/p>\n<p>We&#8217;re using a bunch of VMs to do numerical dosimetry and are very satisfied with the service and performance we get. Here I try to give some background on our work.<br \/>\nAssume yourself sitting in the dentists chair for an x-ray image of your teeth. How much radiation will miss the x-ray film in your mouth and instead wander through your body? That&#8217;s one type of question we try to answer with computer models. Or numeric dosimetry, as we call it.<\/p>\n<p>The interactions between ionizing radiation \u2013 e.g. x-rays \u2013 and atoms are well known. However, there is a big deal of randomness, so called stochastic behavior. Let&#8217;s go back to the dentists chair and follow one single photon (that&#8217;s the particle x-rays are composed of). This sounds a bit like ray tracing, but is way more noisy as you&#8217;ll see.<\/p>\n<p>The image below shows a voxel phantom (built of Lego bricks made of bone, fat, muscle etc.) during a radiography of the left breast.<\/p>\n<p><strong><a href=\"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6365\" src=\"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png\" alt=\"torso_view_beam\" width=\"288\" height=\"300\" srcset=\"https:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png 288w, https:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam.png 465w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a><\/strong><\/p>\n<p><strong>Tracing a photon<\/strong><\/p>\n<p>The photon is just about to leave the x-ray tube. We take a known distribution of photon energies, throw dices and pick one energy at random. Then we decide \u2013 again by throwing dices \u2013 how long the photon will fly until it comes close to an atom. How exactly will it hit the atom? Which of the many processes (e.g. Compton scattering) will take place? How much energy will be lost and in what direction will it leave the atom? The answer \u2013 you may have already guessed that \u2013 is rolling in the dice. We repeat the process until the photon has lost all it&#8217;s energy or leaves our model world.<\/p>\n<p>During its journey the photon has created many secondary particles (e.g. electrons kicked out of an atomic orbit). We follow each of them and their children again. Finally, all particles have come to rest and we know in detail what happened to that single photon and to the matter it crossed. This process takes some 100 micro seconds on an average cloud CPU.<\/p>\n<p><strong>Monte Carlo (MC)<\/strong><\/p>\n<p>This method of problem solving is called Monte Carlo after the roulette tables. You always apply MC if there are too many parameters to solve a problem in a deterministic way. One well know application is the so called rain drop Pi. By counting the fraction of random points that are within a circle you can approach the number Pi (3.141).<\/p>\n<p>Back to the dentist: Unfortunately, with our single photon we do not see any energy deposit in your thyroid gland (located at the front of your neck) yet. This first photon passed by pure chance without any interaction. So we just start another one, 5&#8217;000 a second, 18 Millions per hour etc. until we have enough dose collected in your neck. Only a tiny fraction q of the N initial photons ends up in our target volume and the energy deposit shows fluctuations that typically decrease proportional to 1\/sqrt(qN). So we need some 1E9 initial photons to have 1E5 in the target volume and have a relative error smaller than 1 %. This would take 2 CPU days.<\/p>\n<p><strong>MC and the cloud<\/strong><\/p>\n<p>This type of MC problems is CPU bound and trivial to parallelize, since the photons are independent from each other (remember that in a drop of water there are 1E23 molecules, our 1E9 photons will not disturb that). So with M CPUs my waiting time is just reduced by a factor M. In the above example and with 50 CPUs I have a result after 1 hour instead of 2 days.<\/p>\n<p>This is a quantitative progress on the one hand. But on the other hand and more important for my work is the progress in quality: During one day, I can play with 10 different scenarios, I can concentrate on problem solving and do not waste time unwinding the stack in my head after a week. The cloud helps to improve the quality of our work.<\/p>\n<p><strong>Practical considerations<\/strong><\/p>\n<p>The code we use is Geant4 (geant4.cern.ch), a free C++ library to propagate particles through matter. Code development is done locally (e.g. Ubuntu in a virtual box) and then uploaded with rsync to the master node.<\/p>\n<p>Our CPUs are distributed over several virtual machines deployed in ICCLab&#8217;s <a href=\"http:\/\/www.openstack.org\/\" target=\"_blank\">OpenStack<\/a> cloud. From the master we distribute code and collect results via rsync, job deployment and status is done through small bash scripts. The final analysis is then done locally with Matlab.<\/p>\n<p>Code deployment and result collection is done within 30 seconds, which is negligible compared to run times of hours. So even on the job scale our speedup is M.<\/p>\n<div class=\"pt-sm\">Schlagw\u00f6rter: <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/applications\/\">applications<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/monte-carlo\/\">monte carlo<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/performance-improvements\/\">performance improvements<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/photon-tracing\/\">photon tracing<\/a><br><\/div>","protected":false},"excerpt":{"rendered":"<p>What is it all about? We&#8217;re using a bunch of VMs to do numerical dosimetry and are very satisfied with the service and performance we get. Here I try to give some background on our work. Assume yourself sitting in the dentists chair for an x-ray image of your teeth. How much radiation will miss [&hellip;]<\/p>\n","protected":false},"author":165,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[5,21],"tags":[479,481,480,482],"features":[],"class_list":["post-6344","post","type-post","status-publish","format-standard","hentry","category-articles","category-openstack-2","tag-applications","tag-monte-carlo","tag-performance-improvements","tag-photon-tracing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Numerical Dosimetry in the cloud - Service Engineering (ICCLab &amp; SPLab)<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Numerical Dosimetry in the cloud\" \/>\n<meta property=\"og:description\" content=\"What is it all about? We&#8217;re using a bunch of VMs to do numerical dosimetry and are very satisfied with the service and performance we get. Here I try to give some background on our work. Assume yourself sitting in the dentists chair for an x-ray image of your teeth. How much radiation will miss [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Engineering (ICCLab &amp; SPLab)\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-21T09:05:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-10-29T12:19:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png\" \/>\n<meta name=\"author\" content=\"Patrik Eschle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrik Eschle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\"},\"author\":{\"name\":\"Patrik Eschle\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/ff810c68c70a173bd16f3afa75980290\"},\"headline\":\"Numerical Dosimetry in the cloud\",\"datePublished\":\"2014-10-21T09:05:50+00:00\",\"dateModified\":\"2014-10-29T12:19:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\"},\"wordCount\":782,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png\",\"keywords\":[\"applications\",\"monte carlo\",\"performance improvements\",\"photon tracing\"],\"articleSection\":[\"Articles\",\"OpenStack\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\",\"name\":\"Numerical Dosimetry in the cloud - Service Engineering (ICCLab &amp; SPLab)\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png\",\"datePublished\":\"2014-10-21T09:05:50+00:00\",\"dateModified\":\"2014-10-29T12:19:58+00:00\",\"author\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/ff810c68c70a173bd16f3afa75980290\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam.png\",\"contentUrl\":\"https:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam.png\",\"width\":465,\"height\":484},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\/\/blog.zhaw.ch\/icclab\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Numerical Dosimetry in the cloud\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/\",\"name\":\"Service Engineering (ICCLab &amp; SPLab)\",\"description\":\"A Blog of the ZHAW Zurich University of Applied Sciences\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/ff810c68c70a173bd16f3afa75980290\",\"name\":\"Patrik Eschle\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0c04d0db118c9e3210f62b1a8deabbc6fb38f1a916d91529bace6c4572fb1d79?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0c04d0db118c9e3210f62b1a8deabbc6fb38f1a916d91529bace6c4572fb1d79?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0c04d0db118c9e3210f62b1a8deabbc6fb38f1a916d91529bace6c4572fb1d79?s=96&d=mm&r=g\",\"caption\":\"Patrik Eschle\"},\"description\":\"Physicist trying to find out what x-rays do in matter by following every single one of them.\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/author\/escl\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Numerical Dosimetry in the cloud - Service Engineering (ICCLab &amp; SPLab)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/","og_locale":"en_US","og_type":"article","og_title":"Numerical Dosimetry in the cloud","og_description":"What is it all about? We&#8217;re using a bunch of VMs to do numerical dosimetry and are very satisfied with the service and performance we get. Here I try to give some background on our work. Assume yourself sitting in the dentists chair for an x-ray image of your teeth. How much radiation will miss [&hellip;]","og_url":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/","og_site_name":"Service Engineering (ICCLab &amp; SPLab)","article_published_time":"2014-10-21T09:05:50+00:00","article_modified_time":"2014-10-29T12:19:58+00:00","og_image":[{"url":"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png","type":"","width":"","height":""}],"author":"Patrik Eschle","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Patrik Eschle","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#article","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/"},"author":{"name":"Patrik Eschle","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/ff810c68c70a173bd16f3afa75980290"},"headline":"Numerical Dosimetry in the cloud","datePublished":"2014-10-21T09:05:50+00:00","dateModified":"2014-10-29T12:19:58+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/"},"wordCount":782,"commentCount":0,"image":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage"},"thumbnailUrl":"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png","keywords":["applications","monte carlo","performance improvements","photon tracing"],"articleSection":["Articles","OpenStack"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/","url":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/","name":"Numerical Dosimetry in the cloud - Service Engineering (ICCLab &amp; SPLab)","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage"},"image":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage"},"thumbnailUrl":"http:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam-288x300.png","datePublished":"2014-10-21T09:05:50+00:00","dateModified":"2014-10-29T12:19:58+00:00","author":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/ff810c68c70a173bd16f3afa75980290"},"breadcrumb":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#primaryimage","url":"https:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam.png","contentUrl":"https:\/\/blog.zhaw.ch\/icclab\/files\/2014\/10\/torso_view_beam.png","width":465,"height":484},{"@type":"BreadcrumbList","@id":"https:\/\/blog.zhaw.ch\/icclab\/numerical-dosimetry-in-the-cloud\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/blog.zhaw.ch\/icclab\/"},{"@type":"ListItem","position":2,"name":"Numerical Dosimetry in the cloud"}]},{"@type":"WebSite","@id":"https:\/\/blog.zhaw.ch\/icclab\/#website","url":"https:\/\/blog.zhaw.ch\/icclab\/","name":"Service Engineering (ICCLab &amp; SPLab)","description":"A Blog of the ZHAW Zurich University of Applied Sciences","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/ff810c68c70a173bd16f3afa75980290","name":"Patrik Eschle","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0c04d0db118c9e3210f62b1a8deabbc6fb38f1a916d91529bace6c4572fb1d79?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0c04d0db118c9e3210f62b1a8deabbc6fb38f1a916d91529bace6c4572fb1d79?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0c04d0db118c9e3210f62b1a8deabbc6fb38f1a916d91529bace6c4572fb1d79?s=96&d=mm&r=g","caption":"Patrik Eschle"},"description":"Physicist trying to find out what x-rays do in matter by following every single one of them.","url":"https:\/\/blog.zhaw.ch\/icclab\/author\/escl\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/6344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/users\/165"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/comments?post=6344"}],"version-history":[{"count":8,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/6344\/revisions"}],"predecessor-version":[{"id":6420,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/6344\/revisions\/6420"}],"wp:attachment":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/media?parent=6344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/categories?post=6344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/tags?post=6344"},{"taxonomy":"features","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/features?post=6344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}