# Save each simulation result on master node during parameter scanning

**URL:** <https://discourse.julialang.org/t/save-each-simulation-result-on-master-node-during-parameter-scanning/81953>\
**Category:** Julia at Scale\
**Tags:** question\
**Created:** [May 31, 2022, 2:31am UTC](https://discourse.julialang.org/t/save-each-simulation-result-on-master-node-during-parameter-scanning/81953 "2022-05-31T02:31:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtoda](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jtoda/32/36770_2.png) [@jtoda](https://discourse.julialang.org/u/jtoda)\
**Post date:** [May 31, 2022, 2:31am UTC](https://discourse.julialang.org/t/save-each-simulation-result-on-master-node-during-parameter-scanning/81953/1 "2022-05-31T02:31:53Z")

</div>

Hello !

I want to write code that stores data for a huge amount of simulation.  
I want to save data for each experiment, and the data storage location is the master node.  
Below is an example code, do you have any better ideas?

```julia
# TEST CODE

using Distributed

addprocs() # bring all local threads
addprocs([("###@####", :auto)]; dir="/home/####", exename="julia")

@everywhere using CSV
@everywhere using DataFrames
@everywhere function f()
    sleep(rand(0:10))
    return DataFrame(rand(10^3,10^2),:auto) # <- example data
end

mkpath("test_data")
n = 100000
asyncmap(1:1000000) do i # <- Really many simulations
    k = @fetch f()
    CSV.write("test_data/$i.csv",k) # save data on master node
    k = nothing
end 

```
