Compare commits

..

6 commits
main ... hipify

26 changed files with 1585 additions and 1289 deletions

13
.gitignore vendored
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

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

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

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

View file

@ -103,19 +103,4 @@
bwc_tile_sizeof, // Tiling defined by size of one tile bwc_tile_sizeof, // Tiling defined by size of one tile
bwc_tile_numbof, // Tiling defined by the number of tiles bwc_tile_numbof, // Tiling defined by the number of tiles
} bwc_tile_instr; } bwc_tile_instr;
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants are used to signal the dataset sample precision. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_type_half,
bwc_type_single,
bwc_type_double,
} bwc_type;
#endif #endif

View file

@ -166,4 +166,4 @@
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar inverse_wavelet_transform (bwc_field *const field, uchar inverse_wavelet_transform (bwc_field *const field,
bwc_parameter *const parameter); bwc_parameter *const parameter);
#endif #endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -80,6 +80,7 @@ add_library(bwclib ${BWC_LINK} bitstream.c
codestream.c codestream.c
dwt.c dwt.c
mq.c mq.c
saxpy.hip
tier1.c tier1.c
tier2.c tier2.c
tagtree.c) tagtree.c)
@ -94,15 +95,6 @@ else()
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION) target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
endif() endif()
#----------------------------------------------------------#
# Set the target compile definition for the profiling #
# output. #
#----------------------------------------------------------#
if(${PROF})
target_compile_definitions(bwclib PRIVATE -DBWC_PROFILE)
MESSAGE(STATUS "Profiling: ${PROF}")
endif()
#----------------------------------------------------------# #----------------------------------------------------------#
# Set the Version and SOVersion and define the public API # # Set the Version and SOVersion and define the public API #
# for the BigWhoop library. # # for the BigWhoop library. #
@ -135,4 +127,4 @@ install( TARGETS bwclib
#----------------------------------------------------------# #----------------------------------------------------------#
# Define the output name for the BigWhoop library. # # Define the output name for the BigWhoop library. #
#----------------------------------------------------------# #----------------------------------------------------------#
set_property(TARGET bwclib PROPERTY OUTPUT_NAME bwc) set_property(TARGET bwclib PROPERTY OUTPUT_NAME bwc)

View file

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

View file

@ -55,9 +55,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined (_OPENMP) #include <omp.h>
#include <omp.h>
#endif
#include "constants.h" #include "constants.h"
#include "macros.h" #include "macros.h"
@ -486,6 +484,8 @@ whole_point_symmetric_extend(bwc_sample *const working_buffer, uint64 res0, uint
! 25.06.2018 Patrick Vogler B87D120 V 0.1.0 function created ! ! 25.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
// INCLUDE HIP SAXPY
//#include "saxpy.h"
static void static void
forward_9x7_CDF_wavelet_transform(bwc_sample *const working_buffer, uint64 res0, uint64 res1) forward_9x7_CDF_wavelet_transform(bwc_sample *const working_buffer, uint64 res0, uint64 res1)
{ {
@ -537,6 +537,9 @@ forward_9x7_CDF_wavelet_transform(bwc_sample *const working_buffer, uint64 res0,
working_buffer[i].f += DELTA * (working_buffer[i - 1].f + working_buffer[i + 1].f); working_buffer[i].f += DELTA * (working_buffer[i - 1].f + working_buffer[i + 1].f);
working_buffer[i].f = KAPPA_L * working_buffer[i].f; working_buffer[i].f = KAPPA_L * working_buffer[i].f;
} }
// INCLUDE HIP SAXPY
//bwc_saxpy();
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
@ -1624,22 +1627,18 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
uint64 rX1, rY1, rZ1; uint64 rX1, rY1, rZ1;
uint64 width, height, depth; uint64 width, height, depth;
uint64 x, y, z; uint64 x, y, z;
int64 nThreads;
int16 i;
uint32 buff_size; uint32 buff_size;
int16 i;
uint16 incr_TS; uint16 incr_TS;
uint16 rTS0; uint16 rTS0;
uint16 rTS1; uint16 rTS1;
uint16 dt; uint16 dt;
uint16 t; uint16 t;
uint8 id; uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ; uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS; uint8 filter_tapsTS;
uint8 level; uint8 level;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -1751,7 +1750,7 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
! wavelet transform along the spatial and temporal dimen- ! ! wavelet transform along the spatial and temporal dimen- !
! sions specified in the control structure. ! ! sions specified in the control structure. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp parallel private(data, id, level, working_buffer, rX0, rX1, rY0, rY1, rZ0, rZ1, rTS0, rTS1) #pragma omp parallel private(data, id, level, working_buffer, rX0, rX1, rY0, rY1, rZ0, rZ1, rTS0, rTS1)
#endif #endif
{ {
@ -1804,7 +1803,7 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
! Walk trough all the temporal and spatial slices as well ! ! Walk trough all the temporal and spatial slices as well !
! as rows. ! ! as rows. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(t = 0; t < (rTS1 - rTS0); ++t) for(t = 0; t < (rTS1 - rTS0); ++t)
@ -1885,7 +1884,7 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
! Walk trough all the temporal and spatial slices as well ! ! Walk trough all the temporal and spatial slices as well !
! as columns. ! ! as columns. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(t = 0; t < (rTS1 - rTS0); ++t) for(t = 0; t < (rTS1 - rTS0); ++t)
@ -1965,7 +1964,7 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk trough all the temporal slices, rows and columns. ! ! Walk trough all the temporal slices, rows and columns. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(t = 0; t < (rTS1 - rTS0); ++t) for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2045,7 +2044,7 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk trough all the spatial slices, rows and columns. ! ! Walk trough all the spatial slices, rows and columns. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(z = 0; z < (rZ1 - rZ0); ++z) for(z = 0; z < (rZ1 - rZ0); ++z)
@ -2165,22 +2164,18 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
uint64 rX1, rY1, rZ1; uint64 rX1, rY1, rZ1;
uint64 width, height, depth; uint64 width, height, depth;
uint64 x, y, z; uint64 x, y, z;
int64 nThreads;
int64 i;
uint32 buff_size; uint32 buff_size;
int16 i;
uint16 incr_TS; uint16 incr_TS;
uint16 rTS0; uint16 rTS0;
uint16 rTS1; uint16 rTS1;
uint16 dt; uint16 dt;
uint16 t; uint16 t;
uint8 id; uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ; uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS; uint8 filter_tapsTS;
uint8 level; uint8 level;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2292,7 +2287,7 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
! wavelet transform along the spatial and temporal dimen- ! ! wavelet transform along the spatial and temporal dimen- !
! sions specified in the control structure. ! ! sions specified in the control structure. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp parallel private(data, id, level, working_buffer, rX0, rX1, rY0, rY1, rZ0, rZ1, rTS0, rTS1) #pragma omp parallel private(data, id, level, working_buffer, rX0, rX1, rY0, rY1, rZ0, rZ1, rTS0, rTS1)
#endif #endif
{ {
@ -2344,7 +2339,7 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk trough all the spatial slices, rows and columns. ! ! Walk trough all the spatial slices, rows and columns. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(z = 0; z < (rZ1 - rZ0); ++z) for(z = 0; z < (rZ1 - rZ0); ++z)
@ -2424,7 +2419,7 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk trough all the temporal slices, rows and columns. ! ! Walk trough all the temporal slices, rows and columns. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(t = 0; t < (rTS1 - rTS0); ++t) for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2505,7 +2500,7 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
! Walk trough all the temporal and spatial slices as well ! ! Walk trough all the temporal and spatial slices as well !
! as columns. ! ! as columns. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(t = 0; t < (rTS1 - rTS0); ++t) for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2586,7 +2581,7 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
! Walk trough all the temporal and spatial slices as well ! ! Walk trough all the temporal and spatial slices as well !
! as rows. ! ! as rows. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
#if defined (_OPENMP) #if defined(_OPENMP)
#pragma omp for collapse(3) #pragma omp for collapse(3)
#endif #endif
for(t = 0; t < (rTS1 - rTS0); ++t) for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2655,4 +2650,4 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
free(memory); free(memory);
return 0; return 0;
} }

File diff suppressed because it is too large Load diff

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

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

View file

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

View file

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

View file

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

View file

@ -802,6 +802,9 @@ parse_arguments(int argc,
} }
args->root = args; args->root = args;
// INCLUDE HIP SAXPY
bwc_saxpy();
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk through all the command-line arguments passed to ! ! Walk through all the command-line arguments passed to !
! main. ! ! main. !
@ -1503,6 +1506,7 @@ output_info(bwc_cmdl_arg_node *const args,
bwc_gl_ctrl *control; bwc_gl_ctrl *control;
bwc_gl_inf *info; bwc_gl_inf *info;
bwc_param_ctrl *param_ctrl;
bwc_param_inf *param_info; bwc_param_inf *param_info;
bwc_cmdl_arg_node *temp; bwc_cmdl_arg_node *temp;
@ -1800,6 +1804,7 @@ output_info(bwc_cmdl_arg_node *const args,
for(p = 0; p < info->nPar; ++p) for(p = 0; p < info->nPar; ++p)
{ {
param_ctrl = &field->tile[0].parameter[p].control;
param_info = &field->tile[0].parameter[p].info; param_info = &field->tile[0].parameter[p].info;
minVal = param_info->parameter_min; minVal = param_info->parameter_min;
@ -2651,15 +2656,24 @@ main(int argc,
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
\*-----------------------*/ \*-----------------------*/
uint64_t size=0;
uint64_t i; uint64_t i;
uint8_t error_handle; uint8_t error_handle;
/*-----------------------*\ /*-----------------------*\
! DEFINE CHAR VARIABLES: ! ! DEFINE CHAR VARIABLES: !
\*-----------------------*/ \*-----------------------*/
char *csSize = NULL;
char *fdSize = NULL;
char buff[200]; char buff[200];
char rate[10]; char rate[10];
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
double comp_ratio;
double bpd;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
\*-----------------------*/ \*-----------------------*/
@ -2668,9 +2682,11 @@ main(int argc,
bwc_gl_ctrl *control; bwc_gl_ctrl *control;
//bwc_dwt_filter filter[4]; bwc_dwt_filter filter[4];
bwc_cmdl_arg_node *args, *temp; bwc_cmdl_arg_node *args, *temp;
bwc_cmd_opts_ll *param;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the field and args structures for proper er- ! ! Initialize the field and args structures for proper er- !
! ror handling, as well as the error handle itself. ! ! ror handling, as well as the error handle itself. !
@ -2738,38 +2754,38 @@ main(int argc,
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
// temp = retrieve_arg(args, "wavelet_kernels"); temp = retrieve_arg(args, "wavelet_kernels");
// if((temp != NULL) && (temp->count == 4) && (temp->dim != 0x00)) if((temp != NULL) && (temp->count == 4) && (temp->dim != 0x00))
// { {
// for(i = 0; i < temp->count; ++i) for(i = 0; i < temp->count; ++i)
// { {
// switch(hash(temp->lit_opt[i])) switch(hash(temp->lit_opt[i]))
// { {
// case 0x000000000B87CF64: case 0x000000000B87CF64:
// { {
// filter[i] = bwc_dwt_9_7; filter[i] = bwc_dwt_9_7;
// break; break;
// } }
// case 0x00000652AB15772A: case 0x00000652AB15772A:
// { {
// filter[i] = bwc_dwt_5_3; filter[i] = bwc_dwt_5_3;
// break; break;
// } }
// case 0x000000017C858EFF: case 0x000000017C858EFF:
// { {
// filter[i] = bwc_dwt_5_3; filter[i] = bwc_dwt_5_3;
// break; break;
// } }
// default: default:
// { {
// filter[i] = bwc_dwt_9_7; filter[i] = bwc_dwt_9_7;
// break; break;
// } }
// } }
// } }
// bwc_set_kernels(field, filter[0], filter[1], bwc_set_kernels(field, filter[0], filter[1],
// filter[2], filter[3]); filter[2], filter[3]);
// } }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
@ -2814,23 +2830,23 @@ main(int argc,
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
// temp = retrieve_arg(args, "quantisation_style"); temp = retrieve_arg(args, "quantisation_style");
// if((temp != NULL) && (temp->count == 1)) if((temp != NULL) && (temp->count == 1))
// { {
// if(strcmp(temp->lit_opt[0], "NONE")) if(strcmp(temp->lit_opt[0], "NONE"))
// bwc_set_quant_style(field, bwc_qt_none); bwc_set_quant_style(field, bwc_qt_none);
// else else
// bwc_set_quant_style(field, bwc_qt_derived); bwc_set_quant_style(field, bwc_qt_derived);
// } }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
// temp = retrieve_arg(args, "quantisation_step_size"); temp = retrieve_arg(args, "quantisation_step_size");
// if((temp != NULL) && (temp->count == 1)) if((temp != NULL) && (temp->count == 1))
// { {
// bwc_set_quant_step_size(field, temp->num_opt[0]); bwc_set_quant_step_size(field, temp->num_opt[0]);
// } }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
@ -2938,11 +2954,11 @@ main(int argc,
printf("----------------- Compression Parameters -----------------\n\n"); printf("----------------- Compression Parameters -----------------\n\n");
if((control->CSsgc &0x200) != 0) if((control->CSsgc &0x200) != 0)
{ {
printf(" Number of Tiles: %27ld\n", control->nTiles); printf(" Number of Tiles: %27lu\n", control->nTiles);
printf(" - Samples in 1.D: %27ld\n", control->tileSizeX); printf(" - Samples in 1.D: %27ld\n", control->tileSizeX);
printf(" - Samples in 2.D: %27ld\n", control->tileSizeY); printf(" - Samples in 2.D: %27ld\n", control->tileSizeY);
printf(" - Samples in 3.D: %27ld\n", control->tileSizeZ); printf(" - Samples in 3.D: %27ld\n", control->tileSizeZ);
printf(" - Timesteps: %27ld\n", control->tileSizeTS); printf(" - Timesteps: %27lu\n", control->tileSizeTS);
printf(" ..........................................................\n"); printf(" ..........................................................\n");
printf("\n"); printf("\n");
} }
@ -2999,6 +3015,57 @@ main(int argc,
{ {
printf("==============================================================\n"); printf("==============================================================\n");
} }
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
if(file->info.parameter)
{
param = file->info.parameter->root;
while(param != NULL)
{
size += (param->size * param->precision);
param = param -> next;
}
}
comp_ratio = (double)size/(file->codestream.data->size);
bpd = (double)(file->codestream.data->size * 64)/size;
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
csSize = get_size(file->codestream.data->size);
fdSize = get_size(size);
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
printf(" Compression Time: %*.2f s\n", 25, field->meter.time.ttl);
printf(" - Wavelet transformation: %*.2f s\n", 25, field->meter.time.wav);
printf(" - Entropy encoding: %*.2f s\n", 25, field->meter.time.ent);
printf(" - Codestream assembly: %*.2f s\n", 25, field->meter.time.ass);
printf("\n");
printf(" Compression Ratio: %*.2f\n", 27, comp_ratio);
printf(" - Codestream size: %*s\n", 25, csSize);
printf(" - Field size: %*s\n", 25, fdSize);
printf(" - Average bpd: %*.2f\n", 27, bpd);
printf("==============================================================\n");
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
free(csSize);
free(fdSize);
} }
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3088,6 +3155,21 @@ main(int argc,
goto OUT; goto OUT;
} }
} }
/*--------------------------------------------------------*\
! If the verbose flag is set by the function caller, print !
! the miscellaneous decompression information to the stan- !
! dard output. !
\*--------------------------------------------------------*/
temp = retrieve_arg(args, "verbose");
if(temp != NULL)
{
printf("==============================================================\n");
printf(" Decompression Time: %*.2f s\n", 24, field->meter.time.ttl);
printf(" - Wavelet transformation: %*.2f s\n", 24, field->meter.time.wav);
printf(" - Entropy encoding: %*.2f s\n", 24, field->meter.time.ent);
printf("==============================================================\n");
}
} }
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! ! ! !
@ -3140,4 +3222,4 @@ OUT:
fclose(stderr); fclose(stderr);
return error_handle; return error_handle;
} }

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

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