Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
saitcakmak committed Jan 13, 2025
1 parent 2df526f commit 575c92c
Showing 1 changed file with 58 additions and 85 deletions.
143 changes: 58 additions & 85 deletions tutorials/test2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
" variable OMP_PATH to the location of the header before importing keopscore or pykeops,\n",
" e.g. using os.environ: import os; os.environ['OMP_PATH'] = '/path/to/omp/header'\n",
"[KeOps] Warning : Cuda libraries were not detected on the system or could not be loaded ; using cpu only mode\n",
"CPU times: user 4.05 s, sys: 1.72 s, total: 5.78 s\n",
"Wall time: 17.3 s\n"
"CPU times: user 2.72 s, sys: 834 ms, total: 3.55 s\n",
"Wall time: 5.25 s\n"
]
},
{
Expand Down Expand Up @@ -103,7 +103,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "f3ffba61",
"id": "313674bd",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -130,8 +130,8 @@
},
{
"cell_type": "code",
"execution_count": 3,
"id": "610b870d",
"execution_count": 5,
"id": "8f2a4bc7",
"metadata": {},
"outputs": [
{
Expand All @@ -146,86 +146,59 @@
"\n",
" calling minimize directly \n",
"\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/cholesky.py:40: NumericalWarning: A not p.d., added jitter of 1.0e-08 to the diagonal\n",
" warnings.warn(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" 16036994 function calls (15264162 primitive calls) in 10.074 seconds\n",
"\n",
" 230848 function calls (219730 primitive calls) in 0.168 seconds\n",
"\n",
" Ordered by: cumulative time\n",
" List reduced from 548 to 55 due to restriction <0.1>\n",
" List reduced from 419 to 42 due to restriction <0.1>\n",
"\n",
" ncalls tottime percall cumtime percall filename:lineno(function)\n",
" 1 0.000 0.000 10.074 10.074 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_minimize.py:53(minimize)\n",
" 1 0.001 0.001 10.074 10.074 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_lbfgsb_py.py:290(_minimize_lbfgsb)\n",
" 139 0.000 0.000 9.984 0.072 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:341(fun_and_grad)\n",
" 7089 0.122 0.000 9.945 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:16(wrapped)\n",
" 140 0.000 0.000 9.866 0.070 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:303(_update_grad)\n",
" 139 0.001 0.000 9.865 0.071 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:46(wrapped1)\n",
" 139 0.005 0.000 9.865 0.071 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_numdiff.py:277(approx_derivative)\n",
" 139 0.039 0.000 9.852 0.071 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_numdiff.py:584(_dense_difference)\n",
" 7089 0.018 0.000 9.812 0.001 <timed exec>:4(f_and_grad)\n",
" 6950 0.017 0.000 9.812 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_numdiff.py:468(fun_wrapped)\n",
"21267/7089 0.019 0.000 9.747 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/nn/modules/module.py:1732(_wrapped_call_impl)\n",
"21267/7089 0.028 0.000 9.741 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/nn/modules/module.py:1740(_call_impl)\n",
" 7089 0.004 0.000 9.730 0.001 /Users/saitcakmak/botorch/botorch/utils/transforms.py:340(decorated)\n",
" 7089 0.018 0.000 9.726 0.001 /Users/saitcakmak/botorch/botorch/utils/transforms.py:278(decorated)\n",
" 7089 0.153 0.000 9.660 0.001 /Users/saitcakmak/botorch/botorch/acquisition/monte_carlo.py:254(forward)\n",
" 7089 0.031 0.000 9.506 0.001 /Users/saitcakmak/botorch/botorch/acquisition/monte_carlo.py:277(_non_reduced_forward)\n",
" 7089 0.036 0.000 9.388 0.001 /Users/saitcakmak/botorch/botorch/acquisition/monte_carlo.py:108(_get_samples_and_objectives)\n",
" 7089 0.053 0.000 4.785 0.001 /Users/saitcakmak/botorch/botorch/models/gpytorch.py:407(posterior)\n",
" 7089 0.013 0.000 4.511 0.001 /Users/saitcakmak/botorch/botorch/acquisition/acquisition.py:128(get_posterior_samples)\n",
" 7089 0.017 0.000 4.469 0.001 /Users/saitcakmak/botorch/botorch/sampling/normal.py:34(forward)\n",
" 7089 0.033 0.000 4.270 0.001 /Users/saitcakmak/botorch/botorch/posteriors/gpytorch.py:86(rsample_from_base_samples)\n",
" 7089 0.129 0.000 4.177 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/distributions/multivariate_normal.py:198(rsample)\n",
" 7089 0.107 0.000 3.275 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/models/exact_gp.py:252(__call__)\n",
"28363/7091 0.049 0.000 3.164 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/memoize.py:54(g)\n",
" 7089 0.031 0.000 3.135 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:2128(root_decomposition)\n",
" 7091 0.005 0.000 2.750 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:1301(cholesky)\n",
" 7091 0.036 0.000 2.697 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:500(_cholesky)\n",
" 7089 0.092 0.000 2.283 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/models/exact_prediction_strategies.py:308(exact_prediction)\n",
" 7091 0.008 0.000 1.941 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/cholesky.py:50(psd_safe_cholesky)\n",
" 7091 0.066 0.000 1.933 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/cholesky.py:12(_psd_safe_cholesky)\n",
" 8322 1.760 0.000 1.760 0.000 {built-in method torch._C._linalg.linalg_cholesky_ex}\n",
"49640/42538 0.056 0.000 1.646 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/utils/memoize.py:54(g)\n",
"21268/14179 0.028 0.000 1.628 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_evaluated_kernel_tensor.py:22(wrapped)\n",
" 7089 0.005 0.000 1.338 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_evaluated_kernel_tensor.py:408(to_dense)\n",
" 7090 0.032 0.000 1.285 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_evaluated_kernel_tensor.py:342(evaluate_kernel)\n",
"21272/14182 0.029 0.000 1.162 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/module.py:30(__call__)\n",
"21267/14178 0.045 0.000 1.004 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:1817(matmul)\n",
"219823/106360 0.157 0.000 0.946 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_tensor.py:32(__init__)\n",
" 134715 0.522 0.000 0.844 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/functional.py:79(broadcast_shapes)\n",
" 14180 0.040 0.000 0.779 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/kernels/kernel.py:459(__call__)\n",
" 7089 0.108 0.000 0.769 0.000 /Users/saitcakmak/botorch/botorch/models/transforms/outcome.py:372(untransform_posterior)\n",
" 85074 0.135 0.000 0.746 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/nn/modules/module.py:1935(__setattr__)\n",
"311978/226896 0.077 0.000 0.646 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:2291(shape)\n",
" 7090 0.017 0.000 0.588 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/kernels/rbf_kernel.py:68(forward)\n",
"14179/7090 0.024 0.000 0.560 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/autograd/function.py:559(apply)\n",
" 7090 0.019 0.000 0.539 0.000 /Users/saitcakmak/botorch/botorch/models/gp_regression.py:239(forward)\n",
" 21270 0.018 0.000 0.522 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/pyro/distributions/distribution.py:21(__call__)\n",
"14179/7090 0.064 0.000 0.522 0.000 {built-in method apply}\n",
" 21270 0.058 0.000 0.505 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/distributions/multivariate_normal.py:45(__init__)\n",
"14178/7089 0.030 0.000 0.487 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/functions/_matmul.py:9(forward)\n",
" 7089 0.007 0.000 0.464 0.000 /Users/saitcakmak/botorch/botorch/models/model.py:248(eval)\n",
" 7089 0.003 0.000 0.443 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/nn/modules/module.py:2849(eval)\n",
" 7089 0.006 0.000 0.441 0.000 /Users/saitcakmak/botorch/botorch/models/model.py:253(train)\n",
" 7090 0.018 0.000 0.434 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/kernels/kernel.py:312(covar_dist)\n",
"35445/7089 0.018 0.000 0.425 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/module.py:296(train)\n",
" 1 0.000 0.000 0.168 0.168 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_minimize.py:53(minimize)\n",
" 1 0.000 0.000 0.166 0.166 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_lbfgsb_py.py:290(_minimize_lbfgsb)\n",
" 102 0.002 0.000 0.163 0.002 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:16(wrapped)\n",
" 102 0.000 0.000 0.160 0.002 <timed exec>:4(f_and_grad)\n",
" 306/102 0.000 0.000 0.159 0.002 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/nn/modules/module.py:1732(_wrapped_call_impl)\n",
" 306/102 0.001 0.000 0.158 0.002 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/torch/nn/modules/module.py:1740(_call_impl)\n",
" 102 0.000 0.000 0.158 0.002 /Users/saitcakmak/botorch/botorch/utils/transforms.py:340(decorated)\n",
" 102 0.000 0.000 0.158 0.002 /Users/saitcakmak/botorch/botorch/utils/transforms.py:278(decorated)\n",
" 102 0.004 0.000 0.157 0.002 /Users/saitcakmak/botorch/botorch/acquisition/monte_carlo.py:254(forward)\n",
" 102 0.001 0.000 0.153 0.002 /Users/saitcakmak/botorch/botorch/acquisition/monte_carlo.py:277(_non_reduced_forward)\n",
" 102 0.001 0.000 0.151 0.001 /Users/saitcakmak/botorch/botorch/acquisition/monte_carlo.py:108(_get_samples_and_objectives)\n",
" 3 0.000 0.000 0.146 0.049 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:303(_update_grad)\n",
" 2 0.000 0.000 0.146 0.073 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:46(wrapped1)\n",
" 2 0.000 0.000 0.146 0.073 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_numdiff.py:277(approx_derivative)\n",
" 2 0.001 0.001 0.145 0.073 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_numdiff.py:584(_dense_difference)\n",
" 100 0.000 0.000 0.144 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_numdiff.py:468(fun_wrapped)\n",
" 1 0.000 0.000 0.097 0.097 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_optimize.py:203(_prepare_scalar_function)\n",
" 1 0.000 0.000 0.097 0.097 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:166(__init__)\n",
" 102 0.001 0.000 0.089 0.001 /Users/saitcakmak/botorch/botorch/models/gpytorch.py:407(posterior)\n",
" 2 0.000 0.000 0.069 0.035 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:341(fun_and_grad)\n",
" 102 0.002 0.000 0.063 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/models/exact_gp.py:252(__call__)\n",
" 102 0.000 0.000 0.060 0.001 /Users/saitcakmak/botorch/botorch/acquisition/acquisition.py:128(get_posterior_samples)\n",
" 102 0.000 0.000 0.059 0.001 /Users/saitcakmak/botorch/botorch/sampling/normal.py:34(forward)\n",
" 102 0.001 0.000 0.056 0.001 /Users/saitcakmak/botorch/botorch/posteriors/gpytorch.py:86(rsample_from_base_samples)\n",
" 102 0.003 0.000 0.054 0.001 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/distributions/multivariate_normal.py:198(rsample)\n",
" 102 0.002 0.000 0.044 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/models/exact_prediction_strategies.py:308(exact_prediction)\n",
" 408/102 0.001 0.000 0.036 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/memoize.py:54(g)\n",
" 102 0.001 0.000 0.035 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:2128(root_decomposition)\n",
" 714/612 0.001 0.000 0.031 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/utils/memoize.py:54(g)\n",
" 306/204 0.000 0.000 0.030 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_evaluated_kernel_tensor.py:22(wrapped)\n",
" 102 0.000 0.000 0.029 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:1301(cholesky)\n",
" 102 0.001 0.000 0.028 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:500(_cholesky)\n",
" 102 0.000 0.000 0.026 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_evaluated_kernel_tensor.py:408(to_dense)\n",
" 102 0.001 0.000 0.025 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_evaluated_kernel_tensor.py:342(evaluate_kernel)\n",
" 306/204 0.001 0.000 0.023 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/module.py:30(__call__)\n",
" 5 0.000 0.000 0.020 0.004 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/scipy/optimize/_differentiable_functions.py:293(_update_fun)\n",
" 306/204 0.001 0.000 0.017 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/operators/_linear_operator.py:1817(matmul)\n",
" 204 0.001 0.000 0.016 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/kernels/kernel.py:459(__call__)\n",
" 102 0.000 0.000 0.016 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/cholesky.py:50(psd_safe_cholesky)\n",
" 102 0.001 0.000 0.015 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/linear_operator/utils/cholesky.py:12(_psd_safe_cholesky)\n",
"3162/1530 0.002 0.000 0.015 0.000 /opt/anaconda3/envs/botorch/lib/python3.10/site-packages/gpytorch/lazy/lazy_tensor.py:32(__init__)\n",
" 102 0.014 0.000 0.014 0.000 {built-in method torch._C._linalg.linalg_cholesky_ex}\n",
"\n",
"\n",
"CPU times: user 48.3 s, sys: 16.4 s, total: 1min 4s\n",
"Wall time: 10.1 s\n"
"CPU times: user 486 ms, sys: 408 ms, total: 893 ms\n",
"Wall time: 173 ms\n"
]
},
{
Expand All @@ -234,7 +207,7 @@
"'1.15.0'"
]
},
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -265,7 +238,7 @@
" method=\"L-BFGS-B\",\n",
" jac=False,\n",
" bounds=bounds,\n",
" options={\"maxfun\"}\n",
" options={\"maxfun\": 100}\n",
" )\n",
"\n",
"sortby = SortKey.CUMULATIVE\n",
Expand All @@ -277,7 +250,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "fb5c4839",
"metadata": {
"execution": {
Expand Down Expand Up @@ -309,8 +282,8 @@
" 100 f_and_grad evaluations \n",
"\n",
"\n",
"CPU times: user 411 ms, sys: 311 ms, total: 722 ms\n",
"Wall time: 122 ms\n"
"CPU times: user 413 ms, sys: 368 ms, total: 781 ms\n",
"Wall time: 162 ms\n"
]
},
{
Expand All @@ -319,7 +292,7 @@
"'1.15.0'"
]
},
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit 575c92c

Please sign in to comment.