Compare commits

..

6 commits
main ... hipify

26 changed files with 1585 additions and 1289 deletions

13
.gitignore vendored
View file

@ -131,13 +131,9 @@ share/python-wheels/
MANIFEST MANIFEST
# Files and Archives # Files and Archives
*.eas .eas
*.npz .npz
*.zip .zip
*.bwc
# Profiling assets
valgrind-out.txt
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
@ -196,9 +192,6 @@ target/
profile_default/ profile_default/
ipython_config.py ipython_config.py
# vscode
.vscode
# pyenv # pyenv
# For a library or package, you might want to ignore these files since the code is # For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in: # intended to run in multiple environments; otherwise, check them in:

View file

@ -131,8 +131,7 @@ message(STATUS "Compiling with C++ standard: ${CMAKE_CXX_STANDARD}")
# Check if the OpenMP package is available for the current # # Check if the OpenMP package is available for the current #
# setup and set the appropriate C/C++ flags. # # setup and set the appropriate C/C++ flags. #
#----------------------------------------------------------# #----------------------------------------------------------#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}") if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(STATUS "Enable OpenMP parallelization")
find_package(OpenMP) find_package(OpenMP)
if (OPENMP_FOUND) if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
@ -141,6 +140,44 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}")
endif() endif()
endif() endif()
#----------------------------------------------------------#
# Setup GPU runtime (works for HIP) #
#----------------------------------------------------------#
if (NOT CMAKE_GPU_RUNTIME)
set(GPU_RUNTIME "ROCM" CACHE STRING "Switches between ROCM and CUDA")
else (NOT CMAKE_GPU_RUNTIME)
set(GPU_RUNTIME "${CMAKE_GPU_RUNTIME}" CACHE STRING "Switches between ROCM and CUDA")
endif (NOT CMAKE_GPU_RUNTIME)
# Really should only be ROCM or CUDA, but allowing HIP because it is the currently built-in option
set(GPU_RUNTIMES "ROCM" "CUDA" "HIP")
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP, ROCM, or CUDA.")
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
# GPU_RUNTIME for AMD GPUs should really be ROCM, if selecting AMD GPUs
# so manually resetting to HIP if ROCM is selected
if (${GPU_RUNTIME} MATCHES "ROCM")
set(GPU_RUNTIME "HIP")
endif (${GPU_RUNTIME} MATCHES "ROCM")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
enable_language(${GPU_RUNTIME})
set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if (DEFINED ENV{HIP_PATH})
set(HIP_PATH $ENV{HIP_PATH})
else (DEFINED ENV{HIP_PATH})
execute_process(COMMAND hipconfig --path OUTPUT_VARIABLE HIP_PATH ERROR_QUIET)
endif (DEFINED ENV{HIP_PATH})
set(ROCMCC_FLAGS "${ROCMCC_FLAGS} -munsafe-fp-atomics")
if (${GPU_RUNTIME} MATCHES "HIP")
set(HIPCC_FLAGS "${ROCMCC_FLAGS}")
else (${GPU_RUNTIME} MATCHES "HIP")
set(HIPCC_FLAGS "${CUDACC_FLAGS} -I/${HIP_PATH}/include")
endif (${GPU_RUNTIME} MATCHES "HIP")
#----------------------------------------------------------# #----------------------------------------------------------#
# Add all necessary compiler warnings for debugging. # # Add all necessary compiler warnings for debugging. #
#----------------------------------------------------------# #----------------------------------------------------------#
@ -182,8 +219,6 @@ 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()
#----------------------------------------------------------# #----------------------------------------------------------#

View file

@ -53,20 +53,14 @@
.PHONY: single .PHONY: single
.PHONY: tool .PHONY: tool
.PHONY: profiling
.PHONY: omp
.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. #
@ -79,10 +73,6 @@ BUILD_PREC="Double"
BUILD_TOOL="False" BUILD_TOOL="False"
BUILD_PROF="False"
BUILD_OMP="False"
BUILD_EAS3="False" BUILD_EAS3="False"
BUILD_NETCDF="False" BUILD_NETCDF="False"
@ -105,25 +95,12 @@ help:
@echo "" @echo ""
@echo " [Type] [Description]" @echo " [Type] [Description]"
@echo "" @echo ""
@echo " debug Compiles BigWhoop with all relevant debug flags." @echo " debug Compiles BigWhoop and the command line tool with "
@echo " full file support. All relevant debug flags are set."
@echo "" @echo ""
@echo " full Removes all files and folders created during a pre-" @echo " full Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP " @echo " ble) and the command line tool with full file sup-"
@echo " enabled if applicable). Code optimization is set to" @echo " port. Code optimization is set to the highest level."
@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 " cldebug 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."
@ -139,10 +116,6 @@ 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 " omp Enable OpenMP parallelization."
@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 ""
@ -152,7 +125,7 @@ help:
#*--------------------------------------------------------*# #*--------------------------------------------------------*#
# Define private targets. # # Define private targets. #
#*--------------------------------------------------------*# #*--------------------------------------------------------*#
build_debug: --build_debug:
$(eval BUILD_TYPE="Debug") $(eval BUILD_TYPE="Debug")
#*--------------------------------------------------------*# #*--------------------------------------------------------*#
@ -170,17 +143,6 @@ single:
tool: tool:
$(eval BUILD_TOOL="True") $(eval BUILD_TOOL="True")
#*--------------------------------------------------------*#
# Define target used to activate profiling. #
#*--------------------------------------------------------*#
profiling:
$(eval BUILD_PROF="True")
#*--------------------------------------------------------*#
# Define target used to activate OpenMP parallelization. #
#*--------------------------------------------------------*#
omp:
$(eval BUILD_OMP="True")
#*--------------------------------------------------------*# #*--------------------------------------------------------*#
# Define targets used to activate file format support. # # Define targets used to activate file format support. #
@ -194,11 +156,9 @@ netCDF:
#*--------------------------------------------------------*# #*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. # # Define the wrappers for the compile command targets. #
#*--------------------------------------------------------*# #*--------------------------------------------------------*#
debug: | clean build_debug build_bwc display debug: | clean --build_debug tool eas3 build_bwc display
full: | clean build_bwc display
release: | build_bwc display release: | build_bwc display
cmdl: | clean tool profiling eas3 build_bwc display full: | clean tool 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. #
@ -222,7 +182,6 @@ 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)"
@ -233,7 +192,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}" "-DPROF=${BUILD_PROF}" "-DOMP=${BUILD_OMP}" "-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}" "-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

View file

@ -1,158 +0,0 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| DESCRIPTION: |!
!| ------------ |!
!| |!
!| DESCRIPTION NEEDED. |!
!| | | |!
!| |!
!| -------------------------------------------------------------------------------------------- |!
!| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |!
!| |!
!| Redistribution and use in source and binary forms, with or without modification, are |!
!| permitted provided that the following conditions are met: |!
!| |!
!| (1) Redistributions of source code must retain the above copyright notice, this list of |!
!| conditions and the following disclaimer. |!
!| |!
!| (2) Redistributions in binary form must reproduce the above copyright notice, this list |!
!| of conditions and the following disclaimer in the documentation and/or other |!
!| materials provided with the distribution. |!
!| |!
!| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS |!
!| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |!
!| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |!
!| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |!
!| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |!
!| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |!
!| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |!
!| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |!
!| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |!
!| |!
!*================================================================================================*!
module MODULE_FILE
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE FLOAT VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE CHAR VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE STRUCTS: !
!*-----------------------*!
!*--------------------------------------------------------*!
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
!*--------------------------------------------------------*!
!************************************************************************************************!
!| _ _ _ ____ _ _ _ ___ ____ |!
!| | |\ | | | | | | \ |___ |!
!| | | \| |___ |___ |__| |__/ |___ |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ |!
!| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ |!
!| | | \ | | | | | | \/ |___ | | | |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| _ _ ____ ____ ____ ____ ____ |!
!| |\/| |__| | |__/ | | [__ |!
!| | | | | |___ | \ |__| ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ |!
!| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ |!
!| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ |!
!| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ _ _ ___ ____ ____ |!
!| | \_/ |__] |___ [__ |!
!| | | | |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ |!
!| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ |!
!| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] |!
!| |!
!************************************************************************************************!
!------------------------------------------------------------------------------------------------!
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
!------------------------------------------------------------------------------------------------!
!============================|=========================|==========================================
!************************************************************************************************!
!| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ |!
!| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |!
!| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
!------------------------------------------------------------------------------------------------!
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
! ARGUMENTS: !
! ---------- !
! Name Description !
! ---- ----------- !
! - - !
! !
! RETURN: !
! ------- !
! - !
! !
!------------------------------------------------------------------------------------------------!
!===========|==========================|======================|======|=======|====================
!=================================================================================================
end module MODULE_FILE

View file

