Compare commits

..

11 commits
hipify ... main

Author SHA1 Message Date
e831bec061
Refactored template files to reflect the new coding style 2024-07-03 08:04:43 +02:00
6f3b03bcb5
Merge pull request 'Bug in CMakeLists.txt' (#37) from cmake/bug-fix into main 2024-07-02 10:07:58 +02:00
0622e79aab
add .vscode to .gitignore 2024-07-01 21:08:29 +02:00
1cebbd2d2c
Bug in CMakeLists.txt (signed commit)
Currently, cmake throws
```
CMake Error at CMakeLists.txt:134 (if):
  if given arguments:

    "Release" "STREQUAL" "Release" "OR"

  Unknown arguments specified
```
from here

41ec39574f/CMakeLists.txt (L134)

Fix on would be
```
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}")
```
2024-07-01 20:32:31 +02:00
41ec39574f
Pulled the start and end variables used for time measurements in the profiling block to avoid warnings during compilation without profiling. 2024-06-28 13:05:22 +02:00
ed91f1d15c
Added the option to enable OpenMP parallelization during debug 2024-06-28 11:28:34 +02:00
b3f594771f
Previously the library accepted a max of 255 threads for compression. The limit has now been extended to 9 223 372 036 854 775 807, which should suffice for the next couple of years. 2024-06-28 11:27:58 +02:00
58596bb3e4
Fixed issue with handling OpenMP integration for debugging. 2024-06-26 14:20:55 +02:00
501a36d568
Combined the assemble_main_header and codestream_write_header function and added the codestreamSize value as a length identifier to the Start of Code-Stream (SOC) marker to allow for proper decompression without the user having to supply the codestreamSize through an API call. Functions to append com and aux header blocks have been removed and functionality is now provided by codestream_write_header function. 2024-06-25 20:54:44 +02:00
1330d5b262
Moved metering to a compile time option to streamline API 2024-06-24 16:31:02 +02:00
3920405c4c
API Clean Up to remove unsupported (de)compression instructions. 2024-04-30 17:04:30 +02:00
26 changed files with 1289 additions and 1585 deletions

13
.gitignore vendored
View file

@ -131,9 +131,13 @@ share/python-wheels/
MANIFEST
# Files and Archives
.eas
.npz
.zip
*.eas
*.npz
*.zip
*.bwc
# Profiling assets
valgrind-out.txt
# PyInstaller
# Usually these files are written by a python script from a template
@ -192,6 +196,9 @@ target/
profile_default/
ipython_config.py
# vscode
.vscode
# pyenv
# 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:

View file

@ -131,7 +131,8 @@ message(STATUS "Compiling with C++ standard: ${CMAKE_CXX_STANDARD}")
# Check if the OpenMP package is available for the current #
# setup and set the appropriate C/C++ flags. #
#----------------------------------------------------------#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}")
message(STATUS "Enable OpenMP parallelization")
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
@ -140,44 +141,6 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
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. #
#----------------------------------------------------------#
@ -219,6 +182,8 @@ add_subdirectory(src/library)
#----------------------------------------------------------#
if(${TOOL})
add_subdirectory(src/tools)
else()
set(ignoreMe "${BUILD_EAS3}${BUILD_NETCDF}")
endif()
#----------------------------------------------------------#

View file

@ -53,14 +53,20 @@
.PHONY: single
.PHONY: tool
.PHONY: profiling
.PHONY: omp
.PHONY: eas3
.PHONY: netCDF
.PHONY: --build_debug
.PHONY: build_debug
.PHONY: default
.PHONY: debug
.PHONY: full
.PHONY: release
.PHONY: cmdl
.PHONY: cldebug
#*--------------------------------------------------------*#
# Initialize the compiler flags used to build the library. #
@ -73,6 +79,10 @@ BUILD_PREC="Double"
BUILD_TOOL="False"
BUILD_PROF="False"
BUILD_OMP="False"
BUILD_EAS3="False"
BUILD_NETCDF="False"
@ -95,12 +105,25 @@ help:
@echo ""
@echo " [Type] [Description]"
@echo ""
@echo " debug Compiles BigWhoop and the command line tool with "
@echo " full file support. All relevant debug flags are set."
@echo " debug Compiles BigWhoop with all relevant debug flags."
@echo ""
@echo " full Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " ble) and the command line tool with full file sup-"
@echo " port. Code optimization is set to the highest level."
@echo " full 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 " 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 " clean Removes all files and folders created during a pre-"
@echo " vious compile run."
@ -116,6 +139,10 @@ help:
@echo ""
@echo " tool Build the command line tool."
@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 " mand line tool."
@echo ""
@ -125,7 +152,7 @@ help:
#*--------------------------------------------------------*#
# Define private targets. #
#*--------------------------------------------------------*#
--build_debug:
build_debug:
$(eval BUILD_TYPE="Debug")
#*--------------------------------------------------------*#
@ -143,6 +170,17 @@ single:
tool:
$(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. #
@ -156,9 +194,11 @@ netCDF:
#*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. #
#*--------------------------------------------------------*#
debug: | clean --build_debug tool eas3 build_bwc display
debug: | clean build_debug build_bwc display
full: | clean build_bwc display
release: | build_bwc display
full: | clean tool eas3 build_bwc display
cmdl: | clean tool profiling eas3 build_bwc display
cldebug: | clean build_debug tool profiling eas3 build_bwc display
#*--------------------------------------------------------*#
# Define target used to output compile information. #
@ -182,6 +222,7 @@ display:
@echo " Link Type: $(LINK_TYPE)"
@echo " Precision: $(BUILD_PREC)"
@echo " Utilities: $(BUILD_TOOL)"
@echo " Profiling: $(BUILD_PROF)"
@echo ""
@echo " Build date: $(shell date)"
@echo " User: $(USER)"
@ -192,7 +233,7 @@ display:
# Define the main compile command targets. #
#*--------------------------------------------------------*#
build_bwc:
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DOMP=${BUILD_OMP}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
clean:
- /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public

158
docs/templates/Template.F90 vendored Normal file
View file

@ -0,0 +1,158 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| 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

178
docs/templates/Template.c vendored Normal file
View file

@ -0,0 +1,178 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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

121
docs/templates/Template.py vendored Normal file
View file

@ -0,0 +1,121 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| 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 #
#----------------------------------------------------------#

47
docs/templates/Template.txt vendored Normal file
View file

@ -0,0 +1,47 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| 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 #
#----------------------------------------------------------#

View file

@ -1,299 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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

View file

@ -1,179 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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,4 +103,19 @@
bwc_tile_sizeof, // Tiling defined by size of one tile
bwc_tile_numbof, // Tiling defined by the number of tiles
} 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

