-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gpu bvls #316
Open
craigwarner-ufastro
wants to merge
13
commits into
main
Choose a base branch
from
gpu_bvls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Gpu bvls #316
Conversation
This file contains 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
vector (in tdata) so that NNLS can be used instead of BVLS. Fixed bug when ValueError excepted in rebinning
negative legendre terms. Refactored a little to clean up. For archetypes with legendre terms, NNLS is now actually used with additional terms of -1*each legendre term so that we can use the faster NNLS to get the same result as BVLS.
because on CPU, the additional computation time for the larger array sizes dominates any time savings of NNLS vs BVLS
negative legendre terms on the GPU in lieu of BVLS into per_camera_coeff_with_least_square_batch. Moved prior_on_coeffs into zscan.py, called from within per_camera_coeff_with_least_square_batch. Pass prior_sigma, a scalar, insted of the array from fitz to archetypes. Bug fix on case where only some object types, not all, have an archetype.
terms with 0 coefficients and make the coeffs negative for negative terms. Refactored to remove the last bit of the BVLS-NNLS trick from archetypes.py and zfind.py by passing binned instead of tdata to per_camera_coeff_with_least_square_batch.
involve using a list of bands instead of ncam to be more general.
because results were different and timing as well.
…re_nnls_merge_with_main Resolved conflicts
algorithm. This is in the optimize folder and will be submitted to CuPy for inclusion at which point it will be removed from Redrock. zscan has been updated to use this GPU based version instead of our NNLS trick of adding negative legendre terms and using NNLS to emulate BVLS; although that trick is preserved via self._solver_method = "bvls_via_nnls" in archetypes.py where Archetype files are allowed to specify their preferred solver method (pca, nnls, bvls, or bvls_via_nnls). This branch is forked from the branch legendre_nnls_merge_with_main, which was ready to merge with main and had addressed conflicts that had arisen during parallel developement by myself and Abhijeet. zfind is modified slightly to add a timing print statement for the time spent in each solver method. Timing Results: With 4 GPUs and 4 CPUs, BVLS on GPU takes ~17s resulting in a fine redshift scan time of 72s compared to the NNLS trick taking ~14s for a fine redshift scan time of 76s (the reason the fitting is faster but the overall time is slower is due to other operations performed on larger arrays with the added negative legendre terms). This compares to using scipy's CPU-based BVLS, which takes ~63s to do the fitting and 119s for the fine redshift scan.
entered in redrock test data but bug was found when developing a unit test prior to submitting to CuPy.
few thousand random tests and caused a mismatch in array dimensions.
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.
Full timing results:
GPU BVLS (4 CPU, 4 GPU)
GPU BVLS via NNLS trick on CPU (4 CPU, 4 GPU)
GPU BVLS via CPU BVLS (4 CPU, 4 GPU)
CPU BVLS (64 CPU, 0 GPU)
CPU BVLS via NNLS trick (64 CPU, 0 GPU)
For comparison
PCA only, GPU (4 GPU, 4 CPU):
PCA only, CPU (64 CPU, 0 GPU)
Output verification results:
All 3 GPU methods are ==. And compared to CPU results are np.allclose.