@ -1,178 +0,0 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| DESCRIPTION NEEDED. ||
|| | | ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*================================================================================================*/
/**************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ ||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\**************************************************************************************************/
/*------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
! RETURN: !
! ------- !
! !
! - !
! !
\*------------------------------------------------------------------------------------------------*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*--------------------------------------------------------*\
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
\*--------------------------------------------------------*/
#ifndef HEADER_H
#define HEADER_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
\*----------------------------------------------------------------------------------------------*/
//===========================|=========================|==========================================
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
//==========|==========================|======================|======|=======|====================
//================================================================================================
#endif

View file

@ -1,121 +0,0 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| DESCRIPTION NEEDED. |#
#| | | |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*================================================================================================*#
#**************************************************************************************************#
#| _ _ _ ___ ____ ____ ___ |#
#| | |\/| |__] | | |__/ | |#
#| | | | | |__| | \ | |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ |#
#| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ |#
#| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ |#
#| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ |#
#| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |#
#| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
#==================================================================================================#
#--------------------------------------------------------------------------------------------------#
# #
# DESCRIPTION: #
# ------------ #
# #
# DESCRIPTION NEEDED #
# | | #
# #
# ARGUMENTS: #
# ---------- #
# Name Description #
# ---- ----------- #
# - - #
# #
# RETURN: #
# ------- #
# - #
# #
#--------------------------------------------------------------------------------------------------#
#-------------------------#
# DEFINE INT VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE FLOAT VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE CHAR VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE STRUCTS: #
#-------------------------#
#----------------------------------------------------------#
# COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT #
#----------------------------------------------------------#

View file

@ -1,47 +0,0 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| DESCRIPTION NEEDED. |#
#| | | |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*================================================================================================*#
#----------------------------------------------------------#
# COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT #
#----------------------------------------------------------#

299
docs/templates/header.h vendored Executable file
View file

@ -0,0 +1,299 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: header.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V - header file created ||
|| - Patrick Vogler B880CA2 V - header file patched ||
|| - Patrick Vogler B87E7E4 V - header file updated ||
|| - Patrick Vogler B87F684 V - header file new version ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
#ifndef HEADER_H
#define HEADER_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Macros created !
! - Patrick Vogler B880CA2 V - Macros patched !
! - Patrick Vogler B87E7E4 V - Macros updated !
! - Patrick Vogler B87F684 V - Macros new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Constants created !
! - Patrick Vogler B880CA2 V - Constants patched !
! - Patrick Vogler B87E7E4 V - Constants updated !
! - Patrick Vogler B87F684 V - Constants new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! VARIABLES: !
! ----------- !
! VARIABLE Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Variables created !
! - Patrick Vogler B880CA2 V - Variables patched !
! - Patrick Vogler B87E7E4 V - Variables updated !
! - Patrick Vogler B87F684 V - Variables new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Constants created !
! - Patrick Vogler B880CA2 V - Constants patched !
! - Patrick Vogler B87E7E4 V - Constants updated !
! - Patrick Vogler B87F684 V - Constants new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Struct created !
! - Patrick Vogler B880CA2 V - Struct patched !
! - Patrick Vogler B87E7E4 V - Struct updated !
! - Patrick Vogler B87F684 V - Struct new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Enum created !
! - Patrick Vogler B880CA2 V - Enum patched !
! - Patrick Vogler B87E7E4 V - Enum updated !
! - Patrick Vogler B87F684 V - Enum new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*\
! UNION NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Union created !
! - Patrick Vogler B880CA2 V - Union patched !
! - Patrick Vogler B87E7E4 V - Union updated !
! - Patrick Vogler B87F684 V - Union new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
#endif

179
docs/templates/source.c vendored Executable file
View file

