ZoltanRacz / MomentMatching.jl

This is a package to estimate parameters of macroeconomic models by moment matching methods, such as GMM or SMM.
MIT License
1 stars 0 forks source link

Environment - access problems in elegant multiprocessing #88

Closed ZoltanRacz closed 6 months ago

ZoltanRacz commented 6 months ago

As of 92fc8d950563448c5faf1fab7a939c1d6c773e9e, our elegant code for multiprocessing doesn't run.

I took to following steps to understand what's going on:

Found this related thread: https://discourse.julialang.org/t/error-running-distributed-code-inside-of-a-module/54283 suggesting the minimal example below for the last point above.

Minimal example
module A
    using Distributed
    procs = addprocs(10)
    f = @spawnat procs[1] begin
        println("got here") # never printed
        return 1
    end
    #fetch(f)
end
  1. "got here" is never printed
  2. when fetch(f) is uncommented, an error says module A is not available on worker 2

The problem is that process inside doesn't know what is outside. Couldn't implement their fix (their situation looks simpler anyways).

Conclusion

I think our problem is that this outside world of processes should be BOTH MomentMatching and AKR (or whatever application). Hopefully I'm wrong.

In any case, we would need to know more about modules, environments, etc. When having time, a good idea would be to write a minimal example for our problem and ask on julia forums.

ZoltanRacz commented 6 months ago

Fixed by 3228fe9599e3b368df4d1111bcb23e0a34b0e0ee