-
Notifications
You must be signed in to change notification settings - Fork 1
A few changes to properly pass storeResidual to BLAST #16
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
Changes from all commits
7f490dd
64be44e
80c1b18
5dc6997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,24 +130,23 @@ void R__zipPrecisionCascade(int *srcsize, char *src, int *tgtsize, char **tgts, | |
| memset(irep,0,tgt_number*sizeof(int)); | ||
| return; | ||
| } | ||
|
|
||
| auto content = reinterpret_cast<ROOT::Internal::PrecisionCascadeConfigArrayContent*>(configarray); | ||
| (void) configsize; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the assert is the only use of |
||
| assert(content && (content->SizeOf() == (size_t)configsize)); | ||
| Int_t *cxlevels = content->GetLevels(); // This an array of size `content->fLen` | ||
|
|
||
| for (int tgt_idx=0; tgt_idx<tgt_number; tgt_idx++) { | ||
| // can only be 0 for the last of multiple (not just one) targets | ||
| // otherwise must be a positive value | ||
| int cxlevel_min = (tgt_idx > 0 && tgt_idx == tgt_number-1 ? 0 : 1); | ||
| if (cxlevels[tgt_idx] < cxlevel_min) { | ||
| // do not accept negative levels, and only accept level 0 if it is the final level, | ||
| // as this is a proxy for storing the residual of a cascade | ||
| bool storeResidual = content->fStoreResidual || (tgt_number > 0 && cxlevels[tgt_number-1] == 0); | ||
| int tgt_checks = tgt_number - (storeResidual ? 1 : 0); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Humm that seems wrong. If 'content->fStoreResidual', the last element is probably not zero, unless we explicitly already added it (in which case the if can be simplified to
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for double-checking me on this, Philippe. I have observed that if
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but what if the user put both a zero at the end and has
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, right now it is set to fail on that with the check on the level being less than 1. The code you've written will create two buffers and output files for the residual in that case, so if it is to be allowed, it should be caught further upstream of this to avoid creating two buffers/files for the residual.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the simplest is to not support '0' as a compression level (and possible explicitly reject it in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps this was the only controversial point in this PR?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes but since we migrate the i/o to store the 'storeResidual' at the end of the levels array (adding it based on the user input), it seems most of the PR is moot. Let me finish the change and see what I need to import. |
||
| for (int tgt_idx=0; tgt_idx<tgt_checks; tgt_idx++) { | ||
| if (cxlevels[tgt_idx] < 1) { | ||
| memset(irep,0,tgt_number*sizeof(int)); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| if (compressionAlgorithm == ROOT::RCompressionSetting::EAlgorithm::kBLAST) { | ||
| R__zipBLAST(cxlevels, srcsize, src, tgtsize, tgts, tgt_number, irep, datatype); | ||
| R__zipBLAST(cxlevels, srcsize, src, tgtsize, tgts, tgt_number, irep, storeResidual, datatype); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change cosmetic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. As you had written it, if out_sizes[tgt_idx] = 255, then tgt[3] = 1, tgt[4] = 0, and tgt[5] = 0, which would be interpreted as having a size of 1. The way I wrote it, tgt[4] would also become 1, so that the true size of 255 + 2 = 257 is preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Thanks!