Commit c967bcac authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Add read-after-write equality test for I/O of fields with transformed layout...

Add read-after-write equality test for I/O of fields with transformed layout (stream-based I/O only).
parent f1085758
......@@ -294,6 +294,9 @@ test:ParIO_CheckEquality_2D:
# 2D_Scalar_CheckEquality_ReadAfterWrite
- mkdir -p data/2D_Scalar_CheckEquality_ReadAfterWrite
- python3 run_test.py ../Compiler/Compiler.jar:../Compiler/lib 2D_Scalar_CheckEquality_ReadAfterWrite IOTest/2D_Scalar_CheckEquality_ReadAfterWrite.knowledge "IOTest/2D_Scalar_CheckEquality_ReadAfterWrite.exa4" "" 2 1 Platform/random.platform output
# 2D_LayoutTrafo_CheckEquality_ReadAfterWrite
- mkdir -p data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite
- python3 run_test.py ../Compiler/Compiler.jar:../Compiler/lib 2D_LayoutTrafo_CheckEquality_ReadAfterWrite IOTest/2D_LayoutTrafo_CheckEquality_ReadAfterWrite.knowledge "IOTest/2D_LayoutTrafo_CheckEquality_ReadAfterWrite.exa4" "" 2 1 Platform/random.platform output
# 2D_Vector_CheckEquality_ReadAfterWrite
- mkdir -p data/2D_Vector_CheckEquality_ReadAfterWrite
- python3 run_test.py ../Compiler/Compiler.jar:../Compiler/lib 2D_Vector_CheckEquality_ReadAfterWrite IOTest/2D_Vector_CheckEquality_ReadAfterWrite.knowledge "IOTest/2D_Vector_CheckEquality_ReadAfterWrite.exa4" "" 4 1 Platform/random.platform output
......
// domain declarations
Domain global< [0.0, 0.0] to [1.0, 1.0] >
// field layout declarations
Layout NodeWithComm < Real, Node >@all {
duplicateLayers = [1, 1] with communication
ghostLayers = [1, 1] with communication
}
// field layout transformations
LayoutTransformations {
transform src@finest with [x, y] => [x/2, y, (x+y)%2]
transform dest@finest with [x, y] => [x/2, y, (x+y)%2]
}
// field declarations
Field src< global, NodeWithComm, None >@all
Field dest< global, NodeWithComm, None >@all
// globals
Globals {
Val condition : Bool = true
}
// external field declarations
// stencil declarations
// stencil field declarations
// functions
Function compareFields@all () : Int {
// check for equality
loop over dest {
Var diff : Real = fabs(dest - src)
if( condition && diff > 0.001 ) {
print("fields are not equal! src=", src, " dest=", dest)
print("Error occurred at idx: i0 =", i0, ",i1 =", i1)
return -1
}
}
// reset dest
loop over dest {
dest = -1.0
}
return 0
}
Function checkEquality@finest () : Unit {
Val ret : Int = compareFields@finest ()
if( ret == -1 ) {
exit(1)
}
}
Function initSRC@finest {
loop over src {
src = vf_nodePos_x**2 - vf_nodePos_y**2
}
loop over src only dup [0, 0, 0] {
src = vf_nodePos_x**2 - vf_nodePos_y**2
}
}
Function Application {
// init
startTimer ( "setup" )
initGlobals ( )
initDomain ( )
initFieldsWithZero ( )
initGeometry ( )
initSRC@finest ( )
stopTimer ( "setup" )
// arguments
Val useGhost : Bool = true
Val useBin : Bool = true
Val useCanonicalLayout : Bool = true
Val separator : String = ","
// toggle I/O modes here
Val lockingIO : Bool = true
Val fppIO : Bool = true
Val hdfIO : Bool = false
Val mpiIO : Bool = false
Val ncIO : Bool = false
Val sionIO : Bool = true
if (lockingIO) {
startTimer ("Lock: writeField")
writeField_lock ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src_lock.txt", src@finest, useGhost, !useBin, condition, separator)
stopTimer ("Lock: writeField")
startTimer ("Lock: readField")
readField_lock ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src_lock.txt", dest@finest, useGhost, !useBin, condition, separator)
stopTimer ("Lock: readField")
checkEquality@finest ()
print ( 'Passed lock test' )
}
if (fppIO) {
startTimer ("FPP: writeField")
writeField_fpp ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src_fpp_$blockId.bin", src@finest, useGhost, useBin, condition)
stopTimer ("FPP: writeField")
startTimer ("FPP: readField")
readField_fpp ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src_fpp_$blockId.bin", dest@finest, useGhost, useBin, condition)
stopTimer ("FPP: readField")
checkEquality@finest ()
print ( 'Passed fpp test' )
}
if (hdfIO) {
startTimer ("HDF5: writeField")
// writeField_hdf5 ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.h5", "/test/abs/path/src", src@finest)
stopTimer ("HDF5: writeField")
startTimer ("HDF5: readField")
// readField_hdf5 ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.h5", "/test/abs/path/src", dest@finest)
stopTimer ("HDF5: readField")
checkEquality@finest ()
print ( 'Passed hdf5 test' )
}
if (mpiIO) {
Val repr : String = "native"
startTimer ("MPIIO: writeField")
// writeField_mpiio ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.bin", src@finest, !useGhost, !useCanonicalLayout, repr)
stopTimer ("MPIIO: writeField")
startTimer ("MPIIO: readField")
// readField_mpiio ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.bin", dest@finest, !useGhost, !useCanonicalLayout, repr)
stopTimer ("MPIIO: readField")
checkEquality@finest ()
print ( 'Passed MPI I/O test' )
}
if (ncIO) {
startTimer ("PnetCDF: writeField")
// writeField_nc ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.nc", "field_src", src@finest, useGhost, !useCanonicalLayout)
stopTimer ("PnetCDF: writeField")
startTimer ("PnetCDF: readField")
// readField_nc ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.nc", "field_src", dest@finest, useGhost, !useCanonicalLayout)
stopTimer ("PnetCDF: readField")
checkEquality@finest ()
print ( 'Passed nc test' )
}
if(sionIO) {
startTimer ("SionLib: writeField")
writeField_sion ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.sion", src@finest, !useGhost, condition)
stopTimer ("SionLib: writeField")
startTimer ("SionLib: readField")
readField_sion ("data/2D_LayoutTrafo_CheckEquality_ReadAfterWrite/src.sion", dest@finest, !useGhost, condition)
stopTimer ("SionLib: readField")
checkEquality@finest ()
print ( 'Passed sion test' )
}
// de-init
printAllTimers ( )
destroyGlobals ( )
}
dimensionality = 2
minLevel = 1
maxLevel = 1
discr_type = "FiniteDifferences"
experimental_generateParaviewFiles = true
//parIO_vis_generateVisItFiles = true
domain_onlyRectangular = true
domain_rect_generate = true
domain_rect_numBlocks_x = 2
domain_rect_numBlocks_y = 1
domain_rect_numBlocks_z = 1
domain_rect_numFragsPerBlock_x = 1
domain_rect_numFragsPerBlock_y = 2
domain_rect_numFragsPerBlock_z = 1
omp_enabled = false
omp_numThreads = 1
mpi_enabled = true
mpi_numThreads = 2
omp_parallelizeLoopOverFragments = false
omp_parallelizeLoopOverDimensions = false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment