Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4f5bfe9
Fix missing dependencies. Add pip requirements
tartarini Aug 20, 2021
47401b4
Add Flannel code [issue #4]
tartarini Oct 11, 2021
32ecdf5
Fix ambiguity of flannel library. Point requirements to subfolder
tartarini Oct 11, 2021
1951a2b
Add missing config files forintegration testdata [issue #4]
tartarini Oct 11, 2021
78f352c
Add missing files for testdata
tartarini Oct 12, 2021
cbea992
fix flannel dependency ambiguity
tartarini Oct 12, 2021
6cb30cd
Fix double conversion
tartarini Nov 7, 2021
65afffc
more on issue #4
Mar 14, 2022
fa3f813
Fix Reading pFIRE registered image and map from config file instead o…
tartarini May 18, 2022
866d503
Merge pull request #11 from INSIGNEO/master
tartarini May 18, 2022
507e408
minor improvements
tartarini Jun 20, 2022
841eb68
Fix C++ std to ver c++17
tartarini Jul 4, 2022
5b74294
more work
tartarini Jul 4, 2022
d725ae6
Merge branch 'test_framework_fix' of github.com:insigneo-pfire/pFIRE …
tartarini Jul 4, 2022
5eb09af
Add more to .gitignore
tartarini Jul 4, 2022
616dd3f
Fix OpenImageIO missing config
tartarini Nov 28, 2022
ee6657d
switch to modern cmake for Oiio and DCMTK
tartarini Jan 1, 2023
c714aa9
enaabled shirtloader
tartarini Jan 15, 2023
231109c
enabled shirtloader
tartarini Jan 15, 2023
51847a1
add testdata and git settings
tartarini Jan 16, 2023
5cb0ab0
Merge remote-tracking branch 'origin/test_framework_fix' into test_fr…
tartarini Jan 16, 2023
00c5e41
Add some CLI to benchmark to select pfire executable/singularity
tartarini Sep 22, 2023
d5d642b
CBM-84 fix CMake lib dependency and MPI issues on constexpr and MPI_<…
tartarini Jun 4, 2024
79fb69d
add missing include algorithm for std_copy_n
tartarini Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.image filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.xdmf filter=lfs diff=lfs merge=lfs -text
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bin/
compile_commands.json
test_data/
build/
benchmarking/pyvenv*
doc/_build/
doc/_static/pfire_tutorial_files.zip
gitstate.hpp
Expand Down Expand Up @@ -80,3 +81,18 @@ MANIFEST
*.exe
*.out
*.app

# IDEs
.cproject
.project
.pydevproject
.settings/
src/.cproject
src/.project


external_libs/

testdata/integration/regression/brain_2d/xdmf

benchmarking/brain2d/brain2d.html
81 changes: 69 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

cmake_minimum_required(VERSION 3.7.0)
project(pFIRE)
include(CMakePrintHelpers)

if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for "
Expand All @@ -26,6 +27,9 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_EXPORT_COMPILE_COMMANDS on)

#[=[
#add_compile_options(-W -Wall -Werror)
#]=]
cmake_policy(SET CMP0074 NEW)

if( NOT CMAKE_BUILD_TYPE )
Expand All @@ -35,9 +39,10 @@ if( NOT CMAKE_BUILD_TYPE )
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wuninitialized -O0 -ggdb -march=native -fstack-protector-strong")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -O3 -march=native -fno-fast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -O3 -march=native -fno-fast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -ggdb")

# set( FIND_LIBRARY_USE_LIB64_PATHS property TRUE)
option(DEBUG_VERBOSE "Verbose debug outputs")
if(DEBUG_VERBOSE)
add_definitions(-DDEBUG_VERBOSE)
Expand Down Expand Up @@ -72,6 +77,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${pFIRE_SOURCE_DIR}/bin)
# Ensure we can find FindPETSc and friends
list(APPEND CMAKE_MODULE_PATH ${pFIRE_SOURCE_DIR}/cmake-modules)

# Define flags to enable dependencies
option(ENABLE_OpenImageIO "Enable Linking OpenImageIO library" [TRUE])
option(ENABLE_DCMTK "Enable Linking DCMTK library" [TRUE])

find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDES})
set(EXTRA_LIBS ${EXTRA_LIBS} ${MPI_LIBRARIES})
Expand All @@ -94,19 +103,67 @@ find_package(Boost REQUIRED COMPONENTS filesystem program_options)
include_directories(${BOOST_INCLUDE_DIRS})
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES})

find_package(DCMTK)
if(ENABLE_DCMTK)
find_package(DCMTK CONFIG)
endif(ENABLE_DCMTK)

if(DCMTK_FOUND)
include_directories(${DCMTK_INCLUDES})
set(EXTRA_LIBS ${EXTRA_LIBS} ${DCMTK_LIBRARIES})
add_definitions(-DUSE_DCMTK)
message("DCMTK found")
include_directories(${DCMTK_INCLUDES})
# FIX the following line to work with DCMTK not in single library
# set(EXTRA_LIBS ${EXTRA_LIBS} ${DCMTK_CMAKE_INSTALL_PREFIX}/lib64/libdcmtk.so )#${DCMTK_CMAKE_INSTALL_PREFIX}/${DCMTK_LIBRARIES})
set(EXTRA_LIBS ${EXTRA_LIBS} ${DCMTK_CMAKE_INSTALL_PREFIX}/${DCMTK_LIBRARIES})
add_definitions(-DUSE_DCMTK)
include_directories(${DCMTK_INCLUDE_DIRS})
cmake_print_variables(DCMTK_INCLUDES)
cmake_print_variables(DCMTK_LIBRARIES)
#cmake_print_variables(DCMTK_CMAKE_INSTALL_PREFIX)


endif(DCMTK_FOUND)

find_package(OpenImageIO)
if(OPENIMAGEIO_FOUND)
include_directories(${OPENIMAGEIO_INCLUDE_DIR})
set(EXTRA_LIBS ${EXTRA_LIBS} ${OPENIMAGEIO_LIBRARIES})
add_definitions(-DUSE_OIIO)
endif(OPENIMAGEIO_FOUND)
#list(APPEND CMAKE_FIND_ROOT_PATH "... insigneo-pfire/docker-pfire/singularity/fix_oiio_dcmtk/oiio/dist/lib64/cmake/OpenImageIO/")


if(ENABLE_OpenImageIO)
find_package(OpenImageIO CONFIG)
endif(ENABLE_OpenImageIO)

cmake_print_variables(OpenImageIO_FOUND)



if(OpenImageIO_FOUND AND ENABLE_OpenImageIO)

#cmake_print_variables(OpenImageIO_INCLUDE_DIR)
cmake_print_variables(OpenImageIO_LIBRARIES)
#cmake_print_variables(OpenImageIO_LIB_DIR)
# OpenImageIO cmake config is missing library names so declaring here until they fix it
#try modern
set (OpenImageIO_LIBRARIES "${OpenImageIO_LIB_DIR}/libOpenImageIO_Util.so;${OpenImageIO_LIB_DIR}/libOpenImageIO.so")
#try modern
include_directories(${OpenImageIO_INCLUDE_DIR})
cmake_print_variables(OpenImageIO_LIBRARIES)
#set(EXTRA_LIBS ${EXTRA_LIBS} ${OpenImageIO_LIBRARIES} )
#add_definitions(-DUSE_OIIO)


else(OpenImageIO_FOUND AND ENABLE_OpenImageIO)
message(STATUS "OPENIMAGEIO_FOUND ELSE branch")

#include_directories(${OpenImageIO_INCLUDE_DIR})
# danielta set(EXTRA_LIBS ${EXTRA_LIBS} ${OpenImageIO_LIBRARIES} ) #/usr/local/oiio/lib64/libOpenImageIO.a /usr/local/oiio/lib64/libOpenImageIO_Util.a)

#add_definitions(-DUSE_OIIO)

endif(OpenImageIO_FOUND AND ENABLE_OpenImageIO)
# include(GNUInstallDirs)
cmake_print_variables(EXTRA_LIBS)

#find_library(JPEG_LIBRARY NAMES jpeg jpg libjpeg REQUIRED NO_SYSTEM_ENVIRONMENT_PATH PATHS /usr/local/oiio/lib64)
#cmake_print_variables(JPEG_LIBRARY)

#set(EXTRA_LIBS ${EXTRA_LIBS} ${OpenImageIO_LIBRARIES})

add_subdirectory(${pFIRE_SOURCE_DIR}/src)

Expand Down
Empty file added ChangeLog
Empty file.
73 changes: 73 additions & 0 deletions benchmarking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## pFIRE Benchmark suite

The benchmark suite provides a framework to perform regression and comparison tests of pFire/ShiRT over a test cases organised in folders.


# Installation

The suite is written in Python and can be installed in the standard way.
We recommend to use virtual environments as below:



```bash
# Create virtual environment

cd pFIRE/benchmarking

python3 -m venv pyvenv3


# Activate

source pyvenv3/bin/activate

# Upgrade pip
pip install --upgrade pip

# Install dependencies

pip install -r requirements.txt

##python setup.py install .
pip install .

# add folder to pythonpath

export PYTHONPATH=`pwd`/:$PYTHONPATH


../../pFIRE/testdata/integration/regression

# When not needed any more deactivate the virtual environment

deactivate


```


add pfire binary to PATH

export PATH=/<path-to-pfire-binary>/:$PATH

# Usage

```
pfire-integration-test --pfire-executable=</path-to-pfire>/<pfire-executable> <base directory containing test configuration file>
```

It is optional to provide the pFIRE executable filename. Apptainer allows to use the container as an executable (a wrapper around a container binary configured un the Runscript section)


* create a testconf file in each test folder
* pfire_benchmark <path_to_>/mytest.testconf




TODO add testconf syntax and use cases




17 changes: 13 additions & 4 deletions benchmarking/pfire_benchmarking/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ def _parse_args():
parser = argparse.ArgumentParser(description="Run pFIRE integration tests")

parser.add_argument('dir', nargs='?', default=os.getcwd(), metavar="datadir",
help="Test data directory, will be inspected recursively")
help="Test data directory will be inspected recursively")

parser.add_argument('--pfire-executable', nargs='?', default="pfire", metavar="pfire_exec_filename",
dest="pfire_exec_filename",
help="pFIRE executable filepath (filename with full path)")


parser.add_argument('--output', '-o', default='.', metavar="outdir",
dest="output_dir",
help="Path at which to output results")

return parser.parse_args()
Expand All @@ -23,13 +30,15 @@ def main():
""" Run the testsuite over a directory tree
"""
args = _parse_args()

testsuite = TestDespatcher(output_dir=args.output)
print(args)
print("pfire_exec_filename=", args.pfire_exec_filename )

testsuite = TestDespatcher(output_dir=args.output_dir, pfire_exec_filename=args.pfire_exec_filename )

if not os.path.exists(args.dir):
print("Error, path {} does not exist".format(args.dir))
return

# Add tests or tests in directory tree
if os.path.isfile(args.dir):
testsuite.add_test(args.dir)
else:
Expand Down
35 changes: 31 additions & 4 deletions benchmarking/pfire_benchmarking/analysis_routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,21 @@ def calculate_mutual_information(data1, data2, resolution=50,
Returns a tuple of MI(X,Y), H(X), H(Y), H(X,Y)
"""
jointmax = max(data1.max(), data2.max())


# First calculate probability density
bin_edges = np.linspace(0, 1, num=resolution)
bin_edges = np.linspace(0, 1, num=resolution)#, dtype=object)

print ("shape(data1.flatten())=" + str(np.shape(data1.flatten())))
print ("shape(data2.flatten())=" + str(np.shape(data2.flatten())))

print ("shape(data1)=" + str(np.shape(data1)))
print ("shape(data2)=" + str(np.shape(data2)))

print ("shape(bin_edges)=" + str(np.shape(bin_edges)))



prob1_2, _, _ = np.histogram2d(data1.flatten()/jointmax,
data2.flatten()/jointmax,
bins=bin_edges, density=True)
Expand Down Expand Up @@ -101,11 +114,25 @@ def compare_image_results(fixed_path, moved_path, accepted_path,
else:
fig_dir = os.path.normpath('.')

mi_start = calculate_proficiency(fixed_path, moved_path)
mi_accepted = calculate_proficiency(fixed_path, accepted_path)
mi_pfire = calculate_proficiency(fixed_path, pfire_path)

print("fixed_path="+ fixed_path)
print("moved_path="+ moved_path)
print("pfire_path="+ pfire_path)
print("accepted path="+ accepted_path)

print("MI fixed_path vs moved_path=\n"+ fixed_path + "\n" + moved_path)
mi_start = calculate_proficiency(fixed_path, moved_path)

print("MI fixed_path vs accepted_path=\n"+ fixed_path + "\n" + accepted_path)
mi_accepted = calculate_proficiency(fixed_path, accepted_path)

print("MI fixed_path vs pfire_path=\n"+ fixed_path + "\n" +pfire_path)
mi_pfire = calculate_proficiency(fixed_path, pfire_path)

print("MI accepted_path vs pfire_path=\n"+ accepted_path + "\n" +pfire_path)
mi_comparison = calculate_proficiency(accepted_path, pfire_path)


res_table = [("Normalized mutual information (proficiency):", ""),
("Fixed vs. Moved:", "{:.3f}".format(mi_start.mi)),
("{} vs. Fixed:".format(cmpname), "{:.3f}".format(mi_accepted.mi)),
Expand Down
Loading