Moved metering to a compile time option to streamline API
This commit is contained in:
parent
3920405c4c
commit
1330d5b262
9 changed files with 363 additions and 215 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,6 +2,9 @@
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
||||||
|
# BWC Data Files
|
||||||
|
*.bwc
|
||||||
|
|
||||||
# Object files
|
# Object files
|
||||||
*.o
|
*.o
|
||||||
*.ko
|
*.ko
|
||||||
|
|
|
@ -181,6 +181,8 @@ add_subdirectory(src/library)
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
if(${TOOL})
|
if(${TOOL})
|
||||||
add_subdirectory(src/tools)
|
add_subdirectory(src/tools)
|
||||||
|
else()
|
||||||
|
set(ignoreMe "${BUILD_EAS3}${BUILD_NETCDF}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
50
Makefile
50
Makefile
|
@ -53,14 +53,19 @@
|
||||||
.PHONY: single
|
.PHONY: single
|
||||||
|
|
||||||
.PHONY: tool
|
.PHONY: tool
|
||||||
|
.PHONY: profiling
|
||||||
.PHONY: eas3
|
.PHONY: eas3
|
||||||
.PHONY: netCDF
|
.PHONY: netCDF
|
||||||
|
|
||||||
.PHONY: --build_debug
|
.PHONY: build_debug
|
||||||
|
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
.PHONY: debug
|
.PHONY: debug
|
||||||
.PHONY: full
|
.PHONY: full
|
||||||
|
.PHONY: release
|
||||||
|
|
||||||
|
.PHONY: cmdl
|
||||||
|
.PHONY: cldebug
|
||||||
|
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
# Initialize the compiler flags used to build the library. #
|
# Initialize the compiler flags used to build the library. #
|
||||||
|
@ -73,6 +78,8 @@ BUILD_PREC="Double"
|
||||||
|
|
||||||
BUILD_TOOL="False"
|
BUILD_TOOL="False"
|
||||||
|
|
||||||
|
BUILD_PROF="False"
|
||||||
|
|
||||||
BUILD_EAS3="False"
|
BUILD_EAS3="False"
|
||||||
|
|
||||||
BUILD_NETCDF="False"
|
BUILD_NETCDF="False"
|
||||||
|
@ -95,12 +102,25 @@ help:
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " [Type] [Description]"
|
@echo " [Type] [Description]"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " debug Compiles BigWhoop and the command line tool with "
|
@echo " debug Compiles BigWhoop with all relevant debug flags."
|
||||||
@echo " full file support. All relevant debug flags are set."
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " full Compiles BigWhoop (with OpenMP enabled if applica-"
|
@echo " full Removes all files and folders created during a pre-"
|
||||||
@echo " ble) and the command line tool with full file sup-"
|
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
|
||||||
@echo " port. Code optimization is set to the highest level."
|
@echo " enabled if applicable). Code optimization is set to"
|
||||||
|
@echo " the highest level."
|
||||||
|
@echo ""
|
||||||
|
@echo " release Compiles BigWhoop (with OpenMP enabled if applica-"
|
||||||
|
@echo " ble). Code optimization is set to the highest level."
|
||||||
|
@echo ""
|
||||||
|
@echo " cmdl Removes all files and folders created during a pre-"
|
||||||
|
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
|
||||||
|
@echo " enabled if applicable). All relevant debug flags "
|
||||||
|
@echo " are set. "
|
||||||
|
@echo ""
|
||||||
|
@echo " cmdl Removes all files and folders created during a pre-"
|
||||||
|
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
|
||||||
|
@echo " enabled if applicable). Code optimization is set to"
|
||||||
|
@echo " the highest level."
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " clean Removes all files and folders created during a pre-"
|
@echo " clean Removes all files and folders created during a pre-"
|
||||||
@echo " vious compile run."
|
@echo " vious compile run."
|
||||||
|
@ -116,6 +136,8 @@ help:
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " tool Build the command line tool."
|
@echo " tool Build the command line tool."
|
||||||
@echo ""
|
@echo ""
|
||||||
|
@echo " profiling Enable Profiling."
|
||||||
|
@echo ""
|
||||||
@echo " eas3 Adds support for the eas3 file format to the com-"
|
@echo " eas3 Adds support for the eas3 file format to the com-"
|
||||||
@echo " mand line tool."
|
@echo " mand line tool."
|
||||||
@echo ""
|
@echo ""
|
||||||
|
@ -125,7 +147,7 @@ help:
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
# Define private targets. #
|
# Define private targets. #
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
--build_debug:
|
build_debug:
|
||||||
$(eval BUILD_TYPE="Debug")
|
$(eval BUILD_TYPE="Debug")
|
||||||
|
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
|
@ -143,6 +165,11 @@ single:
|
||||||
tool:
|
tool:
|
||||||
$(eval BUILD_TOOL="True")
|
$(eval BUILD_TOOL="True")
|
||||||
|
|
||||||
|
#*--------------------------------------------------------*#
|
||||||
|
# Define target used to activate command line tool build. #
|
||||||
|
#*--------------------------------------------------------*#
|
||||||
|
profiling:
|
||||||
|
$(eval BUILD_PROF="True")
|
||||||
|
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
# Define targets used to activate file format support. #
|
# Define targets used to activate file format support. #
|
||||||
|
@ -156,9 +183,11 @@ netCDF:
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
# Define the wrappers for the compile command targets. #
|
# Define the wrappers for the compile command targets. #
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
debug: | clean --build_debug tool eas3 build_bwc display
|
debug: | clean build_debug build_bwc display
|
||||||
|
full: | clean build_bwc display
|
||||||
release: | build_bwc display
|
release: | build_bwc display
|
||||||
full: | clean tool eas3 build_bwc display
|
cmdl: | clean tool profiling eas3 build_bwc display
|
||||||
|
cldebug: | clean build_debug tool profiling eas3 build_bwc display
|
||||||
|
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
# Define target used to output compile information. #
|
# Define target used to output compile information. #
|
||||||
|
@ -182,6 +211,7 @@ display:
|
||||||
@echo " Link Type: $(LINK_TYPE)"
|
@echo " Link Type: $(LINK_TYPE)"
|
||||||
@echo " Precision: $(BUILD_PREC)"
|
@echo " Precision: $(BUILD_PREC)"
|
||||||
@echo " Utilities: $(BUILD_TOOL)"
|
@echo " Utilities: $(BUILD_TOOL)"
|
||||||
|
@echo " Profiling: $(BUILD_PROF)"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " Build date: $(shell date)"
|
@echo " Build date: $(shell date)"
|
||||||
@echo " User: $(USER)"
|
@echo " User: $(USER)"
|
||||||
|
@ -192,7 +222,7 @@ display:
|
||||||
# Define the main compile command targets. #
|
# Define the main compile command targets. #
|
||||||
#*--------------------------------------------------------*#
|
#*--------------------------------------------------------*#
|
||||||
build_bwc:
|
build_bwc:
|
||||||
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
|
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
- /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public
|
- /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public
|
|
@ -103,4 +103,19 @@
|
||||||
bwc_tile_sizeof, // Tiling defined by size of one tile
|
bwc_tile_sizeof, // Tiling defined by size of one tile
|
||||||
bwc_tile_numbof, // Tiling defined by the number of tiles
|
bwc_tile_numbof, // Tiling defined by the number of tiles
|
||||||
} bwc_tile_instr;
|
} bwc_tile_instr;
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*\
|
||||||
|
! !
|
||||||
|
! DESCRIPTION: !
|
||||||
|
! ------------ !
|
||||||
|
! !
|
||||||
|
! These constants are used to signal the dataset sample precision. !
|
||||||
|
! !
|
||||||
|
\*----------------------------------------------------------------------------------------------*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
bwc_type_half,
|
||||||
|
bwc_type_single,
|
||||||
|
bwc_type_double,
|
||||||
|
} bwc_type;
|
||||||
#endif
|
#endif
|
|
@ -713,24 +713,5 @@
|
||||||
bwc_gl_ctrl control; // Global control structure
|
bwc_gl_ctrl control; // Global control structure
|
||||||
|
|
||||||
bwc_tile *tile; // Structure defining bwc tile.
|
bwc_tile *tile; // Structure defining bwc tile.
|
||||||
|
|
||||||
struct meter
|
|
||||||
{
|
|
||||||
double bpd; // Average bits per datapoint.
|
|
||||||
double cpr; // Compression ratio
|
|
||||||
double css; // Codestream size.
|
|
||||||
|
|
||||||
struct time
|
|
||||||
{
|
|
||||||
double ttl; // Total compression time.
|
|
||||||
|
|
||||||
double cpy; // Total time used copying data.
|
|
||||||
double nrm; // Total time used normalizing data.
|
|
||||||
|
|
||||||
double wav; // Total time used for wavelet transform.
|
|
||||||
double ent; // Total time used for entropy encoding.
|
|
||||||
double ass; // Total codestream assembly time.
|
|
||||||
} time;
|
|
||||||
} meter;
|
|
||||||
} bwc_field;
|
} bwc_field;
|
||||||
#endif
|
#endif
|
|
@ -94,6 +94,15 @@ else()
|
||||||
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
|
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Set the target compile definition for the profiling #
|
||||||
|
# output. #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
if(${PROF})
|
||||||
|
target_compile_definitions(bwclib PRIVATE -DBWC_PROFILE)
|
||||||
|
MESSAGE(STATUS "Profiling: ${PROF}")
|
||||||
|
endif()
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Set the Version and SOVersion and define the public API #
|
# Set the Version and SOVersion and define the public API #
|
||||||
# for the BigWhoop library. #
|
# for the BigWhoop library. #
|
||||||
|
|
|
@ -56,6 +56,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifdef BWC_PROFILE
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
@ -73,6 +76,72 @@
|
||||||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||||
|| ||
|
|| ||
|
||||||
\************************************************************************************************************/
|
\************************************************************************************************************/
|
||||||
|
/*----------------------------------------------------------------------------------------------------------*\
|
||||||
|
! !
|
||||||
|
! DESCRIPTION: !
|
||||||
|
! ------------ !
|
||||||
|
! This function takes an integer value and generates a version with the appropri- !
|
||||||
|
! ate byte unit in log2 format that is returned to the function caller. !
|
||||||
|
! !
|
||||||
|
! DEVELOPMENT HISTORY: !
|
||||||
|
! -------------------- !
|
||||||
|
! !
|
||||||
|
! Date Author Change Id Release Description Of Change !
|
||||||
|
! ---- ------ --------- ------- --------------------- !
|
||||||
|
! 03.05.2019 Patrick Vogler B87D120 V 0.1.0 function created !
|
||||||
|
! 04.05.2021 Patrick Vogler B87E7E4 V 0.1.0 clean up !
|
||||||
|
! !
|
||||||
|
\*----------------------------------------------------------------------------------------------------------*/
|
||||||
|
#if defined BWC_PROFILE
|
||||||
|
const char*
|
||||||
|
get_size(uint64_t integer)
|
||||||
|
{
|
||||||
|
/*-----------------------*\
|
||||||
|
! DEFINE INT VARIABLES: !
|
||||||
|
\*-----------------------*/
|
||||||
|
uint64_t multiplier;
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
/*-----------------------*\
|
||||||
|
! DEFINE CHAR VARIABLES: !
|
||||||
|
\*-----------------------*/
|
||||||
|
char *sizes[] = { "EiB", "PiB", "TiB", "GiB", "MiB", "KiB", "B" };
|
||||||
|
static char str[20];
|
||||||
|
|
||||||
|
/*--------------------------------------------------------*\
|
||||||
|
! Set up the multiplier used to evaluate the digital unit !
|
||||||
|
! prefix and allocate the character array returned to the !
|
||||||
|
! function caller. !
|
||||||
|
\*--------------------------------------------------------*/
|
||||||
|
multiplier = 1024ULL * 1024ULL * 1024ULL *
|
||||||
|
1024ULL * 1024ULL * 1024ULL;
|
||||||
|
|
||||||
|
/*--------------------------------------------------------*\
|
||||||
|
! If larger than 0, iterate over the byte units until the !
|
||||||
|
! integer is within its range and populate the char. array !
|
||||||
|
! with the appropriate information. !
|
||||||
|
\*--------------------------------------------------------*/
|
||||||
|
if(integer > 0)
|
||||||
|
{
|
||||||
|
for(i = 0; i < 7; ++i, multiplier /= 1024)
|
||||||
|
{
|
||||||
|
if(integer < multiplier)
|
||||||
|
continue;
|
||||||
|
if(integer % multiplier == 0)
|
||||||
|
sprintf(str, "%" PRIu64 " %s", integer / multiplier, sizes[i]);
|
||||||
|
else
|
||||||
|
sprintf(str, "%.1f %s", floor((10.0 * integer) / multiplier) / 10.0, sizes[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(str, "0 B");
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------------------------------------*\
|
/*----------------------------------------------------------------------------------------------------------*\
|
||||||
! FUNCTION NAME: uint8 initialize_precinct(bwc_field *const field, bwc_precinct *precinct, !
|
! FUNCTION NAME: uint8 initialize_precinct(bwc_field *const field, bwc_precinct *precinct, !
|
||||||
! -------------- const uint32 dX, const uint32 dY, !
|
! -------------- const uint32 dX, const uint32 dY, !
|
||||||
|
@ -3885,11 +3954,30 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
uint64 i;
|
uint64 i;
|
||||||
uint16 p;
|
uint16 p;
|
||||||
|
|
||||||
|
#ifdef BWC_PROFILE
|
||||||
|
uint64 css;
|
||||||
|
uint64 nfs;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------*\
|
/*-----------------------*\
|
||||||
! DEFINE FLOAT VARIABLES: !
|
! DEFINE FLOAT VARIABLES: !
|
||||||
\*-----------------------*/
|
\*-----------------------*/
|
||||||
double start, end;
|
double start, end;
|
||||||
|
|
||||||
|
#ifdef BWC_PROFILE
|
||||||
|
double bpd;
|
||||||
|
double cpr;
|
||||||
|
|
||||||
|
double ttl;
|
||||||
|
|
||||||
|
double cpy;
|
||||||
|
double nrm;
|
||||||
|
|
||||||
|
double wav;
|
||||||
|
double ent;
|
||||||
|
double ass;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------*\
|
/*-----------------------*\
|
||||||
! DEFINE STRUCTS: !
|
! DEFINE STRUCTS: !
|
||||||
\*-----------------------*/
|
\*-----------------------*/
|
||||||
|
@ -3908,10 +3996,12 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Initialize the compression time measurement. !
|
! Initialize the compression time measurement. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
field->meter.time.ttl = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
ttl = omp_get_wtime();
|
||||||
field->meter.time.ttl = (double)clock();
|
#else
|
||||||
|
ttl = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -3978,18 +4068,22 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
! Fill the working buffer with the flow field data for the !
|
! Fill the working buffer with the flow field data for the !
|
||||||
! current tile parameter. !
|
! current tile parameter. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
fill_buffer(field, tile, parameter, working_buffer, data, p);
|
fill_buffer(field, tile, parameter, working_buffer, data, p);
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.cpy += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
cpy += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
cpy += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -3997,60 +4091,72 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
! scale it to the dynamic range specified by the Qm param- !
|
! scale it to the dynamic range specified by the Qm param- !
|
||||||
! eter. !
|
! eter. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
normalize_param(field, parameter);
|
normalize_param(field, parameter);
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.nrm += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
nrm += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
nrm += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Perform the forward discrete wavelet transform. !
|
! Perform the forward discrete wavelet transform. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(forward_wavelet_transform(field, parameter))
|
if(forward_wavelet_transform(field, parameter))
|
||||||
{
|
{
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.wav += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
wav += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
wav += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Tier1 encode the current tile parameter. !
|
! Tier1 encode the current tile parameter. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(t1_encode(field, tile, parameter))
|
if(t1_encode(field, tile, parameter))
|
||||||
{
|
{
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.ent += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
ent += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
ent += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -4062,31 +4168,37 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Tier2 encode the current tile. !
|
! Tier2 encode the current tile. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(t2_encode(field, tile))
|
if(t2_encode(field, tile))
|
||||||
{
|
{
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.ent += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
ent += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
ent += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Assemble compressed codestream. !
|
! Assemble compressed codestream. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
data->codestream.data = assemble_codestream(field);
|
data->codestream.data = assemble_codestream(field);
|
||||||
if(!data->codestream.data)
|
if(!data->codestream.data)
|
||||||
|
@ -4094,12 +4206,14 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.ass += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
ass += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.ass += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
ass += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -4108,12 +4222,33 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Calculate the compression time. !
|
! Output the profiling information. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
|
#if defined (_OPENMP)
|
||||||
#else
|
ttl = omp_get_wtime() - ttl;
|
||||||
field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
|
#else
|
||||||
|
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nfs = (uint64)(info->nX * info->nY * info->nZ * info->nTS * info->nPar * info->precision);
|
||||||
|
css = (uint64)data->codestream.data->size;
|
||||||
|
|
||||||
|
|
||||||
|
cpr = (double)nfs/css;
|
||||||
|
bpd = (double)(css * 64.0f)/nfs;
|
||||||
|
|
||||||
|
printf("==============================================================\n");
|
||||||
|
printf(" Compression Time: %*.2f s\n", 25, ttl);
|
||||||
|
printf(" - Wavelet transformation: %*.2f s\n", 25, wav);
|
||||||
|
printf(" - Entropy encoding: %*.2f s\n", 25, ent);
|
||||||
|
printf(" - Codestream assembly: %*.2f s\n", 25, ass);
|
||||||
|
printf("\n");
|
||||||
|
printf(" Compression Ratio: %*.2f\n", 27, cpr);
|
||||||
|
printf(" - Codestream size: %*s\n", 25, get_size(css));
|
||||||
|
printf(" - Field size: %*s\n", 25, get_size(nfs));
|
||||||
|
printf(" - Average bpd: %*.2f\n", 27, bpd);
|
||||||
|
printf("==============================================================\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -4240,6 +4375,17 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
|
||||||
\*-----------------------*/
|
\*-----------------------*/
|
||||||
double start, end;
|
double start, end;
|
||||||
|
|
||||||
|
#ifdef BWC_PROFILE
|
||||||
|
double ttl;
|
||||||
|
|
||||||
|
double cpy;
|
||||||
|
double nrm;
|
||||||
|
|
||||||
|
double wav;
|
||||||
|
double ent;
|
||||||
|
double ass;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------*\
|
/*-----------------------*\
|
||||||
! DEFINE STRUCTS: !
|
! DEFINE STRUCTS: !
|
||||||
\*-----------------------*/
|
\*-----------------------*/
|
||||||
|
@ -4259,12 +4405,15 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Initialize the decompression time measurement. !
|
! Initialize the decompression time measurement. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
field->meter.time.ttl = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
ttl = omp_get_wtime();
|
||||||
field->meter.time.ttl = (double)clock();
|
#else
|
||||||
|
ttl = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Save the global control and info structure to temporary !
|
! Save the global control and info structure to temporary !
|
||||||
! variables to make the code more readable. !
|
! variables to make the code more readable. !
|
||||||
|
@ -4350,61 +4499,73 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Tier1 decode the current tile parameter. !
|
! Tier1 decode the current tile parameter. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(t1_decode(field, tile, parameter))
|
if(t1_decode(field, tile, parameter))
|
||||||
{
|
{
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.ent += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
ent += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
ent += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Perform the inverse discrete wavelet transform. !
|
! Perform the inverse discrete wavelet transform. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(inverse_wavelet_transform(field, parameter))
|
if(inverse_wavelet_transform(field, parameter))
|
||||||
{
|
{
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.wav += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
wav += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
wav += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Denormalize the working buffer scale it to the original !
|
! Denormalize the working buffer scale it to the original !
|
||||||
! dynamic range specified by the Qm parameter. !
|
! dynamic range specified by the Qm parameter. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
denormalize_param(field, parameter);
|
denormalize_param(field, parameter);
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.nrm += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
nrm += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
nrm += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -4412,18 +4573,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
|
||||||
! in the flow field data structure for the current tile pa-!
|
! in the flow field data structure for the current tile pa-!
|
||||||
! rameter. !
|
! rameter. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
start = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
#else
|
start = omp_get_wtime();
|
||||||
start = (double)clock();
|
#else
|
||||||
|
start = (double)clock();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
flush_buffer(field, tile, parameter, working_buffer, data, p);
|
flush_buffer(field, tile, parameter, working_buffer, data, p);
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
end = omp_get_wtime();
|
#if defined (_OPENMP)
|
||||||
field->meter.time.cpy += end - start;
|
end = omp_get_wtime();
|
||||||
#else
|
cpy += end - start;
|
||||||
end = (double)clock();
|
#else
|
||||||
field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
|
end = (double)clock();
|
||||||
|
cpy += (end - start)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -4440,13 +4605,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
|
||||||
free(working_buffer);
|
free(working_buffer);
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! Calculate the decompression time. !
|
! Output the profiling information. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
#if defined (_OPENMP)
|
#if defined BWC_PROFILE
|
||||||
field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
|
#if defined (_OPENMP)
|
||||||
#else
|
ttl = omp_get_wtime() - ttl;
|
||||||
field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
|
#else
|
||||||
|
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf("==============================================================\n");
|
||||||
|
printf(" Decompression Time: %*.2f s\n", 24, ttl);
|
||||||
|
printf(" - Wavelet transformation: %*.2f s\n", 24, wav);
|
||||||
|
printf(" - Entropy encoding: %*.2f s\n", 24, ent);
|
||||||
|
printf("==============================================================\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -52,14 +52,14 @@ add_executable(bwccmd bwccmdl.c
|
||||||
# Set the target compile definition for the requested file #
|
# Set the target compile definition for the requested file #
|
||||||
# format support. #
|
# format support. #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
|
|
||||||
|
|
||||||
if(${BUILD_EAS3})
|
if(${BUILD_EAS3})
|
||||||
target_compile_definitions(bwccmd PRIVATE -DBWC_EAS3)
|
target_compile_definitions(bwccmd PRIVATE -DBWC_EAS3)
|
||||||
|
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${BUILD_NETCDF})
|
if(${BUILD_NETCDF})
|
||||||
target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF)
|
target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF)
|
||||||
|
MESSAGE(STATUS "NetCDF file format support: ${BUILD_NETCDF}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
|
@ -3012,57 +3012,6 @@ main(int argc,
|
||||||
{
|
{
|
||||||
printf("==============================================================\n");
|
printf("==============================================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
|
||||||
! Calculate the original field size, compression ratio and !
|
|
||||||
! bits per datapoint and print the miscellaneous compres- !
|
|
||||||
! sion information to the standard output. !
|
|
||||||
\*--------------------------------------------------------*/
|
|
||||||
if(file->info.parameter)
|
|
||||||
{
|
|
||||||
param = file->info.parameter->root;
|
|
||||||
|
|
||||||
while(param != NULL)
|
|
||||||
{
|
|
||||||
size += (param->size * param->precision);
|
|
||||||
param = param -> next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
comp_ratio = (double)size/(file->codestream.data->size);
|
|
||||||
bpd = (double)(file->codestream.data->size * 64)/size;
|
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
|
||||||
! Calculate the original field size, compression ratio and !
|
|
||||||
! bits per datapoint and print the miscellaneous compres- !
|
|
||||||
! sion information to the standard output. !
|
|
||||||
\*--------------------------------------------------------*/
|
|
||||||
csSize = get_size(file->codestream.data->size);
|
|
||||||
fdSize = get_size(size);
|
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
|
||||||
! Calculate the original field size, compression ratio and !
|
|
||||||
! bits per datapoint and print the miscellaneous compres- !
|
|
||||||
! sion information to the standard output. !
|
|
||||||
\*--------------------------------------------------------*/
|
|
||||||
printf(" Compression Time: %*.2f s\n", 25, field->meter.time.ttl);
|
|
||||||
printf(" - Wavelet transformation: %*.2f s\n", 25, field->meter.time.wav);
|
|
||||||
printf(" - Entropy encoding: %*.2f s\n", 25, field->meter.time.ent);
|
|
||||||
printf(" - Codestream assembly: %*.2f s\n", 25, field->meter.time.ass);
|
|
||||||
printf("\n");
|
|
||||||
printf(" Compression Ratio: %*.2f\n", 27, comp_ratio);
|
|
||||||
printf(" - Codestream size: %*s\n", 25, csSize);
|
|
||||||
printf(" - Field size: %*s\n", 25, fdSize);
|
|
||||||
printf(" - Average bpd: %*.2f\n", 27, bpd);
|
|
||||||
printf("==============================================================\n");
|
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
|
||||||
! Calculate the original field size, compression ratio and !
|
|
||||||
! bits per datapoint and print the miscellaneous compres- !
|
|
||||||
! sion information to the standard output. !
|
|
||||||
\*--------------------------------------------------------*/
|
|
||||||
free(csSize);
|
|
||||||
free(fdSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
|
@ -3152,21 +3101,6 @@ main(int argc,
|
||||||
goto OUT;
|
goto OUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------*\
|
|
||||||
! If the verbose flag is set by the function caller, print !
|
|
||||||
! the miscellaneous decompression information to the stan- !
|
|
||||||
! dard output. !
|
|
||||||
\*--------------------------------------------------------*/
|
|
||||||
temp = retrieve_arg(args, "verbose");
|
|
||||||
if(temp != NULL)
|
|
||||||
{
|
|
||||||
printf("==============================================================\n");
|
|
||||||
printf(" Decompression Time: %*.2f s\n", 24, field->meter.time.ttl);
|
|
||||||
printf(" - Wavelet transformation: %*.2f s\n", 24, field->meter.time.wav);
|
|
||||||
printf(" - Entropy encoding: %*.2f s\n", 24, field->meter.time.ent);
|
|
||||||
printf("==============================================================\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------*\
|
/*--------------------------------------------------------*\
|
||||||
! !
|
! !
|
||||||
|
|
Loading…
Reference in a new issue