View file

@ -72,6 +72,14 @@
uint8 const nPar,
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,
char *const name,
uint8 const precision);
@ -90,16 +98,16 @@
//==========|==========================|======================|======|=======|====================
void bwc_set_error_resilience (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void bwc_set_quant_style (bwc_field *const field,
void set_quant_style (bwc_field *const field,
bwc_quant_st const quantization_style);
//==========|==========================|======================|======|=======|====================
void bwc_set_quant_step_size (bwc_field *const field,
void set_quant_step_size (bwc_field *const field,
double const delta);
//==========|==========================|======================|======|=======|====================
void bwc_set_progression (bwc_field *const field,
void set_progression (bwc_field *const field,
bwc_prog_ord const progression);
//==========|==========================|======================|======|=======|====================
void bwc_set_kernels (bwc_field *const field,
void set_kernels (bwc_field *const field,
bwc_dwt_filter const KernelX,
bwc_dwt_filter const KernelY,
bwc_dwt_filter const KernelZ,

View file

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

View file

@ -689,7 +689,8 @@
uint8 guard_bits; // Number of guard bits during quant.
bwc_stream header; // Main codestream header.
uint64 headerSize; // Size estimation of the global header.
uint64 codestreamSize; // Size of entire code-stream.
bwc_quant_st quantization_style; // Quantization style.
bwc_prog_ord progression; // Packet progression order.
@ -714,23 +715,7 @@
bwc_tile *tile; // Structure defining bwc tile.
struct meter
{
double bpd; // Average bits per datapoint.
double cpr; // Compression ratio
double css; // Codestream size.
struct time
{
double ttl; // Total compression time.
double cpy; // Total time used copying data.
double nrm; // Total time used normalizing data.
double wav; // Total time used for wavelet transform.
double ent; // Total time used for entropy encoding.
double ass; // Total codestream assembly time.
} time;
} meter;
bwc_stream *aux; // Auxiliary info. codestream block.
bwc_stream *com; // Comment codestream block.
} bwc_field;
#endif

View file

@ -91,7 +91,7 @@ destination = current_path.joinpath('include/library/public')
if os.path.isdir(destination) == False:
os.mkdir(destination)
include_files = ['macros.h', 'constants.h', 'saxpy.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h',
include_files = ['macros.h', 'constants.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h',
'bitstream.h', 'codestream.h', 'tier1.h', 'tier2.h', 'types.h', 'libbwc.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))]

View file

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

View file

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

View file

@ -137,20 +137,28 @@ can_read(bitstream *const stream, const uint64 length)
! !
\*----------------------------------------------------------------------------------------------------------*/
static void
codestream_write_header(bitstream *const stream, bwc_field *const field)
codestream_write_header(bitstream *const stream,
bwc_field *const field)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 Lcss;
uint32 t;
uint32 Laux;
uint16 Linf, Lctr, Lcom;
uint16 Leoh;
uint8 p;
uint8 p, l;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_ctrl *control;
bwc_gl_inf *info;
bwc_tile *tile;
bwc_parameter *parameter;
bwc_stream *aux;
bwc_stream *com;
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -163,46 +171,116 @@ codestream_write_header(bitstream *const stream, bwc_field *const field)
! structure to temporary variables to make the code more !
! readable. !
\*--------------------------------------------------------*/
control = &field->control;
info = field->info;
control = &field->control;
/*--------------------------------------------------------*\
! 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);
tile = &field->tile[0];
/*--------------------------------------------------------*\
! Emit the portion of the main header already created by !
! the bwc_create_compression function. !
\*--------------------------------------------------------*/
emit_chunck(stream, control->header.memory, control->header.size);
parameter = &tile->parameter[0];
aux = field->aux;
com = field->com;
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, Leoh, 2);
/*--------------------------------------------------------*\
! Loop through all tile parameters and... !
\*--------------------------------------------------------*/
for(t = 0; t < control->nTiles; ++t)
{
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);
/*--------------------------------------------------------*\
! Reset the maximum and minimum parameter value in the !
! parameter structure. !
\*--------------------------------------------------------*/
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);
field->tile[t].parameter[p].info.parameter_max = -FLT_MAX;
field->tile[t].parameter[p].info.parameter_min = FLT_MAX;
}
@ -475,7 +553,6 @@ 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->control.body_size, 8);
emit_symbol(stream, SOD, 2);
for(packet_index = 0; packet_index < tile->control.nPackets; ++packet_index)
{
packet = tile->packet_sequence[packet_index];
@ -553,9 +630,7 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
uint16 Linf, Lctr, Lcom, Leoh, Lunk;
uint16 marker;
uint16 nTS;
uint8 dim;
uint8 index, l;
uint8 samp;
uint8 nPar, p;
uint8 codec_prec, precision;
@ -601,12 +676,16 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
{
case SOC:
{
if(index != 0)
if(index != 0 && !can_read(stream, 2))
{
// Invalid Codestream
fprintf(stderr, CSERROR);
status |= CODESTREAM_ERROR;
break;
}
stream->Lmax = (uint64)get_symbol(stream, 8);
break;
}
@ -637,7 +716,7 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
info->precision = codec_prec = (uint8)get_symbol(stream, 1);
buffer_char = (char*)get_chunck(stream, 10);
strncpy(info->f_ext, buffer_char, 10);
strncpy(info->f_ext, buffer_char, sizeof(buffer_char)/sizeof(*buffer_char));
free(buffer_char);
for(p = 0; p < nPar; ++p)
@ -664,6 +743,8 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
info = field->info = &data->info;
control = &field->control;
control->codestreamSize = stream->Lmax;
status |= CODESTREAM_SGI_READ;
break;
}
@ -703,7 +784,7 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
if(CSsgc & (0x01 << 1))
{
bwc_set_quant_style(field, (bwc_quant_st)buff_long);
set_quant_style(field, (bwc_quant_st)buff_long);
}
buff_long = get_symbol(stream, 1);
@ -719,13 +800,13 @@ parse_main_header(bwc_data *const data,bitstream *const stream)
buff_long = get_symbol(stream, 1);
if(CSsgc & (0x01 << 3))
{
bwc_set_progression(field, (uint8)buff_long);
set_progression(field, (uint8)buff_long);
}
buff_long = get_symbol(stream, 1);
if(CSsgc & (0x01 << 4))
{
bwc_set_kernels(field, (uint8)(0x03 & (buff_long >> 6)), (uint8)(0x03 & (buff_long >> 4)),
set_kernels(field, (uint8)(0x03 & (buff_long >> 6)), (uint8)(0x03 & (buff_long >> 4)),
(uint8)(0x03 & (buff_long >> 2)), (uint8)(0x03 & buff_long));
}
@ -1254,311 +1335,6 @@ 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) !
! -------------- !
@ -1594,7 +1370,7 @@ assemble_codestream(bwc_field *const field)
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 i, size;
uint64 i;
/*-----------------------*\
! DEFINE STRUCTS: !
@ -1616,7 +1392,8 @@ assemble_codestream(bwc_field *const field)
! bytes. !
\*--------------------------------------------------------*/
control = &field->control;
size = control->header.size;
control->codestreamSize = control->headerSize + 2;
/*--------------------------------------------------------*\
! Walk through the tile structure and assemble the packed !
@ -1638,15 +1415,15 @@ assemble_codestream(bwc_field *const field)
{
return NULL;
}
size += tile->control.header_size + tile->control.body_size;
control->codestreamSize += tile->control.header_size +
tile->control.body_size;
}
/*--------------------------------------------------------*\
! Initialize the final codestream and emit the header !
! bytes. !
\*--------------------------------------------------------*/
stream = init_stream(NULL, size, 'c');
stream = init_stream(NULL, control->codestreamSize, 'c');
codestream_write_header(stream, field);
/*--------------------------------------------------------*\
@ -1655,6 +1432,7 @@ assemble_codestream(bwc_field *const field)
\*--------------------------------------------------------*/
for(i = 0; i < control->nTiles; ++i)
{
/*--------------------------------------------------------*\
! Save the tile structure in a temporary variable to make !
! the code more readable. !
@ -1734,8 +1512,7 @@ parse_codestream(bwc_data *const data, uint8 const layer)
! Initialize a bitstream used to parse the packed code- !
! stream. !
\*--------------------------------------------------------*/
stream = init_stream(data->codestream.data->memory,
data->codestream.data->size, 'd');
stream = init_stream(data->codestream.data->memory, 10, 'd');
/*--------------------------------------------------------*\
! Parse the main header and set up the field structure for !

View file

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

View file

@ -49,8 +49,13 @@
|| ||
\************************************************************************************************************/
#include <assert.h>
#if defined BWC_PROFILE
#include <inttypes.h>
#endif
#include <math.h>
#if defined (_OPENMP)
#include <omp.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -73,6 +78,72 @@
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This function takes an integer value and generates a version with the appropri- !
! ate byte unit in log2 format that is returned to the function caller. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 03.05.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 04.05.2021 Patrick Vogler B87E7E4 V 0.1.0 clean up !
! !
\*----------------------------------------------------------------------------------------------------------*/
#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, !
! -------------- const uint32 dX, const uint32 dY, !
@ -611,208 +682,6 @@ initialize_subband(bwc_field *const field, bwc_parameter *const parameter, bwc_r
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, !
@ -1140,7 +1009,6 @@ flush_buffer(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const
\*-----------------------*/
bwc_sample *src;
bwc_gl_inf *info;
bwc_param_ctrl *param_control;
bwc_param_inf *param_info;
bwc_cmd_opts_ll *param;
@ -1160,7 +1028,6 @@ flush_buffer(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const
\*--------------------------------------------------------*/
info = field->info;
param_control = &parameter->control;
param_info = &parameter->info;
nX = info->nX;
@ -1720,6 +1587,82 @@ bwc_add_param(bwc_data* data, char *name, uint8 precision)
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(...) !
! -------------- !
@ -1762,9 +1705,6 @@ bwc_get_data(bwc_data* data, uchar* buffer, uint64 size)
/*-----------------------*\
! 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))
{
@ -2005,7 +1945,7 @@ create_field(bwc_field *const field)
/*--------------------------------------------------------*\
! Initialize the tile header size. !
\*--------------------------------------------------------*/
tile_control->header_size = 14;
tile_control->header_size = 18;
/*--------------------------------------------------------*\
! Initialize the convex hull slope threshold. !
@ -2409,7 +2349,6 @@ bwc_kill_compression(bwc_field *const field)
free(field->tile[i].parameter);
}
}
free(control->header.memory);
free(control->bitrate);
free(field->tile);
free(field);
@ -2709,7 +2648,7 @@ bwc_set_error_resilience(bwc_field *const field)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_quant_style(bwc_field *const field, bwc_quant_st quantization_style)
set_quant_style(bwc_field *const field, bwc_quant_st quantization_style)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -2775,7 +2714,7 @@ bwc_set_quant_style(bwc_field *const field, bwc_quant_st quantization_style)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_quant_step_size(bwc_field *const field, double delta)
set_quant_step_size(bwc_field *const field, double delta)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -2880,7 +2819,7 @@ bwc_set_quant_step_size(bwc_field *const field, double delta)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_progression(bwc_field *const field, bwc_prog_ord progression)
set_progression(bwc_field *const field, bwc_prog_ord progression)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -2953,7 +2892,7 @@ bwc_set_progression(bwc_field *const field, bwc_prog_ord progression)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_kernels(bwc_field *const field, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY,
set_kernels(bwc_field *const field, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY,
bwc_dwt_filter KernelZ, bwc_dwt_filter KernelTS)
{
/*-----------------------*\
@ -3563,7 +3502,7 @@ bwc_set_tiles(bwc_field *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
! Check if the number of tiles exceeds its maximum allowa- !
! ble value. !
\*--------------------------------------------------------*/
if(((double)num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS) > (double)0xFFFFFFFFFFFFFFFF)
if(((double)num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS) > 0xFFFFFFFFFFFFFFFF)
{
fprintf(stderr,"o==========================================================o\n"\
"| WARNING: Invalid Tile Dimensions |\n"\
@ -3593,7 +3532,7 @@ bwc_set_tiles(bwc_field *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
! Check if the number of tiles exceeds its maximum allowa- !
! ble value. !
\*--------------------------------------------------------*/
if(((double)tilesX * tilesY * tilesZ * tilesTS) > (double)0xFFFFFFFFFFFFFFFF)
if(((double)tilesX * tilesY * tilesZ * tilesTS) > 0xFFFFFFFFFFFFFFFF)
{
fprintf(stderr,"o==========================================================o\n"\
"| WARNING: Invalid Number Of Tiles |\n"\
@ -3728,6 +3667,7 @@ bwc_create_compression(bwc_field *field, char *rate_control)
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_inf *info;
bwc_gl_ctrl *control;
/*-----------------------*\
@ -3739,6 +3679,7 @@ bwc_create_compression(bwc_field *field, char *rate_control)
! Save the global control structure to a temporary varia- !
! ble to make the code more readable. !
\*--------------------------------------------------------*/
info = field->info;
control = &field->control;
/*--------------------------------------------------------*\
@ -3835,14 +3776,35 @@ bwc_create_compression(bwc_field *field, char *rate_control)
}
/*--------------------------------------------------------*\
! Create the main header for the compressed codestream and !
! save the memory handle in the field structure. !
! Evaluate the size of the main header. !
\*--------------------------------------------------------*/
if(assemble_main_header(field))
/*control->headerSize = 108 + info->nPar * (25 + control->nTiles * 2 * PREC_BYTE)
+ control->nLayers * 4;
if(field->aux != NULL)
{
return 1;
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 0;
}
@ -3885,11 +3847,30 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
uint64 i;
uint16 p;
#ifdef BWC_PROFILE
uint64 css;
uint64 nfs;
#endif
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
#ifdef BWC_PROFILE
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: !
\*-----------------------*/
@ -3908,10 +3889,12 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Initialize the compression time measurement. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime();
ttl = omp_get_wtime();
#else
field->meter.time.ttl = (double)clock();
ttl = (double)clock();
#endif
#endif
/*--------------------------------------------------------*\
@ -3922,20 +3905,34 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
info = field->info;
/*--------------------------------------------------------*\
! Check if any auxiliary information has been supplied by !
! the function caller and append the header accordingly. !
! Evaluate the size of the main header. !
\*--------------------------------------------------------*/
if(data->codestream.aux && header_append_aux(field, data->codestream.aux))
control->headerSize = 108 + info->nPar * (25 + control->nTiles * 2 * PREC_BYTE)
+ control->nLayers * 4;
if(data->codestream.aux != NULL)
{
return 1;
field->aux = data->codestream.aux;
control->headerSize += 6 + field->aux->size;
}
/*--------------------------------------------------------*\
! 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))
if(data->codestream.com != NULL)
{
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;
}
@ -3978,18 +3975,22 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
! Fill the working buffer with the flow field data for the !
! current tile parameter. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
fill_buffer(field, tile, parameter, working_buffer, data, p);
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.cpy += end - start;
cpy += end - start;
#else
end = (double)clock();
field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
cpy += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -3997,60 +3998,72 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
! scale it to the dynamic range specified by the Qm param- !
! eter. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
normalize_param(field, parameter);
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.nrm += end - start;
nrm += end - start;
#else
end = (double)clock();
field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
nrm += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Perform the forward discrete wavelet transform. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(forward_wavelet_transform(field, parameter))
{
free(working_buffer);
return 1;
}
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.wav += end - start;
wav += end - start;
#else
end = (double)clock();
field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
wav += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Tier1 encode the current tile parameter. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(t1_encode(field, tile, parameter))
{
free(working_buffer);
return 1;
}
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ent += end - start;
ent += end - start;
#else
end = (double)clock();
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4062,44 +4075,52 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Tier2 encode the current tile. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(t2_encode(field, tile))
{
free(working_buffer);
return 1;
}
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ent += end - start;
ent += end - start;
#else
end = (double)clock();
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
}
/*--------------------------------------------------------*\
! Assemble compressed codestream. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
data->codestream.data = assemble_codestream(field);
if(!data->codestream.data)
{
free(working_buffer);
return 1;
}
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ass += end - start;
ass += end - start;
#else
end = (double)clock();
field->meter.time.ass += (end - start)/CLOCKS_PER_SEC;
ass += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4108,12 +4129,33 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
free(working_buffer);
/*--------------------------------------------------------*\
! Calculate the compression time. !
! Output the profiling information. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
ttl = omp_get_wtime() - ttl;
#else
field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC;
#endif
nfs = (uint64)(info->nX * info->nY * info->nZ * info->nTS * info->nPar * info->precision);
css = (uint64)data->codestream.data->size;
cpr = (double)nfs/css;
bpd = (double)(css * 64.0f)/nfs;
printf("==============================================================\n");
printf(" Compression Time: %*.2f s\n", 25, ttl);
printf(" - Wavelet transformation: %*.2f s\n", 25, wav);
printf(" - Entropy encoding: %*.2f s\n", 25, ent);
printf(" - Codestream assembly: %*.2f s\n", 25, ass);
printf("\n");
printf(" Compression Ratio: %*.2f\n", 27, cpr);
printf(" - Codestream size: %*s\n", 25, get_size(css));
printf(" - Field size: %*s\n", 25, get_size(nfs));
printf(" - Average bpd: %*.2f\n", 27, bpd);
printf("==============================================================\n");
#endif
/*--------------------------------------------------------*\
@ -4238,8 +4280,18 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
#ifdef BWC_PROFILE
double start, end;
double ttl;
double cpy;
double nrm;
double wav;
double ent;
#endif
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
@ -4259,10 +4311,12 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Initialize the decompression time measurement. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime();
ttl = omp_get_wtime();
#else
field->meter.time.ttl = (double)clock();
ttl = (double)clock();
#endif
#endif
/*--------------------------------------------------------*\
@ -4350,61 +4404,73 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Tier1 decode the current tile parameter. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(t1_decode(field, tile, parameter))
{
free(working_buffer);
return 1;
}
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ent += end - start;
ent += end - start;
#else
end = (double)clock();
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Perform the inverse discrete wavelet transform. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(inverse_wavelet_transform(field, parameter))
{
free(working_buffer);
return 1;
}
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.wav += end - start;
wav += end - start;
#else
end = (double)clock();
field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
wav += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Denormalize the working buffer scale it to the original !
! dynamic range specified by the Qm parameter. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
denormalize_param(field, parameter);
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.nrm += end - start;
nrm += end - start;
#else
end = (double)clock();
field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
nrm += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4412,18 +4478,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
! in the flow field data structure for the current tile pa-!
! rameter. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
flush_buffer(field, tile, parameter, working_buffer, data, p);
#ifdef BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.cpy += end - start;
cpy += end - start;
#else
end = (double)clock();
field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
cpy += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4440,13 +4510,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
free(working_buffer);
/*--------------------------------------------------------*\
! Calculate the decompression time. !
! Output the profiling information. !
\*--------------------------------------------------------*/
#ifdef BWC_PROFILE
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
ttl = omp_get_wtime() - ttl;
#else
field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC;
#endif
printf("==============================================================\n");
printf(" Decompression Time: %*.2f s\n", 24, ttl);
printf(" - Wavelet transformation: %*.2f s\n", 24, wav);
printf(" - Entropy encoding: %*.2f s\n", 24, ent);
printf("==============================================================\n");
#endif
return 0;
}

View file

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

View file

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

View file

@ -48,30 +48,24 @@
add_executable(bwccmd bwccmdl.c
../interfaces/reader/eas3.c)
add_executable(bwccmdhip bwccmdl.hip
../interfaces/reader/eas3.c)
#----------------------------------------------------------#
# Set the target compile definition for the requested file #
# format support. #
#----------------------------------------------------------#
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
if(${BUILD_EAS3})
target_compile_definitions(bwccmd PRIVATE -DBWC_EAS3)
target_compile_definitions(bwccmdhip PRIVATE -DBWC_EAS3)
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
endif()
if(${BUILD_NETCDF})
target_compile_definitions(bwccmdhip PRIVATE -DBWC_NETCDF)
target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF)
MESSAGE(STATUS "NetCDF file format support: ${BUILD_NETCDF}")
endif()
#----------------------------------------------------------#
# Define the output name for the utility binaries. #
#----------------------------------------------------------#
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. #
@ -80,19 +74,12 @@ 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/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. #
#----------------------------------------------------------#
install(TARGETS bwccmd DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS bwccmdhip DESTINATION ${CMAKE_INSTALL_BINDIR})
#----------------------------------------------------------#
# Link the bwc utility to the bwc library. #
#----------------------------------------------------------#
target_link_libraries(bwccmd PRIVATE bwclib m)
target_link_libraries(bwccmdhip PRIVATE bwclib m)

View file

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

View file

@ -1,60 +0,0 @@
#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;
}