Custom CUDA implementation of a Gaussian Process for the sweep#587
Open
vyeoms wants to merge 5 commits into
Open
Custom CUDA implementation of a Gaussian Process for the sweep#587vyeoms wants to merge 5 commits into
vyeoms wants to merge 5 commits into
Conversation
This change defines __setstate__ and __getstate__ in Protein to handle CUDA graph capture in child processes spawned by multiprocessing. The child processes don't handle GP training or updates, so they don't need to be calling CudaMalloc. Stripping the CUDA-heavy parameters for the child processes reduces the graph capture load
Author
|
Can test more envs if desired, let me know here. Also can tell me if other tests would be good to have |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A custom CUDA C implementation of a Gaussian Process to begin porting Protein to CUDA C:
src/gp_cuda.cuimplements the core logic for GP regression. Operations are implemented in single precision, still agrees to ~1e-3 precision with gpytorch. Can change to double precision if desired, but that's roughly 2x-4x the computational cost.src/gp_cuda_kernel.cuis for the GP covariance kernel. For the time being it only implements the current kernel used by Protein (Matern 3/2+linear), but keeping this separate could be useful if in the future we want to change the kernel.src/bindings.cuandpufferlib/sweep.pyto adopt the custom GP, respectively. As it is right now, running sweeps on CPU would be broken since the GP is only implemented for CUDA, since I would think that sweeps make most sense with a GPU environment.tests/test_custom_gp_numerics.pyto verify numerical evaluation of this implementation vs gpytorch. Single precision agrees to ~1e-3, double precision agrees to ~1e-9tests/test_custom_gp_optimpyto verify the GP implementations get updated more or less the same. Parameters agree to ~1e-3.tests/test_sweep.pyto use Puffer 3.0 formatNumerical and qualitative results
Output of
tests/test_custom_gp_numerics.pyRunning in my laptop with an A1000 GPU
Output of
tests/test_custom_gp_optimpyRunning in my laptop with an A1000 GPU
Running
tests/test_sweep.pyFor more experiments see this thread on discord. Running 200 iters on my laptop with an A1000 GPU.
gpytorch
Last 4 iterations:
This implementation
Last 4 iterations:
Sweeping breakout
Constellation output with 60 iters:
Seems to play ok with the top score hyperparams: