@@ -250,7 +250,7 @@ def sample(
250250 quiet = False ,
251251 init = None ,
252252 classic = False ,
253- output_dir = "/local" ,
253+ output_dir = None ,
254254 ):
255255 """
256256 Samples the posterior for the given data and model using
@@ -282,7 +282,7 @@ def sample(
282282 Switches classic mode on if True. In classic mode, a/e input is
283283 ignored.
284284 output_dir : str
285- Directory where temporary STAN files will be stored. Default: '/local'
285+ Directory where temporary STAN files will be stored. Default: None
286286
287287 Returns
288288 -------
@@ -443,7 +443,7 @@ def bootstrap(
443443 replacement = True ,
444444 restart = True ,
445445 walltime = 24.0 ,
446- output_dir = "/local" ,
446+ output_dir = None ,
447447 ):
448448 """
449449 Samples the posterior for the given data and model
@@ -483,7 +483,7 @@ def bootstrap(
483483 time is used, no new iteration will be started and job will exit
484484 cleanly. Should be used with restart set to True. Default 24.0
485485 output_dir : str
486- Directory where temporary STAN files will be stored. Default: '/local'
486+ Directory where temporary STAN files will be stored. Default: None
487487
488488 Returns
489489 -------
@@ -657,6 +657,13 @@ def bootstrap(
657657 # and the path is 'hardcoded' anyway
658658 stan_file = os .path .join (log_dir , "model.stan" )
659659
660+ if output_dir is not None :
661+ output_dir_rank = os .path .join (output_dir , "rank_%03d" % rank )
662+ if not os .path .exists (output_dir_rank ):
663+ os .makedirs (output_dir_rank )
664+ else :
665+ output_dir_rank = None
666+
660667 comm .Barrier ()
661668
662669 for k in tr :
@@ -714,7 +721,7 @@ def bootstrap(
714721 iter_sampling = iters ,
715722 save_warmup = save_warmup ,
716723 inits = [model .init ] * chains ,
717- output_dir = output_dir ,
724+ output_dir = output_dir_rank ,
718725 )
719726
720727 self .posterior = fit .draws_pd ()
0 commit comments