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
Tickets/dm 8405 #3
Conversation
sph-layout: spherical partitions explorer sph-duplicate2: an advanced version of the chunk duplicator Added dependedcies on package 'sphgeom' for generating HTM ID for levels higher than 13. This was needed by the new duplicator.
of the specified partition.
into the lower 32-bit part of the keys.
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.
Looks mostly OK, there are few things that can be improved:
throw new
needs to be replaced withthrow
- curly brace initializers are out of favor, I think it's better to replace with parentheses
boost::lexical_cast<std::string>
could be replaced withstd::to_string
where possible
There are other minor comments you can llok at.
ups/partition.cfg
Outdated
"required": ["boost_system", "boost_filesystem", "boost_thread", "boost_program_options"], | ||
"buildRequired": ["boost_test"], | ||
"required": ["boost_system", "boost_filesystem", "boost_thread", "boost_program_options", "sphgeom"], | ||
"buildRequired": ["boost_test", "sphgeom"], |
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.
I think buildRequired
is an addition to required
for build time, if you have dependency in required
there no need to also put it into buildRequired
.
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.
addressed
return EXIT_FAILURE; | ||
} | ||
return EXIT_SUCCESS; | ||
} |
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.
github shows that newline is missing after last character
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.
addressed
return EXIT_FAILURE; | ||
} | ||
return EXIT_SUCCESS; | ||
} |
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.
missing newline after last character
src/sph-layout.cc
Outdated
@@ -0,0 +1,225 @@ | |||
/* | |||
* LSST Data Management System | |||
* Copyright 2013 LSST Corporation. |
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.
2017
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.
addressed
src/sph-layout.cc
Outdated
#include <utility> | ||
#include <vector> | ||
#include <map> | ||
#include <cmath> |
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.
includes should be sorted
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.
addressed
std::set<uint64_t> objIdOutOfBox; | ||
|
||
/// Duplicate the next row of the chunk's Object table | ||
size_t duplicateObjectRow (std::string & line, |
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.
const?
src/sph-duplicate2.cc
Outdated
|
||
int idx = 0; | ||
for (const std::string token : tokens) { | ||
if (coldefObject.idxDeepSourceId == idx) { deepSourceId = boost::lexical_cast<uint64_t>(token); } |
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 not it easier to write
uint64_t deepSourceId = boost::lexical_cast<uint64_t>(tokens[coldefObject.idxDeepSourceId]);
without looping over whole thing?
// Then update the row and store the updated row as well. | ||
|
||
if (opt.storeInput) { | ||
tokens[coldefObject.idxDeepSourceId] = boost::lexical_cast<std::string> (newInputDeepSourceId); |
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.
std::to_string()
is probably better for to-string conversion than boost::lexical_cast<std::string>
, at least it is shorter
src/sph-duplicate2.cc
Outdated
size_t numProcessed = 0, | ||
numRecorded = 0; | ||
|
||
std::ifstream infile { inFileName, std::ifstream::in }; |
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.
std::ifstream::in
is default, no need to mention it explicitely
tokens[colnum++] = token; | ||
} | ||
if (colnum != tokens.size()) | ||
throw new std::range_error("too few tokens in a row of the input Object file"); |
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.
If you need to split a line into tokens then Boost has a string algorithm library which is probably much more efficient that doing it via stringstream: http://www.boost.org/doc/libs/1_60_0/doc/html/string_algo/usage.html#idm45555128601440
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.
Addressed all concerns.
src/sph-layout.cc
Outdated
@@ -0,0 +1,225 @@ | |||
/* | |||
* LSST Data Management System | |||
* Copyright 2013 LSST Corporation. |
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.
addressed
src/sph-layout.cc
Outdated
#include <utility> | ||
#include <vector> | ||
#include <map> | ||
#include <cmath> |
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.
addressed
src/sph-layout.cc
Outdated
#include "boost/shared_ptr.hpp" | ||
|
||
#include "lsst/partition/Chunker.h" | ||
|
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.
addressed
src/sph-layout.cc
Outdated
|
||
Chunk2WorkerMap result; | ||
|
||
std::ifstream infile {filename, std::ifstream::in}; |
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.
addressed
src/sph-layout.cc
Outdated
int32_t chunk; | ||
std::string node; | ||
is >> chunk; | ||
is >> node; |
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.
addressed
src/sph-layout.cc
Outdated
|
||
("chunk2worker", po::value<std::string>(), "Chunk-to-worker map.") | ||
|
||
("chunk", po::value<std::vector<int32_t>>(), "Chunk identifier."); |
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.
addressed
src/sph-layout.cc
Outdated
vm.count("chunk") ? vm["chunk"].as<std::vector<int32_t>>() : std::vector<int32_t>(); | ||
|
||
if (chunks.empty()) | ||
for (int32_t chunkId = 0 ; chunkId < 20000; ++chunkId) |
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.
Re-implemented by adding two command line parameters to specify a range of chunk IDs in case if no specific IDs were passed to the application.
src/sph-layout.cc
Outdated
std::cout << " chunk2worker size: " << chunk2worker.size() << "\n"; | ||
} | ||
|
||
part::Chunker chunker{overlap, numStripes, numSubStripesPerStripe}; |
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.
addressed
return EXIT_FAILURE; | ||
} | ||
return EXIT_SUCCESS; | ||
} |
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.
addressed
ups/partition.cfg
Outdated
"required": ["boost_system", "boost_filesystem", "boost_thread", "boost_program_options"], | ||
"buildRequired": ["boost_test"], | ||
"required": ["boost_system", "boost_filesystem", "boost_thread", "boost_program_options", "sphgeom"], | ||
"buildRequired": ["boost_test", "sphgeom"], |
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.
addressed
The only request which I chose to refuse is regarding boost::lexical_caststd::string with std::to_string. The later truncates DOUBLE values to just a few digits after dot. This is not acceptable for this application because it's supposed to preserve the original precision of the duplicated contents. |
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.
I approve :)
No description provided.