@ -0,0 +1,179 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: source.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V - source file created ||
|| - Patrick Vogler B880CA2 V - source file patched ||
|| - Patrick Vogler B87E7E4 V - source file updated ||
|| - Patrick Vogler B87F684 V - source file new version ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ ||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *template(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - function created !
! - Patrick Vogler B880CA2 V - function patched !
! - Patrick Vogler B87E7E4 V - function updated !
! - Patrick Vogler B87F684 V - function new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - function created !
! - Patrick Vogler B880CA2 V - function patched !
! - Patrick Vogler B87E7E4 V - function updated !
! - Patrick Vogler B87F684 V - function new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*--------------------------------------------------------*\
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
\*--------------------------------------------------------*/

View file

@ -103,19 +103,4 @@
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

View file

@ -72,14 +72,6 @@
uint8 const nPar, uint8 const nPar,
char *const file_extension); char *const file_extension);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar bwc_set_com (bwc_data *const data,
char const *const com,
uint16 const size);
//==========|==========================|======================|======|=======|====================
uchar bwc_set_aux (bwc_data *const data,
char const *const aux,
uint32 const size);
//==========|==========================|======================|======|=======|====================
void bwc_add_param (bwc_data *const data, void bwc_add_param (bwc_data *const data,
char *const name, char *const name,
uint8 const precision); uint8 const precision);
@ -98,16 +90,16 @@
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_error_resilience (bwc_field *const field); void bwc_set_error_resilience (bwc_field *const field);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_quant_style (bwc_field *const field, void bwc_set_quant_style (bwc_field *const field,
bwc_quant_st const quantization_style); bwc_quant_st const quantization_style);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_quant_step_size (bwc_field *const field, void bwc_set_quant_step_size (bwc_field *const field,
double const delta); double const delta);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_progression (bwc_field *const field, void bwc_set_progression (bwc_field *const field,
bwc_prog_ord const progression); bwc_prog_ord const progression);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_kernels (bwc_field *const field, void bwc_set_kernels (bwc_field *const field,
bwc_dwt_filter const KernelX, bwc_dwt_filter const KernelX,
bwc_dwt_filter const KernelY, bwc_dwt_filter const KernelY,
bwc_dwt_filter const KernelZ, bwc_dwt_filter const KernelZ,

View file

@ -0,0 +1,10 @@
//#ifdef __cpluplus
extern "C" {
//#endif
void bwc_saxpy();
//#ifdef __cpluplus
}
//#endif

View file

@ -689,8 +689,7 @@
uint8 guard_bits; // Number of guard bits during quant. uint8 guard_bits; // Number of guard bits during quant.
uint64 headerSize; // Size estimation of the global header. bwc_stream header; // Main codestream header.
uint64 codestreamSize; // Size of entire code-stream.
bwc_quant_st quantization_style; // Quantization style. bwc_quant_st quantization_style; // Quantization style.
bwc_prog_ord progression; // Packet progression order. bwc_prog_ord progression; // Packet progression order.
@ -715,7 +714,23 @@
bwc_tile *tile; // Structure defining bwc tile. bwc_tile *tile; // Structure defining bwc tile.
bwc_stream *aux; // Auxiliary info. codestream block. struct meter
bwc_stream *com; // Comment codestream block. {
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

View file

@ -91,7 +91,7 @@ destination = current_path.joinpath('include/library/public')
if os.path.isdir(destination) == False: if os.path.isdir(destination) == False:
os.mkdir(destination) os.mkdir(destination)
include_files = ['macros.h', 'constants.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h', include_files = ['macros.h', 'constants.h', 'saxpy.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h',
'bitstream.h', 'codestream.h', 'tier1.h', 'tier2.h', 'types.h', 'libbwc.h'] 'bitstream.h', 'codestream.h', 'tier1.h', 'tier2.h', 'types.h', 'libbwc.h']
exclude_files = ["prim_types_double.h", "prim_types_single.h"] exclude_files = ["prim_types_double.h", "prim_types_single.h"]
all_files = [f for f in os.listdir(source) if os.path.isfile(os.path.join(source, f))] all_files = [f for f in os.listdir(source) if os.path.isfile(os.path.join(source, f))]

View file

@ -1486,6 +1486,7 @@ write_eas3(bwc_data *const data, char *const filename)
return 1; return 1;
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Calculate the size of the data field used for the endian ! ! Calculate the size of the data field used for the endian !
! conversion and write operations. ! ! conversion and write operations. !

View file

@ -80,6 +80,7 @@ add_library(bwclib ${BWC_LINK} bitstream.c
codestream.c codestream.c
dwt.c dwt.c
mq.c mq.c
saxpy.hip
tier1.c tier1.c
tier2.c tier2.c
tagtree.c) tagtree.c)
@ -94,15 +95,6 @@ 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. #

View file

@ -137,28 +137,20 @@ can_read(bitstream *const stream, const uint64 length)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static void static void
codestream_write_header(bitstream *const stream, codestream_write_header(bitstream *const stream, bwc_field *const field)
bwc_field *const field)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
\*-----------------------*/ \*-----------------------*/
uint64 Lcss;
uint32 t; uint32 t;
uint32 Laux;
uint16 Linf, Lctr, Lcom;
uint16 Leoh; uint16 Leoh;
uint8 p, l; uint8 p;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
bwc_gl_ctrl *control; bwc_gl_ctrl *control;
bwc_gl_inf *info; bwc_gl_inf *info;
bwc_tile *tile;
bwc_parameter *parameter;
bwc_stream *aux;
bwc_stream *com;
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
@ -171,116 +163,46 @@ codestream_write_header(bitstream *const stream,
! structure to temporary variables to make the code more ! ! structure to temporary variables to make the code more !
! readable. ! ! readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
info = field->info;
control = &field->control; control = &field->control;
info = field->info;
tile = &field->tile[0]; /*--------------------------------------------------------*\
! Calculate the size of the end of header (EOH) maker seg- !
! ment - excluding the EOH marker. !
\*--------------------------------------------------------*/
Leoh = 2 + (control->nTiles * info->nPar * 2 * PREC_BYTE);
parameter = &tile->parameter[0]; /*--------------------------------------------------------*\
! Emit the portion of the main header already created by !
aux = field->aux; ! the bwc_create_compression function. !
com = field->com; \*--------------------------------------------------------*/
emit_chunck(stream, control->header.memory, control->header.size);
Linf = 40 + info->nPar * 25;
Lctr = 50 + control->nLayers * 4;
Leoh = info->nPar * control->nTiles * 2 * PREC_BYTE;
Lcss = control->codestreamSize;
emit_symbol(stream, SOC, 2);
emit_symbol(stream, Lcss, 8);
emit_symbol(stream, SGI, 2);
emit_symbol(stream, Linf, 2);
emit_symbol(stream, info->nX, 8);
emit_symbol(stream, info->nY, 8);
emit_symbol(stream, info->nZ, 8);
emit_symbol(stream, info->nTS, 2);
emit_symbol(stream, info->nPar, 1);
emit_symbol(stream, info->precision, 1);
emit_chunck(stream, (uchar*)info->f_ext, 10);
for(p = 0; p < info->nPar; ++p)
{
emit_chunck(stream, (uchar*)parameter[p].info.name, 24);
emit_symbol(stream, parameter[p].info.precision, 1);
}
emit_symbol(stream, SGC, 2);
emit_symbol(stream, Lctr, 2);
emit_symbol(stream, control->CSsgc, 2);
emit_symbol(stream, control->error_resilience, 1);
emit_symbol(stream, control->quantization_style, 1);
emit_symbol(stream, control->guard_bits, 1);
emit_symbol(stream, control->qt_exponent, 1);
emit_symbol(stream, control->qt_mantissa, 2);
emit_symbol(stream, control->progression, 1);
emit_symbol(stream, control->KernelX << 6 | control->KernelY << 4 |
control->KernelZ << 2 | control->KernelTS, 1);
emit_symbol(stream, control->decompX, 1);
emit_symbol(stream, control->decompY, 1);
emit_symbol(stream, control->decompZ, 1);
emit_symbol(stream, control->decompTS, 1);
emit_symbol(stream, control->precSizeY << 4 | control->precSizeX, 1);
emit_symbol(stream, control->precSizeTS << 4 | control->precSizeZ, 1);
emit_symbol(stream, control->cbX, 1);
emit_symbol(stream, control->cbY, 1);
emit_symbol(stream, control->cbZ, 1);
emit_symbol(stream, control->cbTS, 1);
emit_symbol(stream, control->Qm, 1);
emit_symbol(stream, control->tileSizeX, 8);
emit_symbol(stream, control->tileSizeY, 8);
emit_symbol(stream, control->tileSizeZ, 8);
emit_symbol(stream, control->tileSizeTS, 2);
emit_symbol(stream, control->nLayers, 1);
for(l = 0; l < control->nLayers; ++l)
{
emit_symbol(stream, *(uint32 *)&control->bitrate[l], 4);
}
if(aux != NULL)
{
Laux = aux->size + 4;
emit_symbol(stream, SAX, 2);
emit_symbol(stream, Laux, 4);
emit_chunck(stream, aux->memory, aux->size);
}
if(com != NULL)
{
Lcom = com->size + 2;
emit_symbol(stream, COM, 2);
emit_symbol(stream, Lcom, 2);
emit_chunck(stream, com->memory, com->size);
}
/*--------------------------------------------------------*\
! Emit the end of header (EOH) marker and EOH marker seg- !
! ment size Leoh. !
\*--------------------------------------------------------*/
emit_symbol(stream, EOH, 2); emit_symbol(stream, EOH, 2);
emit_symbol(stream, Leoh, 2); emit_symbol(stream, Leoh, 2);
/*--------------------------------------------------------*\
! Loop through all tile parameters and... !
\*--------------------------------------------------------*/
for(t = 0; t < control->nTiles; ++t) for(t = 0; t < control->nTiles; ++t)
{ {
for(p = 0; p < info->nPar; ++p) for(p = 0; p < info->nPar; ++p)
{ {
/*--------------------------------------------------------*\
! ...emit the maximum and minimum parameter value to the !
! header stream. !
\*--------------------------------------------------------*/
emit_symbol(stream, *(uint64 *)&field->tile[t].parameter[p].info.parameter_min, PREC_BYTE);
emit_symbol(stream, *(uint64 *)&field->tile[t].parameter[p].info.parameter_max, PREC_BYTE);
emit_symbol(stream, *(uint64 *)&field->tile[t]. /*--------------------------------------------------------*\
parameter[p].info. ! Reset the maximum and minimum parameter value in the !
parameter_min, PREC_BYTE); ! parameter structure. !
emit_symbol(stream, *(uint64 *)&field->tile[t]. \*--------------------------------------------------------*/
parameter[p].info.
parameter_max, PREC_BYTE);
field->tile[t].parameter[p].info.parameter_max = -FLT_MAX; field->tile[t].parameter[p].info.parameter_max = -FLT_MAX;
field->tile[t].parameter[p].info.parameter_min = FLT_MAX; field->tile[t].parameter[p].info.parameter_min = FLT_MAX;
} }
@ -553,6 +475,7 @@ assemble_tile(bwc_field *const field, bwc_tile *const tile, bitstream *const str
emit_symbol(stream, tile->info.tile_index, 4); emit_symbol(stream, tile->info.tile_index, 4);
emit_symbol(stream, tile->control.body_size, 8); emit_symbol(stream, tile->control.body_size, 8);
emit_symbol(stream, SOD, 2); emit_symbol(stream, SOD, 2);
for(packet_index = 0; packet_index < tile->control.nPackets; ++packet_index) for(packet_index = 0; packet_index < tile->control.nPackets; ++packet_index)
{ {
packet = tile->packet_sequence[packet_index]; packet = tile->packet_sequence[packet_index];
@ -630,7 +553,9 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
uint16 Linf, Lctr, Lcom, Leoh, Lunk; uint16 Linf, Lctr, Lcom, Leoh, Lunk;
uint16 marker; uint16 marker;
uint16 nTS; uint16 nTS;
uint8 dim;
uint8 index, l; uint8 index, l;
uint8 samp;
uint8 nPar, p; uint8 nPar, p;
uint8 codec_prec, precision; uint8 codec_prec, precision;
@ -676,16 +601,12 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
{ {
case SOC: case SOC:
{ {
if(index != 0 && !can_read(stream, 2)) if(index != 0)
{ {
// Invalid Codestream // Invalid Codestream
fprintf(stderr, CSERROR); fprintf(stderr, CSERROR);
status |= CODESTREAM_ERROR; status |= CODESTREAM_ERROR;
break;
} }
stream->Lmax = (uint64)get_symbol(stream, 8);
break; break;
} }
@ -716,7 +637,7 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
info->precision = codec_prec = (uint8)get_symbol(stream, 1); info->precision = codec_prec = (uint8)get_symbol(stream, 1);
buffer_char = (char*)get_chunck(stream, 10); buffer_char = (char*)get_chunck(stream, 10);
strncpy(info->f_ext, buffer_char, sizeof(buffer_char)/sizeof(*buffer_char)); strncpy(info->f_ext, buffer_char, 10);
free(buffer_char); free(buffer_char);
for(p = 0; p < nPar; ++p) for(p = 0; p < nPar; ++p)
@ -743,8 +664,6 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
info = field->info = &data->info; info = field->info = &data->info;
control = &field->control; control = &field->control;
control->codestreamSize = stream->Lmax;
status |= CODESTREAM_SGI_READ; status |= CODESTREAM_SGI_READ;
break; break;
} }
@ -784,7 +703,7 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
if(CSsgc & (0x01 << 1)) if(CSsgc & (0x01 << 1))
{ {
set_quant_style(field, (bwc_quant_st)buff_long); bwc_set_quant_style(field, (bwc_quant_st)buff_long);
} }
buff_long = get_symbol(stream, 1); buff_long = get_symbol(stream, 1);
@ -800,13 +719,13 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
buff_long = get_symbol(stream, 1); buff_long = get_symbol(stream, 1);
if(CSsgc & (0x01 << 3)) if(CSsgc & (0x01 << 3))
{ {
set_progression(field, (uint8)buff_long); bwc_set_progression(field, (uint8)buff_long);
} }
buff_long = get_symbol(stream, 1); buff_long = get_symbol(stream, 1);
if(CSsgc & (0x01 << 4)) if(CSsgc & (0x01 << 4))
{ {
set_kernels(field, (uint8)(0x03 & (buff_long >> 6)), (uint8)(0x03 & (buff_long >> 4)), bwc_set_kernels(field, (uint8)(0x03 & (buff_long >> 6)), (uint8)(0x03 & (buff_long >> 4)),
(uint8)(0x03 & (buff_long >> 2)), (uint8)(0x03 & buff_long)); (uint8)(0x03 & (buff_long >> 2)), (uint8)(0x03 & buff_long));
} }
@ -1335,6 +1254,311 @@ parse_body(bwc_field *const field, bitstream *const stream)
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| || || ||
\************************************************************************************************************/ \************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
assemble_main_header(bwc_field *const field)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 size;
uint16 Linf, Lctr;
uint8 p, l;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_ctrl *control;
bwc_gl_inf *info;
bwc_tile *tile;
bwc_parameter *parameter;
bitstream *stream;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(field);
/*--------------------------------------------------------*\
! Save the global as well as the subband control and info !
! structure to temporary variables to make the code more !
! readable. !
\*--------------------------------------------------------*/
info = field->info;
control = &field->control;
tile = &field->tile[0];
parameter = &tile->parameter[0];
Linf = 40 + info->nPar * 25;
Lctr = 50 + control->nLayers * 4;
size = 6 + Linf + Lctr;
stream = init_stream(NULL, size, 'c');
if(!stream)
{
// memory allocation error
return 1;
}
emit_symbol(stream, SOC, 2);
emit_symbol(stream, SGI, 2);
emit_symbol(stream, Linf, 2);
emit_symbol(stream, info->nX, 8);
emit_symbol(stream, info->nY, 8);
emit_symbol(stream, info->nZ, 8);
emit_symbol(stream, info->nTS, 2);
emit_symbol(stream, info->nPar, 1);
emit_symbol(stream, info->precision, 1);
emit_chunck(stream, (uchar*)info->f_ext, 10);
for(p = 0; p < info->nPar; ++p)
{
emit_chunck(stream, (uchar*)parameter[p].info.name, 24);
emit_symbol(stream, parameter[p].info.precision, 1);
}
emit_symbol(stream, SGC, 2);
emit_symbol(stream, Lctr, 2);
emit_symbol(stream, control->CSsgc, 2);
emit_symbol(stream, control->error_resilience, 1);
emit_symbol(stream, control->quantization_style, 1);
emit_symbol(stream, control->guard_bits, 1);
emit_symbol(stream, control->qt_exponent, 1);
emit_symbol(stream, control->qt_mantissa, 2);
emit_symbol(stream, control->progression, 1);
emit_symbol(stream, control->KernelX << 6 | control->KernelY << 4 |
control->KernelZ << 2 | control->KernelTS, 1);
emit_symbol(stream, control->decompX, 1);
emit_symbol(stream, control->decompY, 1);
emit_symbol(stream, control->decompZ, 1);
emit_symbol(stream, control->decompTS, 1);
emit_symbol(stream, control->precSizeY << 4 | control->precSizeX, 1);
emit_symbol(stream, control->precSizeTS << 4 | control->precSizeZ, 1);
emit_symbol(stream, control->cbX, 1);
emit_symbol(stream, control->cbY, 1);
emit_symbol(stream, control->cbZ, 1);
emit_symbol(stream, control->cbTS, 1);
emit_symbol(stream, control->Qm, 1);
emit_symbol(stream, control->tileSizeX, 8);
emit_symbol(stream, control->tileSizeY, 8);
emit_symbol(stream, control->tileSizeZ, 8);
emit_symbol(stream, control->tileSizeTS, 2);
emit_symbol(stream, control->nLayers, 1);
for(l = 0; l < control->nLayers; ++l)
{
emit_symbol(stream, *(uint32 *)&control->bitrate[l], 4);
}
if(terminate_stream(stream, &control->header))
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
}
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
codestream_write_aux(bwc_stream *const header, bwc_stream *const aux)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint32 Laux;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bitstream *stream;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(header);
assert(aux);
stream = init_stream(header->memory, header->size, 'c');
if(!stream)
{
// memory allocation error
return 1;
}
Laux = aux->size + 4;
stream->L = stream->Lmax;
stream->Lmax += Laux + 2;
stream->memory = realloc(stream->memory, stream->Lmax);
if(!stream->memory)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
}
emit_symbol(stream, SAX, 2);
emit_symbol(stream, Laux, 4);
emit_chunck(stream, aux->memory, aux->size);
if(terminate_stream(stream, header))
{
// memory allocation error
return 1;
}
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
codestream_write_com(bwc_stream *const header, bwc_stream *const com)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint16 Lcom;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bitstream *stream;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(header);
assert(com);
stream = init_stream(header->memory, header->size, 'c');
if(!stream)
{
// memory allocation error
return 1;
}
Lcom = com->size + 2;
stream->L = stream->Lmax;
stream->Lmax += Lcom + 2;
stream->memory = realloc(stream->memory, stream->Lmax);
if(!stream->memory)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
}
emit_symbol(stream, COM, 2);
emit_symbol(stream, Lcom, 2);
emit_chunck(stream, com->memory, com->size);
if(terminate_stream(stream, header))
{
// memory allocation error
return 1;
}
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_stream* assemble_codestream(bwc_field *const field) ! ! FUNCTION NAME: bwc_stream* assemble_codestream(bwc_field *const field) !
! -------------- ! ! -------------- !
@ -1370,7 +1594,7 @@ assemble_codestream(bwc_field *const field)
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
\*-----------------------*/ \*-----------------------*/
uint64 i; uint64 i, size;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -1392,8 +1616,7 @@ assemble_codestream(bwc_field *const field)
! bytes. ! ! bytes. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &field->control;
size = control->header.size;
control->codestreamSize = control->headerSize + 2;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk through the tile structure and assemble the packed ! ! Walk through the tile structure and assemble the packed !
@ -1415,15 +1638,15 @@ assemble_codestream(bwc_field *const field)
{ {
return NULL; return NULL;
} }
control->codestreamSize += tile->control.header_size +
tile->control.body_size; size += tile->control.header_size + tile->control.body_size;
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the final codestream and emit the header ! ! Initialize the final codestream and emit the header !
! bytes. ! ! bytes. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
stream = init_stream(NULL, control->codestreamSize, 'c'); stream = init_stream(NULL, size, 'c');
codestream_write_header(stream, field); codestream_write_header(stream, field);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -1432,7 +1655,6 @@ assemble_codestream(bwc_field *const field)
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
for(i = 0; i < control->nTiles; ++i) for(i = 0; i < control->nTiles; ++i)
{ {
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the tile structure in a temporary variable to make ! ! Save the tile structure in a temporary variable to make !
! the code more readable. ! ! the code more readable. !
@ -1512,7 +1734,8 @@ parse_codestream(bwc_data *const data, uint8 const layer)
! Initialize a bitstream used to parse the packed code- ! ! Initialize a bitstream used to parse the packed code- !
! stream. ! ! stream. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
stream = init_stream(data->codestream.data->memory, 10, 'd'); stream = init_stream(data->codestream.data->memory,
data->codestream.data->size, 'd');
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Parse the main header and set up the field structure for ! ! Parse the main header and set up the field structure for !

View file

@ -55,9 +55,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined (_OPENMP)
#include <omp.h> #include <omp.h>
#endif
#include "constants.h" #include "constants.h"
#include "macros.h" #include "macros.h"
@ -486,6 +484,8 @@ whole_point_symmetric_extend(bwc_sample *const working_buffer, uint64 res0, uint
! 25.06.2018 Patrick Vogler B87D120 V 0.1.0 function created ! ! 25.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
// INCLUDE HIP SAXPY
//#include "saxpy.h"
static void static void
forward_9x7_CDF_wavelet_transform(bwc_sample *const working_buffer, uint64 res0, uint64 res1) forward_9x7_CDF_wavelet_transform(bwc_sample *const working_buffer, uint64 res0, uint64 res1)
{ {
@ -537,6 +537,9 @@ forward_9x7_CDF_wavelet_transform(bwc_sample *const working_buffer, uint64 res0,
working_buffer[i].f += DELTA * (working_buffer[i - 1].f + working_buffer[i + 1].f); working_buffer[i].f += DELTA * (working_buffer[i - 1].f + working_buffer[i + 1].f);
working_buffer[i].f = KAPPA_L * working_buffer[i].f; working_buffer[i].f = KAPPA_L * working_buffer[i].f;
} }
// INCLUDE HIP SAXPY
//bwc_saxpy();
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
@ -1624,22 +1627,18 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
uint64 rX1, rY1, rZ1; uint64 rX1, rY1, rZ1;
uint64 width, height, depth; uint64 width, height, depth;
uint64 x, y, z; uint64 x, y, z;
int64 nThreads;
int16 i;
uint32 buff_size; uint32 buff_size;
int16 i;
uint16 incr_TS; uint16 incr_TS;
uint16 rTS0; uint16 rTS0;
uint16 rTS1; uint16 rTS1;
uint16 dt; uint16 dt;
uint16 t; uint16 t;
uint8 id; uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ; uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS; uint8 filter_tapsTS;
uint8 level; uint8 level;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2165,22 +2164,18 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
uint64 rX1, rY1, rZ1; uint64 rX1, rY1, rZ1;
uint64 width, height, depth; uint64 width, height, depth;
uint64 x, y, z; uint64 x, y, z;
int64 nThreads;
int64 i;
uint32 buff_size; uint32 buff_size;
int16 i;
uint16 incr_TS; uint16 incr_TS;
uint16 rTS0; uint16 rTS0;
uint16 rTS1; uint16 rTS1;
uint16 dt; uint16 dt;
uint16 t; uint16 t;
uint8 id; uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ; uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS; uint8 filter_tapsTS;
uint8 level; uint8 level;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !

View file

@ -49,13 +49,8 @@
|| || || ||
\************************************************************************************************************/ \************************************************************************************************************/
#include <assert.h> #include <assert.h>
#if defined BWC_PROFILE
#include <inttypes.h>
#endif
#include <math.h> #include <math.h>
#if defined (_OPENMP)
#include <omp.h> #include <omp.h>
#endif
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -78,72 +73,6 @@
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] || || | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| || || ||
\************************************************************************************************************/ \************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! !
! 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 !
! !
\*----------------------------------------------------------------------------------------------------------*/
#ifdef 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, !
@ -682,6 +611,208 @@ initialize_subband(bwc_field *const field, bwc_parameter *const parameter, bwc_r
return 0; return 0;
} }
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_header_append_aux(bwc_field *const field, bwc_stream *const aux) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the main header for the compressed codestream with an auxiliary !
! information block. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! field bwc_field* - Structure defining the compression/ !
! decompression stage. !
! !
! aux unsigned char* - Memory handle for the auxiliary infor- !
! mation block. !
! !
! size unsigned int(32 bit) - Size of the auxiliary information block.!
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! uchar - Returns an unsigned char for error handling. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 12.04.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
static uchar
header_append_aux(bwc_field *const field, bwc_stream *const aux)
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_ctrl *control;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(field);
assert(aux);
/*--------------------------------------------------------*\
! Save the global control and info structure to temporary !
! variables to make the code more readable. !
\*--------------------------------------------------------*/
control = &field->control;
/*--------------------------------------------------------*\
! Check if the main header is already defined in the field !
! structure. !
\*--------------------------------------------------------*/
if(!control->header.memory)
{
fprintf(stderr,"o==========================================================o\n"\
"| ERROR: Main header not defined |\n"\
"| |\n"\
"| Unable to append auxiliary information since the |\n"\
"| main header has not yet been created. Appending |\n"\
"| information to the end of the main header can |\n"\
"| only be done after the bwc_create_compression |\n"\
"| function has been called. |\n"\
"| |\n"\
"o==========================================================o\n");
return 1;
}
/*--------------------------------------------------------*\
! Check if the main header would exceed the maximum number !
! of allowable bits after appending the auxiliary !
! information. !
\*--------------------------------------------------------*/
if(((uint64)control->header.size + aux->size) >= 0xFFFFFFFF)
{
fprintf(stderr,"o==========================================================o\n"\
"| ERROR: Main header exceeds maximum size limit |\n"\
"| |\n"\
"| Appending the auxiliary information to the main |\n"\
"| header would exceed its maximum size limit of |\n"\
"| 4294967295 bytes. |\n"\
"| |\n"\
"o==========================================================o\n");
return 1;
}
if(codestream_write_aux(&control->header, aux))
{
return 1;
}
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_header_append_com(bwc_field *const field, bwc_stream *const com) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the main header for the compressed codestream with a comment !
! block. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! field bwc_field* - Structure defining the compression/ !
! decompression stage. !
! !
! com unsigned char* - Memory handle for the auxiliary infor- !
! mation block. !
! !
! size unsigned int(32 bit) - Size of the auxiliary information block.!
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! uchar - Returns an unsigned char for error handling. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 12.04.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
static uchar
header_append_com(bwc_field *const field, bwc_stream *const com)
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_ctrl *control;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(field);
/*--------------------------------------------------------*\
! Save the global control and info structure to temporary !
! variables to make the code more readable. !
\*--------------------------------------------------------*/
control = &field->control;
/*--------------------------------------------------------*\
! Check if the main header is already defined in the field !
! structure. !
\*--------------------------------------------------------*/
if(!control->header.memory)
{
fprintf(stderr,"o==========================================================o\n"\
"| ERROR: Main header not defined |\n"\
"| |\n"\
"| Unable to append auxiliary information since the |\n"\
"| main header has not yet been created. Appending |\n"\
"| information to the end of the main header can |\n"\
"| only be done after the bwc_create_compression |\n"\
"| function has been called. |\n"\
"| |\n"\
"o==========================================================o\n");
return 1;
}
/*--------------------------------------------------------*\
! Check if the main header would exceed the maximum number !
! of allowable bits after appending the auxiliary !
! information. !
\*--------------------------------------------------------*/
if(((uint64)control->header.size + com->size) >= 0xFFFFFFFF)
{
fprintf(stderr,"o==========================================================o\n"\
"| ERROR: Main header exceeds maximum size limit |\n"\
"| |\n"\
"| Appending the auxiliary information to the main |\n"\
"| header would exceed its maximum size limit of |\n"\
"| 4294967295 bytes. |\n"\
"| |\n"\
"o==========================================================o\n");
return 1;
}
if(codestream_write_com(&control->header, com))
{
return 1;
}
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void fill_buffer(bwc_field *const field, bwc_tile *const tile, ! ! FUNCTION NAME: void fill_buffer(bwc_field *const field, bwc_tile *const tile, !
@ -1009,6 +1140,7 @@ flush_buffer(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const
\*-----------------------*/ \*-----------------------*/
bwc_sample *src; bwc_sample *src;
bwc_gl_inf *info; bwc_gl_inf *info;
bwc_param_ctrl *param_control;
bwc_param_inf *param_info; bwc_param_inf *param_info;
bwc_cmd_opts_ll *param; bwc_cmd_opts_ll *param;
@ -1028,6 +1160,7 @@ flush_buffer(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
info = field->info; info = field->info;
param_control = &parameter->control;
param_info = &parameter->info; param_info = &parameter->info;
nX = info->nX; nX = info->nX;
@ -1587,82 +1720,6 @@ bwc_add_param(bwc_data* data, char *name, uint8 precision)
info->parameter->size = (info->nX * info->nY * info->nZ * info->nTS); info->parameter->size = (info->nX * info->nY * info->nZ * info->nTS);
} }
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: !
! -------------- !
! !
! !
! DESCRIPTION: !
! ------------ !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_set_com(bwc_data *const data, char const *const com, uint16 size)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(data);
assert(com);
/*--------------------------------------------------------*\
! Save the global info structure to a temporary variable !
! to make the code more readable. !
\*--------------------------------------------------------*/
data->codestream.com->memory = calloc(size, sizeof(char));
if(!data->codestream.com->memory)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
}
memcpy(data->codestream.com->memory, com, size * sizeof(char));
data->codestream.com->access = data->codestream.com->memory;
data->codestream.com->size = size;
data->codestream.com->position = 0;
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: !
! -------------- !
! !
! !
! DESCRIPTION: !
! ------------ !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_set_aux(bwc_data *const data, char const *const aux, uint32 size)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(data);
assert(aux);
/*--------------------------------------------------------*\
! Save the global info structure to a temporary variable !
! to make the code more readable. !
\*--------------------------------------------------------*/
data->codestream.com->memory = calloc(size, sizeof(char));
if(!data->codestream.com->memory)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
}
memcpy(data->codestream.com->memory, aux, size * sizeof(char));
data->codestream.com->access = data->codestream.com->memory;
data->codestream.com->size = size;
data->codestream.com->position = 0;
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_field *bwc_initialize_data(...) ! ! FUNCTION NAME: bwc_field *bwc_initialize_data(...) !
! -------------- ! ! -------------- !
@ -1705,6 +1762,9 @@ bwc_get_data(bwc_data* data, uchar* buffer, uint64 size)
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
bwc_gl_inf *info;
info = &data->info;
if(size != (uint64)(data->info.nX * data->info.nY * data->info.nZ * data->info.nTS * data->info.nPar)) if(size != (uint64)(data->info.nX * data->info.nY * data->info.nZ * data->info.nTS * data->info.nPar))
{ {
@ -1945,7 +2005,7 @@ create_field(bwc_field *const field)
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the tile header size. ! ! Initialize the tile header size. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
tile_control->header_size = 18; tile_control->header_size = 14;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the convex hull slope threshold. ! ! Initialize the convex hull slope threshold. !
@ -2349,6 +2409,7 @@ bwc_kill_compression(bwc_field *const field)
free(field->tile[i].parameter); free(field->tile[i].parameter);
} }
} }
free(control->header.memory);
free(control->bitrate); free(control->bitrate);
free(field->tile); free(field->tile);
free(field); free(field);
@ -2648,7 +2709,7 @@ bwc_set_error_resilience(bwc_field *const field)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
void void
set_quant_style(bwc_field *const field, bwc_quant_st quantization_style) bwc_set_quant_style(bwc_field *const field, bwc_quant_st quantization_style)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2714,7 +2775,7 @@ set_quant_style(bwc_field *const field, bwc_quant_st quantization_style)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
void void
set_quant_step_size(bwc_field *const field, double delta) bwc_set_quant_step_size(bwc_field *const field, double delta)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2819,7 +2880,7 @@ set_quant_step_size(bwc_field *const field, double delta)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
void void
set_progression(bwc_field *const field, bwc_prog_ord progression) bwc_set_progression(bwc_field *const field, bwc_prog_ord progression)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2892,7 +2953,7 @@ set_progression(bwc_field *const field, bwc_prog_ord progression)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
void void
set_kernels(bwc_field *const field, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY, bwc_set_kernels(bwc_field *const field, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY,
bwc_dwt_filter KernelZ, bwc_dwt_filter KernelTS) bwc_dwt_filter KernelZ, bwc_dwt_filter KernelTS)
{ {
/*-----------------------*\ /*-----------------------*\
@ -3502,7 +3563,7 @@ bwc_set_tiles(bwc_field *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
! Check if the number of tiles exceeds its maximum allowa- ! ! Check if the number of tiles exceeds its maximum allowa- !
! ble value. ! ! ble value. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(((double)num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS) > 0xFFFFFFFFFFFFFFFF) if(((double)num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS) > (double)0xFFFFFFFFFFFFFFFF)
{ {
fprintf(stderr,"o==========================================================o\n"\ fprintf(stderr,"o==========================================================o\n"\
"| WARNING: Invalid Tile Dimensions |\n"\ "| WARNING: Invalid Tile Dimensions |\n"\
@ -3532,7 +3593,7 @@ bwc_set_tiles(bwc_field *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
! Check if the number of tiles exceeds its maximum allowa- ! ! Check if the number of tiles exceeds its maximum allowa- !
! ble value. ! ! ble value. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(((double)tilesX * tilesY * tilesZ * tilesTS) > 0xFFFFFFFFFFFFFFFF) if(((double)tilesX * tilesY * tilesZ * tilesTS) > (double)0xFFFFFFFFFFFFFFFF)
{ {
fprintf(stderr,"o==========================================================o\n"\ fprintf(stderr,"o==========================================================o\n"\
"| WARNING: Invalid Number Of Tiles |\n"\ "| WARNING: Invalid Number Of Tiles |\n"\
@ -3667,7 +3728,6 @@ bwc_create_compression(bwc_field *field, char *rate_control)
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
bwc_gl_inf *info;
bwc_gl_ctrl *control; bwc_gl_ctrl *control;
/*-----------------------*\ /*-----------------------*\
@ -3679,7 +3739,6 @@ bwc_create_compression(bwc_field *field, char *rate_control)
! Save the global control structure to a temporary varia- ! ! Save the global control structure to a temporary varia- !
! ble to make the code more readable. ! ! ble to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
info = field->info;
control = &field->control; control = &field->control;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3776,34 +3835,13 @@ bwc_create_compression(bwc_field *field, char *rate_control)
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Evaluate the size of the main header. ! ! Create the main header for the compressed codestream and !
! save the memory handle in the field structure. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
/*control->headerSize = 108 + info->nPar * (25 + control->nTiles * 2 * PREC_BYTE) if(assemble_main_header(field))
+ control->nLayers * 4;
if(field->aux != NULL)
{ {
control->headerSize += 6 + field->aux->size;
}
if(field->com != NULL)
{
control->headerSize += 6 + field->com->size;
}
if(control->headerSize >= 0xFFFFFFFF)
{
fprintf(stderr,"o==========================================================o\n"\
"| ERROR: Main header exceeds maximum size limit |\n"\
"| |\n"\
"| Appending the auxiliary information to the main |\n"\
"| header would exceed its maximum size limit of |\n"\
"| 4294967295 bytes. |\n"\
"| |\n"\
"o==========================================================o\n");
return 1; return 1;
}*/ }
return 0; return 0;
} }
@ -3847,30 +3885,11 @@ 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: !
\*-----------------------*/ \*-----------------------*/
#ifdef BWC_PROFILE
double start, end; double start, end;
double bpd = 0;
double cpr = 0;
double ttl = 0;
double cpy = 0;
double nrm = 0;
double wav = 0;
double ent = 0;
double ass = 0;
#endif
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
@ -3889,12 +3908,10 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the compression time measurement. ! ! Initialize the compression time measurement. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
ttl = omp_get_wtime(); field->meter.time.ttl = omp_get_wtime();
#else #else
ttl = (double)clock(); field->meter.time.ttl = (double)clock();
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3905,34 +3922,20 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
info = field->info; info = field->info;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Evaluate the size of the main header. ! ! Check if any auxiliary information has been supplied by !
! the function caller and append the header accordingly. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control->headerSize = 108 + info->nPar * (25 + control->nTiles * 2 * PREC_BYTE) if(data->codestream.aux && header_append_aux(field, data->codestream.aux))
+ control->nLayers * 4;
if(data->codestream.aux != NULL)
{ {
field->aux = data->codestream.aux; return 1;
control->headerSize += 6 + field->aux->size;
} }
if(data->codestream.com != NULL) /*--------------------------------------------------------*\
! Check if any commentary information has been supplied by !
! the function caller and append the header accordingly. !
\*--------------------------------------------------------*/
if(data->codestream.com && header_append_com(field, data->codestream.com))
{ {
field->com = data->codestream.com;
control->headerSize += 6 + field->com->size;
}
if(control->headerSize >= 0xFFFFFFFF)
{
fprintf(stderr,"o==========================================================o\n"\
"| ERROR: Main header exceeds maximum size limit |\n"\
"| |\n"\
"| Appending the auxiliary information to the main |\n"\
"| header would exceed its maximum size limit of |\n"\
"| 4294967295 bytes. |\n"\
"| |\n"\
"o==========================================================o\n");
return 1; return 1;
} }
@ -3975,22 +3978,18 @@ 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. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); start = (double)clock();
#endif #endif
#endif
fill_buffer(field, tile, parameter, working_buffer, data, p); fill_buffer(field, tile, parameter, working_buffer, data, p);
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
cpy += end - start; field->meter.time.cpy += end - start;
#else #else
end = (double)clock(); end = (double)clock();
cpy += (end - start)/CLOCKS_PER_SEC; field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3998,72 +3997,60 @@ 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. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); start = (double)clock();
#endif #endif
#endif
normalize_param(field, parameter); normalize_param(field, parameter);
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
nrm += end - start; field->meter.time.nrm += end - start;
#else #else
end = (double)clock(); end = (double)clock();
nrm += (end - start)/CLOCKS_PER_SEC; field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Perform the forward discrete wavelet transform. ! ! Perform the forward discrete wavelet transform. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); 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;
} }
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
wav += end - start; field->meter.time.wav += end - start;
#else #else
end = (double)clock(); end = (double)clock();
wav += (end - start)/CLOCKS_PER_SEC; field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Tier1 encode the current tile parameter. ! ! Tier1 encode the current tile parameter. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); 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;
} }
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
ent += end - start; field->meter.time.ent += end - start;
#else #else
end = (double)clock(); end = (double)clock();
ent += (end - start)/CLOCKS_PER_SEC; field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -4075,52 +4062,44 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Tier2 encode the current tile. ! ! Tier2 encode the current tile. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); 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;
} }
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
ent += end - start; field->meter.time.ent += end - start;
#else #else
end = (double)clock(); end = (double)clock();
ent += (end - start)/CLOCKS_PER_SEC; field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Assemble compressed codestream. ! ! Assemble compressed codestream. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); 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)
{ {
free(working_buffer); free(working_buffer);
return 1; return 1;
} }
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
ass += end - start; field->meter.time.ass += end - start;
#else #else
end = (double)clock(); end = (double)clock();
ass += (end - start)/CLOCKS_PER_SEC; field->meter.time.ass += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -4129,33 +4108,12 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
free(working_buffer); free(working_buffer);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Output the profiling information. ! ! Calculate the compression time. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
ttl = omp_get_wtime() - ttl; field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
#else #else
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC; field->meter.time.ttl = ((double)clock() - field->meter.time.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
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -4280,18 +4238,8 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*-----------------------*\ /*-----------------------*\
! DEFINE FLOAT VARIABLES: ! ! DEFINE FLOAT VARIABLES: !
\*-----------------------*/ \*-----------------------*/
#ifdef BWC_PROFILE
double start, end; double start, end;
double ttl;
double cpy;
double nrm;
double wav;
double ent;
#endif
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
@ -4311,12 +4259,10 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the decompression time measurement. ! ! Initialize the decompression time measurement. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
ttl = omp_get_wtime(); field->meter.time.ttl = omp_get_wtime();
#else #else
ttl = (double)clock(); field->meter.time.ttl = (double)clock();
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -4404,73 +4350,61 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Tier1 decode the current tile parameter. ! ! Tier1 decode the current tile parameter. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); 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;
} }
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
ent += end - start; field->meter.time.ent += end - start;
#else #else
end = (double)clock(); end = (double)clock();
ent += (end - start)/CLOCKS_PER_SEC; field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Perform the inverse discrete wavelet transform. ! ! Perform the inverse discrete wavelet transform. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); 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;
} }
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
wav += end - start; field->meter.time.wav += end - start;
#else #else
end = (double)clock(); end = (double)clock();
wav += (end - start)/CLOCKS_PER_SEC; field->meter.time.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. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); start = (double)clock();
#endif #endif
#endif
denormalize_param(field, parameter); denormalize_param(field, parameter);
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
nrm += end - start; field->meter.time.nrm += end - start;
#else #else
end = (double)clock(); end = (double)clock();
nrm += (end - start)/CLOCKS_PER_SEC; field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -4478,22 +4412,18 @@ 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. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
start = omp_get_wtime(); start = omp_get_wtime();
#else #else
start = (double)clock(); start = (double)clock();
#endif #endif
#endif
flush_buffer(field, tile, parameter, working_buffer, data, p); flush_buffer(field, tile, parameter, working_buffer, data, p);
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
end = omp_get_wtime(); end = omp_get_wtime();
cpy += end - start; field->meter.time.cpy += end - start;
#else #else
end = (double)clock(); end = (double)clock();
cpy += (end - start)/CLOCKS_PER_SEC; field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
#endif
#endif #endif
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -4510,22 +4440,13 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
free(working_buffer); free(working_buffer);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Output the profiling information. ! ! Calculate the decompression time. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP) #if defined (_OPENMP)
ttl = omp_get_wtime() - ttl; field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
#else #else
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC; field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
#endif #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
return 0; return 0;
} }

