b-shields / edbo

Experimental Design via Bayesian Optimization
MIT License
125 stars 41 forks source link

conda error for GPU integration? #10

Closed DocMinus closed 3 years ago

DocMinus commented 3 years ago

Not sure if this is required for GPU or not (I am still at install phase), but conda install cudatookit=10.1, torchvision -c pytorch gives following error: CondaValueError: invalid package specification: cudatookit=10.1,

Is this actually necessary, considering that conda install -c pytorch pytorch=1.3.1 Seems to install cudatoolkit already?

This is part of the output for me from that install command:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
cffi-1.14.4                |   py37hcd4344a_0         243 KB
cudatoolkit-10.1.243       |       h74a9793_0       300.3 MB
ninja-1.10.2               |   py37h6d14046_0         246 KB
pytorch-1.3.1              |py3.7_cuda101_cudnn7_0       479.7 MB  pytorch
------------------------------------------------------------
                                       Total:       780.5 MB

The following NEW packages will be INSTALLED:

cffi pkgs/main/win-64::cffi-1.14.4-py37hcd4344a_0 cudatoolkit pkgs/main/win-64::cudatoolkit-10.1.243-h74a9793_0 ninja pkgs/main/win-64::ninja-1.10.2-py37h6d14046_0 pycparser pkgs/main/noarch::pycparser-2.20-py_2 pytorch pytorch/win-64::pytorch-1.3.1-py3.7_cuda101_cudnn7_0

b-shields commented 3 years ago

I can confirm that on my windows laptop (windows 10, NVIDIA GeForce GTX 960M) that conda install cudatookit=10.1, torchvision -c pytorch is not necessary for GPU integration.

Input:

import numpy as np
import pandas as pd
from edbo.bro import BO

X = pd.DataFrame(np.linspace(0,1,1000))
results = X.sample(5)
results['y'] = [1,5,20,3,50]
bo = BO(domain=X, results=results, gpu=True)

bo.obj.y

Output:

tensor([-0.8058, -0.5880,  0.2287, -0.6969,  1.8620], device='cuda:0')

All tests pass(1d_test_GPU.py):

(issue) C:\Users\Ben\Desktop>pytest gpu.py
================================================= test session starts =================================================
platform win32 -- Python 3.7.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\Ben\Desktop
collected 23 items

gpu.py .......................                                                                                                                                                                              [100%]

================================================================================================ warnings summary ================================================================================================
gpu.py: 92 warnings
  c:\users\ben\anaconda3\envs\issue\lib\site-packages\edbo\acq_func.py:346: RuntimeWarning: invalid value encountered in sqrt
    stdev = np.sqrt(model.variance(domain)) + 1e-6

gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
  c:\users\ben\anaconda3\envs\issue\lib\site-packages\gpytorch\utils\cholesky.py:43: RuntimeWarning: A not p.d., added jitter of 9.999999999999999e-06 to the diagonal
    warnings.warn(f"A not p.d., added jitter of {jitter_new} to the diagonal", RuntimeWarning)

gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
gpu.py::test_BO_simulate_kmeans
  c:\users\ben\anaconda3\envs\issue\lib\site-packages\gpytorch\utils\cholesky.py:43: RuntimeWarning: A not p.d., added jitter of 1e-06 to the diagonal
    warnings.warn(f"A not p.d., added jitter of {jitter_new} to the diagonal", RuntimeWarning)

gpu.py::test_BO_simulate_kmeans
  c:\users\ben\anaconda3\envs\issue\lib\site-packages\gpytorch\utils\cholesky.py:43: RuntimeWarning: A not p.d., added jitter of 9.999999999999999e-05 to the diagonal
    warnings.warn(f"A not p.d., added jitter of {jitter_new} to the diagonal", RuntimeWarning)

gpu.py::test_BO_simulate_kmedoids
  c:\users\ben\anaconda3\envs\issue\lib\site-packages\pyclustering\core\pyclustering_package.py:138: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    return isinstance(value, collections.Iterable)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================================= 23 passed, 110 warnings in 1145.45s (0:19:05) ==================================================================================

Nice catch. I will remove that line from the install instructions.

b-shields commented 3 years ago

@DocMinus If you confirm that the gpu integration worked on your machine I will close the issue.

DocMinus commented 3 years ago

Yes, confirmed. We can close.