# Atom Editor + Monte Carlo Simulations

**URL:** <https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805>\
**Category:** General Usage\
**Created:** [March 13, 2019, 5:29am UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805 "2019-03-13T05:29:46Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ennvvy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ennvvy/32/7816_2.png) [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Post date:** [March 13, 2019, 5:29am UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/1 "2019-03-13T05:29:46Z")

</div>

I am using the Atom editor to run MC simulations using Julia. I have implemented a parallel program for the same and am currently using addprocs(5). But, at the end or in the course of the simulations, the editor either hangs or crashes. Is there a way out of this ?

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [March 13, 2019, 8:01am UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/2 "2019-03-13T08:01:10Z")

</div>

Run the REPL in a shell. In particular for long running calcs that is better anyway as otherwise your IDE-repl is blocked.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 13, 2019, 8:19am UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/3 "2019-03-13T08:19:37Z")

</div>

You might be running into [this bug](https://github.com/JunoLab/Juno.jl/issues/221).

---

<div class="post-metadata">

**Author:** ![ennvvy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ennvvy/32/7816_2.png) [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Post date:** [March 13, 2019, 12:11pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/4 "2019-03-13T12:11:00Z")

</div>

I am a relatively new user of Julia. If it is not too naive to ask, may I know what it means to run the REPL in a shell? I understand that the shell is for running system commands?

---

<div class="post-metadata">

**Author:** ![mike\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike_k/32/211864_2.png) [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Post date:** [March 13, 2019, 12:18pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/5 "2019-03-13T12:18:55Z")

</div>

It means running julia outside from Atom in a shell. This may vary slightly depending on your operating system, but the basic idea is to start the julia binary. See, for instance, [here](https://docs.julialang.org/en/v1/stdlib/REPL/index.html).

---

<div class="post-metadata">

**Author:** ![pkofod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pkofod/32/2179_2.png) [@pkofod](https://discourse.julialang.org/u/pkofod)\
**Post date:** [March 13, 2019, 12:26pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/6 "2019-03-13T12:26:35Z")

</div>

> [@ennvvy](#):
>
> I am a relatively new user of Julia. If it is not too naive to ask, may I know what it means to run the REPL in a shell? I understand that the shell is for running system commands?

Are you on windows? How did you install Julia?

---

<div class="post-metadata">

**Author:** ![ennvvy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ennvvy/32/7816_2.png) [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Post date:** [March 13, 2019, 12:27pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/7 "2019-03-13T12:27:58Z")

</div>

I am using a Mac. I installed Julia from the downloaded installation file on their webpage.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [March 13, 2019, 1:35pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/8 "2019-03-13T13:35:58Z")

</div>

So run Julia in a terminal app.

---

<div class="post-metadata">

**Author:** ![ennvvy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ennvvy/32/7816_2.png) [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Post date:** [March 13, 2019, 2:13pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/9 "2019-03-13T14:13:08Z")

</div>

Oh, that was the shell reference in the earlier reply. Thank you !

---

<div class="post-metadata">

**Author:** ![ennvvy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ennvvy/32/7816_2.png) [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Post date:** [March 28, 2019, 6:00am UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/10 "2019-03-28T06:00:13Z")

</div>

I tried to run them in shell. However, the result is not any different. It hangs and takes unusually long to complete the simulation. If it is of any help, I run the following:

> const mc = 1 ;  
> const mcd = 500 ; # Number of Monte Carlo iterations  
> theta = pmap(mc → MonteCarlo(mc,mcf),1:1:mcf) ;

MonteCarlo is a function which on every run returns a tuple - 2 1500-by-100 arrays, 2 1500-by-100-by-100 matrices, 3 1-by-100 arrays. Currently I am trying with two workers,

> addprocs(2)

Am I doing it right or is there a better way to implement it ? Thank you.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [March 28, 2019, 4:55pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/11 "2019-03-28T16:55:45Z")

</div>

I’m sorry but I can’t make sense of the numbers you gave. These are huge, if true!

---

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [March 28, 2019, 6:59pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805/12 "2019-03-28T18:59:23Z")

</div>

If you’re using `Float64` arrays, each iteration’s matrices will consume `2*1500*100*100*8=240 MB`. With 500 runs, that comes out to 120 GB, so you may be exhausting your system’s memory. Is there any sparsity or simplification you could exploit?
