CompressionBenchmark: Increase number of images
This commit is contained in:
@@ -91,15 +91,24 @@ int main(int argc, char **argv) {
|
||||
|
||||
RegisterHDF5Filter();
|
||||
|
||||
if ((argc != 2) && (argc != 3)) {
|
||||
if ((argc != 2) && (argc != 3) && (argc != 4)) {
|
||||
std::cout << "Usage: ./CompressionBenchmark <JF4M hdf5 file> {<nthreads>}" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
uint32_t nthreads = 1;
|
||||
if (argc == 3)
|
||||
if (argc >= 3)
|
||||
nthreads = atol(argv[2]);
|
||||
|
||||
uint64_t nimages = 25;
|
||||
if (argc == 4)
|
||||
nimages = atol(argv[3]);
|
||||
|
||||
if ((nthreads <= 0) || (nimages <= 0)) {
|
||||
std::cerr << "Error in input parameters" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
HDF5ReadOnlyFile data(argv[1]);
|
||||
|
||||
HDF5DataSet dataset(data, "/entry/data/data");
|
||||
@@ -120,34 +129,36 @@ int main(int argc, char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
uint64_t nimages = file_space.GetDimensions()[0];
|
||||
std::cout << "Number of images in the dataset: " << nimages << std::endl;
|
||||
if (nimages > 200) {
|
||||
nimages = 200;
|
||||
std::cout << "Using only " << nimages << " images" << std::endl;
|
||||
|
||||
uint64_t nimages_dataset = file_space.GetDimensions()[0];
|
||||
std::cout << "Number of images in the dataset: " << nimages_dataset << std::endl;
|
||||
if (nimages_dataset > 200) {
|
||||
nimages_dataset = 200;
|
||||
std::cout << "Using only " << nimages_dataset << " images" << std::endl;
|
||||
}
|
||||
x.Mode(DetectorMode::Conversion);
|
||||
|
||||
std::vector<int16_t> image_conv ( nimages * file_space.GetDimensions()[1] * file_space.GetDimensions()[2]);
|
||||
std::vector<int16_t> image_conv ( nimages_dataset * file_space.GetDimensions()[1] * file_space.GetDimensions()[2]);
|
||||
|
||||
|
||||
std::vector<hsize_t> start = {0,0,0};
|
||||
std::vector<hsize_t> dim = {nimages, file_space.GetDimensions()[1], file_space.GetDimensions()[2]};
|
||||
std::vector<hsize_t> dim = {nimages_dataset, file_space.GetDimensions()[1], file_space.GetDimensions()[2]};
|
||||
|
||||
auto start_time = std::chrono::system_clock::now();
|
||||
dataset.ReadVector(image_conv, start, dim);
|
||||
auto end_time = std::chrono::system_clock::now();
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
|
||||
|
||||
std::cout << "Images loaded " << elapsed.count() / nimages << " ms/image "
|
||||
std::cout << "Images loaded " << elapsed.count() / nimages_dataset << " ms/image "
|
||||
<< (image_conv.size() * sizeof(uint16_t)) / (1000.0 * elapsed.count()) << " MB/s" << std::endl;
|
||||
|
||||
|
||||
std::cout << "Images to benchmark " << nimages << std::endl << "Threads: " << nthreads << std::endl << std::endl;
|
||||
std::vector<int16_t> image( nimages * x.GetModulesNum() * RAW_MODULE_SIZE);
|
||||
|
||||
for (int i = 0; i < nimages; i++) {
|
||||
ConvertedToRawGeometry(x,
|
||||
image.data() + i * RAW_MODULE_SIZE * x.GetModulesNum(),
|
||||
image_conv.data() + i * file_space.GetDimensions()[1] * file_space.GetDimensions()[2]);
|
||||
image_conv.data() + (i % nimages_dataset) * file_space.GetDimensions()[1] * file_space.GetDimensions()[2]);
|
||||
}
|
||||
|
||||
auto image_shuffled = bitshuffle(image, 4096);
|
||||
|
||||
Reference in New Issue
Block a user