<div dir="ltr"><div>Hi all,</div><div>I have posted the following question on stackoverflow, but so far I have not received an answer.</div><a href="http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster" target="_blank">http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster</a><br><div><br></div><div><br></div><div><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">I have a piece of code that process files,</p><pre class="" style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-size:13px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">processFiles </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">::</span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">  </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">[</span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">FilePath</span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">]</span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">-></span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">(</span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">FilePath </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">-></span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)"> IO </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">())</span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">-></span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)"> IO </span><span class="" style="margin:0px;padding:0px;border:0px;font-size:13px;color:rgb(0,0,0)">()</span></code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">This function spawns an async process that execute an IO action. This IO action must be submitted to a cluster through a job scheduling system (e.g Slurm).</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Because I must use the job scheduling system, it's not possible to use cloudHaskell to distribute the closure. Instead the program writes a new <em style="margin:0px;padding:0px;border:0px;font-size:15px">Main.hs</em> containing the desired computations, that is copy to the cluster node together with all the modules that main depends on and then it is executed remotely with "runhaskell Main.hs [opts]". Then the async process should ask periodically to the job scheduling system (using <em style="margin:0px;padding:0px;border:0px;font-size:15px">threadDelay</em>) if the job is done.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Is there a way to avoid creating a new Main? Can I serialize the IO action and execute it somehow in the node?</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Best,</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Felipe</p></div></div>