53
src/library/saxpy.hip Normal file
View file

@ -0,0 +1,53 @@
#include <hip/hip_runtime.h>
#include <iostream>
#include "saxpy.h"
__constant__ float a = 1.0f;
void init (int n, float *x, float *y)
{
for (std::size_t i = 0; i < n; ++i)
{
x[i] = 1.0;
y[i] = 0.0;
}
}
__global__
void saxpy (int n, float const* x, int incx, float* y, int incy)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < n)
y[i] += a*x[i];
}
void bwc_saxpy()
{
int n = 256;
std::size_t size = sizeof(float)*n;
std::cout << "2 Doing saxpy\n";
float *h_x = new float [n];
float *h_y = new float [n];
init(n, h_x, h_y);
float* d_x;
float *d_y;
hipMalloc(&d_x, size);
hipMalloc(&d_y, size);
hipMemcpy(d_x, h_x, size, hipMemcpyHostToDevice);
hipMemcpy(d_y, h_y, size, hipMemcpyHostToDevice);
int num_groups = 2;
int group_size = 128;
saxpy<<<num_groups, group_size>>>(n, d_x, 1, d_y, 1);
hipDeviceSynchronize();
hipMemcpy(h_y, d_y, size, hipMemcpyDeviceToHost);
std::cout << "Done saxpy\n";
}

