Bug (?) in StationaryDist_FHorz_Iteration_SemiExo_nProbs_raw

Running the function StationaryDist_FHorz_Case1, I got this error message:

Error using gpuArray/reshape
Sparse gpuArray matrices are not supported for this function.

Error in StationaryDist_FHorz_Iteration_SemiExo_nProbs_raw (line 39)
    StationaryDist_jj=reshape(Gammatranspose*StationaryDist_jj,[N_a*N_semiz,N_z]);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in StationaryDist_FHorz_SemiExo (line 100)
        StationaryDist=StationaryDist_FHorz_Iteration_SemiExo_nProbs_raw(jequaloneDist,AgeWeightParamNames,Policy_dsemiexo,Policy_aprime,PolicyProbs,2,N_a,N_semiz,N_z,N_j,pi_semiz_J,pi_z_J,Parameters);
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in StationaryDist_FHorz_Case1 (line 183)
    StationaryDist=StationaryDist_FHorz_SemiExo(jequaloneDist,AgeWeightParamNames,Policy,n_d,n_a,simoptions.n_semiz,n_z,N_j,simoptions.pi_semiz_J,pi_z_J,Parameters,simoptions);
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think it might be related to me using R2024b instead of R2025b. @robertdkirkby I remember that in a previous post you said that the Tan improvement was running on CPU, not GPU, so I am a bit surprised.

I ran the code on R2025b and it runs without error messages.
I realized that SimPanelValues_FHorz_Case1 starts a parallel pool, is this really used?
Thanks

Panel data simulations are being done with parfor on CPU (at least they should be).

The SimPanelValues commands call SimPanelIndexes commands, and these contain parfor-loops that call the SimTimeSeriesIndexes commands. For example, you can see this on lines 211-217 of

1 Like

Thanks for the clarification, makes sense to parallelize over individuals/observations since they are independent.

Regarding the Matlab version: my understanding is that then the toolkit command for the distribution requires R2025, correct?

StationaryDist_FHorz_Iteration_SemiExo_nProbs_raw 

should now be on the CPU. I added a gather(). If it still errors tell me (hard to debug as I am on R2025a so it just runs).

1 Like

I can confirm that it runs on Matlab R2024b.

1 Like