Closed
Description
Same model with exact same data and parameters results in very different sampling times on a Windows 10 vs. Ubuntu laptops. I'm replicating Stochastic Volatility example using the near exact same environments
Please provide a minimal, self-contained, and reproducible example.
import pandas as pd
returns = pd.read_csv(
pm.get_data("SP500.csv"), parse_dates=True, index_col=0, usecols=["Date", "change"])
len(returns)```
```import pymc as pm
import pandas as pd
returns = pd.read_csv(
pm.get_data("SP500.csv"), parse_dates=True, index_col=0, usecols=["Date", "change"]
)
with pm.Model() as sp500_model:
change_returns = pm.ConstantData("returns", returns["change"], dims="date", export_index_as_coords=True)
nu = pm.Exponential("nu", 1 / 10.0, initval=5.0)
sigma = pm.Exponential("sigma", 2.0, initval=0.1)
s = pm.GaussianRandomWalk("s", sigma=sigma, init_dist=pm.Normal.dist(0,100), dims="date")
sp500_model.eval_rv_shapes() # {'nu_log__': (), 'nu': (), 'sigma_log__': (), 'sigma': (), 's': (2906,)}
with sp500_model:
trace = pm.sample(1000, init="adapt_diag", step=pm.NUTS(max_treedepth=15, target_accept=0.9), return_inferencedata=True)```
**Please provide any additional information below.**
```Multiprocess sampling (2 chains in 2 jobs)```
Windows 10 time to sample (sampling repeated 3 times): 12:55 (12 minutes and 55 seconds), 13:27, and 12:57
Linux Ubuntu time to sample (also repeated 3 times): 1:29:05 (1 hour 29 minutes and 5 seconds), 1:31:14, and 1:28:47
Windows 10 - only Anaconda running with 8GB of RAM
Linux Ubuntu - only Miniconda running with 8GB of RAM
I chose to set ```max_treedepth=15``` and ```target_accept=0.9``` after the sampling in both OS warned about hitting the limit on both of these parameters at their defaults (```max_treedepth=10``` and ```target_accept=0.8```)
I find these consistent differences between the two OS to be systematic. Each time I made sure I started the sampling on a fresh Jupyter session. If anyone can try to replicate or provide insight into this that would be great.
## Versions and main components
* PyMC/PyMC3 Version: ```PyMC v4.0.0``` (both W10 and Linux)
* Aesara/Theano Version: ```aesara-2.6.6``` (both W10 and Linux)
* Python Version: ```3.10.4``` (both W10 and Linux)
* Operating system: Windows 10 and Linux (Ubuntu 20.10)
* How did you install PyMC/PyMC3: (conda/pip): directly from the main branch on github using ```pip "git+https://github.com/pymc-devs/pymc.git"```
I used the ```environment.yml``` for Windows10 from this thread [#4937](https://github.com/pymc-devs/pymc/issues/4937#issuecomment-1146004854) and used a modified version of that file for Linux (dropping ```libpython```, ```m2w64-toolchain```, and ```numba```)