View file

@ -55,9 +55,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if defined (_OPENMP)
#include <omp.h> #include <omp.h>
#endif
#include <time.h> #include <time.h>
#include "constants.h" #include "constants.h"
@ -2193,7 +2191,7 @@ compute_convex_hull(bwc_encoded_cblk *const encoded_codeblock, double *const mse
h = hull; h = hull;
hlast = 0; hlast = 0;
lambda [0] = 0xFFFFFFFFFFFFFFFF; lambda [0] = (double)0xFFFFFFFFFFFFFFFF;
for(i = 0; i < encoded_codeblock->Z; ++i) for(i = 0; i < encoded_codeblock->Z; ++i)
{ {
@ -2235,7 +2233,7 @@ compute_convex_hull(bwc_encoded_cblk *const encoded_codeblock, double *const mse
} }
else else
{ {
lambda[hlast] = 0xFFFFFFFFFFFFFFFF; lambda[hlast] = (double)0xFFFFFFFFFFFFFFFF;
} }
} }
else else
@ -2836,14 +2834,12 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
uint64 c; uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ; uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 width, height, depth; uint64 width, height, depth;
int64 buff_size; int64 buff_size;
int64 i, j; int64 j;
int64 nThreads;
uint16 cbSizeTS; uint16 cbSizeTS;
uint16 slope_max, slope_min; uint16 slope_max, slope_min;
int16 z; int16 i, z;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2923,7 +2919,7 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! threads during a parallel run. For a serial run only one ! ! threads during a parallel run. For a serial run only one !
! working buffer is allocated. ! ! working buffer is allocated. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
for(i = 0; i < (int64)nThreads; ++i) for(i = 0; i < nThreads; ++i)
{ {
memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe)); memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe));
if(!memory[i]) if(!memory[i])
@ -3139,12 +3135,11 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
uint64 c; uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ; uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 width, height, depth; uint64 width, height, depth;
int64 buff_size; int64 buff_size;
int64 i, j; int64 j;
int64 nThreads;
uint16 cbSizeTS; uint16 cbSizeTS;
int16 i;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -3217,7 +3212,7 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! threads during a parallel run. For a serial run only one ! ! threads during a parallel run. For a serial run only one !
! working buffer is allocated. ! ! working buffer is allocated. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
for(i = 0; i < (int64)nThreads; ++i) for(i = 0; i < nThreads; ++i)
{ {
memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe)); memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe));
if(!memory[i]) if(!memory[i])

View file

@ -55,9 +55,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if defined (_OPENMP)
#include <omp.h> #include <omp.h>
#endif
#include <time.h> #include <time.h>
#include "codestream.h" #include "codestream.h"
@ -1156,7 +1154,7 @@ create_quality_layers(bwc_field *const field, bwc_tile *const tile)
! Calculate the size of the main header, including the end ! ! Calculate the size of the main header, including the end !
! of header marker segment. ! ! of header marker segment. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
main_header_size = control->headerSize; main_header_size = control->header.size + 4 + (control->nTiles * info->nPar * 2 * PREC_BYTE);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Calculate the size of the present tile and the overall ! ! Calculate the size of the present tile and the overall !

View file

@ -48,24 +48,30 @@
add_executable(bwccmd bwccmdl.c add_executable(bwccmd bwccmdl.c
../interfaces/reader/eas3.c) ../interfaces/reader/eas3.c)
add_executable(bwccmdhip bwccmdl.hip
../interfaces/reader/eas3.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}") target_compile_definitions(bwccmdhip PRIVATE -DBWC_EAS3)
endif() endif()
if(${BUILD_NETCDF}) if(${BUILD_NETCDF})
target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF) target_compile_definitions(bwccmdhip PRIVATE -DBWC_NETCDF)
MESSAGE(STATUS "NetCDF file format support: ${BUILD_NETCDF}")
endif() endif()
#----------------------------------------------------------# #----------------------------------------------------------#
# Define the output name for the utility binaries. # # Define the output name for the utility binaries. #
#----------------------------------------------------------# #----------------------------------------------------------#
set_property(TARGET bwccmd PROPERTY OUTPUT_NAME bwc) set_property(TARGET bwccmd PROPERTY OUTPUT_NAME bwc)
set_property(TARGET bwccmdhip PROPERTY OUTPUT_NAME bwchip)
#----------------------------------------------------------# #----------------------------------------------------------#
# Setup up the include directory for the bwc utilities. # # Setup up the include directory for the bwc utilities. #
@ -74,12 +80,19 @@ target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/tools)
target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/library/public) target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/library/public)
target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/interfaces/reader) target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/interfaces/reader)
target_include_directories(bwccmdhip PRIVATE ${CMAKE_SOURCE_DIR}/include/tools)
target_include_directories(bwccmdhip PRIVATE ${CMAKE_SOURCE_DIR}/include/library/public)
target_include_directories(bwccmdhip PRIVATE ${CMAKE_SOURCE_DIR}/include/interfaces/reader)
#----------------------------------------------------------# #----------------------------------------------------------#
# Setup the install directories. # # Setup the install directories. #
#----------------------------------------------------------# #----------------------------------------------------------#
install(TARGETS bwccmd DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS bwccmd DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS bwccmdhip DESTINATION ${CMAKE_INSTALL_BINDIR})
#----------------------------------------------------------# #----------------------------------------------------------#
# Link the bwc utility to the bwc library. # # Link the bwc utility to the bwc library. #
#----------------------------------------------------------# #----------------------------------------------------------#
target_link_libraries(bwccmd PRIVATE bwclib m) target_link_libraries(bwccmd PRIVATE bwclib m)
target_link_libraries(bwccmdhip PRIVATE bwclib m)

View file

@ -802,6 +802,9 @@ parse_arguments(int argc,
} }
args->root = args; args->root = args;
// INCLUDE HIP SAXPY
bwc_saxpy();
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk through all the command-line arguments passed to ! ! Walk through all the command-line arguments passed to !
! main. ! ! main. !
@ -1503,6 +1506,7 @@ output_info(bwc_cmdl_arg_node *const args,
bwc_gl_ctrl *control; bwc_gl_ctrl *control;
bwc_gl_inf *info; bwc_gl_inf *info;
bwc_param_ctrl *param_ctrl;
bwc_param_inf *param_info; bwc_param_inf *param_info;
bwc_cmdl_arg_node *temp; bwc_cmdl_arg_node *temp;
@ -1800,6 +1804,7 @@ output_info(bwc_cmdl_arg_node *const args,
for(p = 0; p < info->nPar; ++p) for(p = 0; p < info->nPar; ++p)
{ {
param_ctrl = &field->tile[0].parameter[p].control;
param_info = &field->tile[0].parameter[p].info; param_info = &field->tile[0].parameter[p].info;
minVal = param_info->parameter_min; minVal = param_info->parameter_min;
@ -2651,15 +2656,24 @@ main(int argc,
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
\*-----------------------*/ \*-----------------------*/
uint64_t size=0;
uint64_t i; uint64_t i;
uint8_t error_handle; uint8_t error_handle;
/*-----------------------*\ /*-----------------------*\
! DEFINE CHAR VARIABLES: ! ! DEFINE CHAR VARIABLES: !
\*-----------------------*/ \*-----------------------*/
char *csSize = NULL;
char *fdSize = NULL;
char buff[200]; char buff[200];
char rate[10]; char rate[10];
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
double comp_ratio;
double bpd;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
@ -2668,9 +2682,11 @@ main(int argc,
bwc_gl_ctrl *control; bwc_gl_ctrl *control;
//bwc_dwt_filter filter[4]; bwc_dwt_filter filter[4];
bwc_cmdl_arg_node *args, *temp; bwc_cmdl_arg_node *args, *temp;
bwc_cmd_opts_ll *param;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the field and args structures for proper er- ! ! Initialize the field and args structures for proper er- !
! ror handling, as well as the error handle itself. ! ! ror handling, as well as the error handle itself. !
@ -2738,38 +2754,38 @@ main(int argc,
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
// temp = retrieve_arg(args, "wavelet_kernels"); temp = retrieve_arg(args, "wavelet_kernels");
// if((temp != NULL) && (temp->count == 4) && (temp->dim != 0x00)) if((temp != NULL) && (temp->count == 4) && (temp->dim != 0x00))
// { {
// for(i = 0; i < temp->count; ++i) for(i = 0; i < temp->count; ++i)
// { {
// switch(hash(temp->lit_opt[i])) switch(hash(temp->lit_opt[i]))
// { {
// case 0x000000000B87CF64: case 0x000000000B87CF64:
// { {
// filter[i] = bwc_dwt_9_7; filter[i] = bwc_dwt_9_7;
// break; break;
// } }
// case 0x00000652AB15772A: case 0x00000652AB15772A:
// { {
// filter[i] = bwc_dwt_5_3; filter[i] = bwc_dwt_5_3;
// break; break;
// } }
// case 0x000000017C858EFF: case 0x000000017C858EFF:
// { {
// filter[i] = bwc_dwt_5_3; filter[i] = bwc_dwt_5_3;
// break; break;
// } }
// default: default:
// { {
// filter[i] = bwc_dwt_9_7; filter[i] = bwc_dwt_9_7;
// break; break;
// } }
// } }
// } }
// bwc_set_kernels(field, filter[0], filter[1], bwc_set_kernels(field, filter[0], filter[1],
// filter[2], filter[3]); filter[2], filter[3]);
// } }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
@ -2814,23 +2830,23 @@ main(int argc,
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
// temp = retrieve_arg(args, "quantisation_style"); temp = retrieve_arg(args, "quantisation_style");
// if((temp != NULL) && (temp->count == 1)) if((temp != NULL) && (temp->count == 1))
// { {
// if(strcmp(temp->lit_opt[0], "NONE")) if(strcmp(temp->lit_opt[0], "NONE"))
// bwc_set_quant_style(field, bwc_qt_none); bwc_set_quant_style(field, bwc_qt_none);
// else else
// bwc_set_quant_style(field, bwc_qt_derived); bwc_set_quant_style(field, bwc_qt_derived);
// } }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
// temp = retrieve_arg(args, "quantisation_step_size"); temp = retrieve_arg(args, "quantisation_step_size");
// if((temp != NULL) && (temp->count == 1)) if((temp != NULL) && (temp->count == 1))
// { {
// bwc_set_quant_step_size(field, temp->num_opt[0]); bwc_set_quant_step_size(field, temp->num_opt[0]);
// } }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
@ -2938,11 +2954,11 @@ main(int argc,
printf("----------------- Compression Parameters -----------------\n\n"); printf("----------------- Compression Parameters -----------------\n\n");
if((control->CSsgc &0x200) != 0) if((control->CSsgc &0x200) != 0)
{ {
printf(" Number of Tiles: %27ld\n", control->nTiles); printf(" Number of Tiles: %27lu\n", control->nTiles);
printf(" - Samples in 1.D: %27ld\n", control->tileSizeX); printf(" - Samples in 1.D: %27ld\n", control->tileSizeX);
printf(" - Samples in 2.D: %27ld\n", control->tileSizeY); printf(" - Samples in 2.D: %27ld\n", control->tileSizeY);
printf(" - Samples in 3.D: %27ld\n", control->tileSizeZ); printf(" - Samples in 3.D: %27ld\n", control->tileSizeZ);
printf(" - Timesteps: %27ld\n", control->tileSizeTS); printf(" - Timesteps: %27lu\n", control->tileSizeTS);
printf(" ..........................................................\n"); printf(" ..........................................................\n");
printf("\n"); printf("\n");
} }
@ -2999,6 +3015,57 @@ 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);
} }
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3088,6 +3155,21 @@ 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");
}
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !

60
src/tools/bwccmdl.hip Normal file
View file

@ -0,0 +1,60 @@
#include <bwc.h>
#include <stdlib.h>
#include "bwccmdl.h"
#include <hip/hip_runtime.h>
#include <iostream>
__constant__ float a = 1.0f;
void init (int n, float *x, float *y)
{
for (std::size_t i = 0; i < n; ++i)
{
x[i] = 1.0;
y[i] = 0.0;
}
}
__global__
void saxpy (int n, float const* x, int incx, float* y, int incy)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < n)
y[i] += a*x[i];
}
int
main(int argc,
char *argv[])
{
// INCLUDE HIP SAXPY
bwc_saxpy();
int n = 256;
std::size_t size = sizeof(float)*n;
std::cout << "Doing saxpy\n";
float *h_x = new float [n];
float *h_y = new float [n];
init(n, h_x, h_y);
float* d_x;
float *d_y;
hipMalloc(&d_x, size);
hipMalloc(&d_y, size);
hipMemcpy(d_x, h_x, size, hipMemcpyHostToDevice);
hipMemcpy(d_y, h_y, size, hipMemcpyHostToDevice);
int num_groups = 2;
int group_size = 128;
saxpy<<<num_groups, group_size>>>(n, d_x, 1, d_y, 1);
hipDeviceSynchronize();
hipMemcpy(h_y, d_y, size, hipMemcpyDeviceToHost);
std::cout << "Done saxpy\n";
return 0;
}