diff --git a/.github/workflows/everything.yml b/.github/workflows/everything.yml index 4bd22408f5..af2f464df2 100644 --- a/.github/workflows/everything.yml +++ b/.github/workflows/everything.yml @@ -188,7 +188,7 @@ jobs: - name: Build run: gha/scripts/ci/gh-actions/run.sh build - name: Print ccache statistics - run: ccache -s + run: ccache -s | tee $GITHUB_STEP_SUMMARY - name: Save cache uses: actions/cache/save@v3 if: ${{ github.ref_name == 'master' && steps.restore-cache.outputs.cache-hit != 'true' }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e5fe5b605..5a56c34e80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,7 @@ adios_option(Profiling "Enable support for profiling" AUTO) adios_option(Endian_Reverse "Enable support for Little/Big Endian Interoperability" AUTO) adios_option(Sodium "Enable support for Sodium for encryption" AUTO) adios_option(Catalyst "Enable support for in situ visualization plugin using ParaView Catalyst" AUTO) -adios_option(Campaign "Enable support for Campaigns (requires SQLite3 and ZLIB)" OFF) +adios_option(Campaign "Enable support for Campaigns (requires SQLite3 and ZLIB)" AUTO) adios_option(AWSSDK "Enable support for S3 compatible storage using AWS SDK's S3 module" OFF) adios_option(Derived_Variable "Enable support for derived variables" OFF) adios_option(PIP "Enable support for pip packaging" OFF) @@ -444,9 +444,21 @@ foreach(opt IN LISTS ADIOS2_CONFIG_OPTS) endif() endforeach() -if (ADIOS2_HAVE_SST AND (ADIOS2_SST_HAVE_LIBFABRIC OR ADIOS2_SST_HAVE_UCX)) -message(" RDMA Transport for Staging: Available") +set (HPCDataPlaneList "") +if (ADIOS2_HAVE_SST) + if (ADIOS2_SST_HAVE_LIBFABRIC) + set (HPCDataPlaneList "${HPCDataPlaneList} fabric") + endif() + if (ADIOS2_SST_HAVE_UCX) + set (HPCDataPlaneList "${HPCDataPlaneList} UCX") + endif() + if (ADIOS2_SST_HAVE_MPI_DP) + set (HPCDataPlaneList "${HPCDataPlaneList} MPI") + endif() +endif() +if ({HPCDataPlaneList} STREQUAL "") + message(" Possible RDMA DataPlanes for SST: ") else() -message(" RDMA Transport for Staging: Unconfigured") + message(" Possible RDMA DataPlanes for SST: ${HPCDataPlaneList}") endif() diff --git a/bindings/C/adios2/c/adios2_c_io.cpp b/bindings/C/adios2/c/adios2_c_io.cpp index a4b8921224..d3842d6033 100644 --- a/bindings/C/adios2/c/adios2_c_io.cpp +++ b/bindings/C/adios2/c/adios2_c_io.cpp @@ -150,6 +150,43 @@ adios2_error adios2_set_transport_parameter(adios2_io *io, const size_t transpor } } +#ifdef ADIOS2_HAVE_DERIVED_VARIABLE +adios2_derived_variable *adios2_define_derived_variable(adios2_io *io, const char *name, + const char *expression, + const adios2_derived_var_type type) +{ + adios2_derived_variable *variable = nullptr; + + try + { + adios2::helper::CheckForNullptr(io, "for adios2_io, in call to adios2_define_variable"); + adios2::core::IO &ioCpp = *reinterpret_cast(io); + adios2::DerivedVarType typeCpp = adios2::DerivedVarType::MetadataOnly; + switch (type) + { + case adios2_derived_var_type_metadata_only: + typeCpp = adios2::DerivedVarType::MetadataOnly; + break; + case adios2_derived_var_type_expression_string: + typeCpp = adios2::DerivedVarType::ExpressionString; + break; + case adios2_derived_var_type_store_data: + typeCpp = adios2::DerivedVarType::StoreData; + break; + } + adios2::core::VariableDerived *variableCpp = nullptr; + variableCpp = &ioCpp.DefineDerivedVariable(name, expression, typeCpp); + variable = reinterpret_cast(variableCpp); + } + catch (...) + { + + adios2::helper::ExceptionToError("adios2_define_variable"); + } + return variable; +} +#endif + adios2_variable *adios2_define_variable(adios2_io *io, const char *name, const adios2_type type, const size_t ndims, const size_t *shape, const size_t *start, const size_t *count, diff --git a/bindings/C/adios2/c/adios2_c_io.h b/bindings/C/adios2/c/adios2_c_io.h index 8a8272c5a7..09fa10e256 100644 --- a/bindings/C/adios2/c/adios2_c_io.h +++ b/bindings/C/adios2/c/adios2_c_io.h @@ -122,6 +122,26 @@ adios2_variable *adios2_define_variable(adios2_io *io, const char *name, const a const size_t *start, const size_t *count, const adios2_constant_dims constant_dims); +#ifdef ADIOS2_HAVE_DERIVED_VARIABLE +/** + * @brief Define a derived variable within io + * @param io handler that owns the variable + * @param name unique variable identifier + * @param type primitive type from enum adios2_type in adios2_c_types.h + * @param ndims number of dimensions + * @param shape global dimension + * @param start local offset + * @param count local dimension + * @param constant_dims adios2_constant_dims_true:: shape, start, count + * won't change; adios2_constant_dims_false: shape, start, count will change + * after definition + * @return success: handler, failure: NULL + */ +adios2_derived_variable *adios2_define_derived_variable(adios2_io *io, const char *name, + const char *expression, + const adios2_derived_var_type type); +#endif + /** * @brief Retrieve a variable handler within current io handler * @param io handler to variable io owner diff --git a/bindings/C/adios2/c/adios2_c_types.h b/bindings/C/adios2/c/adios2_c_types.h index 81f6ad3479..fb102df4cb 100644 --- a/bindings/C/adios2/c/adios2_c_types.h +++ b/bindings/C/adios2/c/adios2_c_types.h @@ -23,6 +23,7 @@ extern "C" { typedef struct adios2_adios adios2_adios; typedef struct adios2_io adios2_io; typedef struct adios2_variable adios2_variable; +typedef struct adios2_derived_variable adios2_derived_variable; typedef struct adios2_attribute adios2_attribute; typedef struct adios2_engine adios2_engine; typedef struct adios2_operator adios2_operator; @@ -139,6 +140,16 @@ typedef enum adios2_arrayordering_auto } adios2_arrayordering; +#ifdef ADIOS2_HAVE_DERIVED_VARIABLE +/** Type of derived variables */ +typedef enum +{ + adios2_derived_var_type_metadata_only = 0, + adios2_derived_var_type_expression_string = 1, + adios2_derived_var_type_store_data = 2 +} adios2_derived_var_type; +#endif + static const size_t adios2_string_array_element_max_size = 4096; static const size_t adios2_local_value_dim = SIZE_MAX - 2; diff --git a/bindings/C/adios2/c/adios2_c_variable.cpp b/bindings/C/adios2/c/adios2_c_variable.cpp index f17b8c44ae..a8d02bf5ad 100644 --- a/bindings/C/adios2/c/adios2_c_variable.cpp +++ b/bindings/C/adios2/c/adios2_c_variable.cpp @@ -79,11 +79,7 @@ adios2_error adios2_set_shape(adios2_variable *variable, const size_t ndims, con adios2::MemorySpace adios2_ToMemorySpace(const adios2_memory_space Cmem) { -#ifdef ADIOS2_HAVE_GPU_SUPPORT adios2::MemorySpace mem = adios2::MemorySpace::Detect; -#else - adios2::MemorySpace mem = adios2::MemorySpace::Host; -#endif switch (Cmem) { @@ -104,11 +100,7 @@ adios2::MemorySpace adios2_ToMemorySpace(const adios2_memory_space Cmem) adios2_memory_space adios2_FromMemorySpace(const adios2::MemorySpace mem) { -#ifdef ADIOS2_HAVE_GPU_SUPPORT adios2_memory_space Cmem = adios2_memory_space_detect; -#else - adios2_memory_space Cmem = adios2_memory_space_host; -#endif switch (mem) { diff --git a/bindings/Fortran/CMakeLists.txt b/bindings/Fortran/CMakeLists.txt index 1a998bbe95..20c8407c5e 100644 --- a/bindings/Fortran/CMakeLists.txt +++ b/bindings/Fortran/CMakeLists.txt @@ -44,6 +44,7 @@ add_library(adios2_fortran modules/adios2_io_open_mod.F90 modules/adios2_io_open_serial_smod.F90 modules/adios2_io_define_variable_mod.f90 + modules/adios2_io_define_derived_variable_mod.f90 modules/adios2_io_define_attribute_mod.f90 modules/adios2_engine_mod.f90 modules/adios2_engine_begin_step_mod.f90 @@ -54,6 +55,7 @@ add_library(adios2_fortran modules/adios2_variable_max_mod.f90 modules/adios2_operator_mod.f90 ) + set_property(TARGET adios2_fortran PROPERTY EXPORT_NAME fortran) set_property(TARGET adios2_fortran PROPERTY OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_fortran) diff --git a/bindings/Fortran/f2c/adios2_f2c_io.cpp b/bindings/Fortran/f2c/adios2_f2c_io.cpp index ef3899d5a0..b1acb6079e 100644 --- a/bindings/Fortran/f2c/adios2_f2c_io.cpp +++ b/bindings/Fortran/f2c/adios2_f2c_io.cpp @@ -201,6 +201,27 @@ void FC_GLOBAL(adios2_define_variable_f2c, } } +void FC_GLOBAL(adios2_define_derived_variable_f2c, + ADIOS2_DEFINE_DERIVED_VARIABLE_F2C)(adios2_derived_variable **variable, + adios2_io **io, const char *name, + const char *expression, const int *type, + int *ierr) +{ +#ifdef ADIOS2_HAVE_DERIVED_VARIABLE + *variable = adios2_define_derived_variable(*io, name, expression, + static_cast(*type)); + *ierr = (*variable == NULL) ? static_cast(adios2_error_exception) + : static_cast(adios2_error_none); +#else + std::cout << "ADIOS2 Warning: adios2_define_derived_variable() is not supported in the " + "current ADIOS2 build. The expression " + << expression << " will be ignored and the variable " << name + << " will not be produced." << std::endl; + *variable = nullptr; + *ierr = static_cast(adios2_error_exception); +#endif +} + struct cnamelist { char **names; @@ -267,7 +288,7 @@ void FC_GLOBAL(adios2_retrieve_namelist_f2c, len = static_cast(namelist_len); } // copy C string without '\0' - strncpy(fs, info->names[i], len); + memcpy(fs, info->names[i], len); // pad with spaces memset(fs + len, ' ', namelist_len - len); } diff --git a/bindings/Fortran/modules/adios2_io_define_derived_variable_mod.f90 b/bindings/Fortran/modules/adios2_io_define_derived_variable_mod.f90 new file mode 100644 index 0000000000..fc6feced5b --- /dev/null +++ b/bindings/Fortran/modules/adios2_io_define_derived_variable_mod.f90 @@ -0,0 +1,40 @@ +! +! Distributed under the OSI-approved Apache License, Version 2.0. See +! accompanying file Copyright.txt for details. +! +! adios2_io_define_variable_mod.f90 : ADIOS2 Fortran bindings for IO class +! overloaded (C++ template) function adios2_define_variable +! +! Created on: Mar 13, 2017 +! Author: William F Godoy godoywf@ornl.gov +! + +module adios2_io_define_derived_variable_mod + use adios2_parameters_mod + implicit none + + external adios2_define_derived_variable_f2c + +contains + + subroutine adios2_define_derived_variable(variable, io, name, expression, adios2_derived_var_type, & + ierr) + type(adios2_derived_variable), intent(out) :: variable + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: name + character*(*), intent(in) :: expression + integer, intent(in):: adios2_derived_var_type + integer, intent(out) :: ierr + + call adios2_define_derived_variable_f2c(variable%f2c, io%f2c, & + TRIM(ADJUSTL(name))//char(0), TRIM(ADJUSTL(expression))//char(0), & + adios2_derived_var_type, ierr) + if( ierr == 0 ) then + variable%valid = .true. + variable%name = name + variable%type = adios2_derived_var_type + end if + + end subroutine + +end module diff --git a/bindings/Fortran/modules/adios2_io_mod.f90 b/bindings/Fortran/modules/adios2_io_mod.f90 index 6011df1978..4786097e78 100644 --- a/bindings/Fortran/modules/adios2_io_mod.f90 +++ b/bindings/Fortran/modules/adios2_io_mod.f90 @@ -9,402 +9,403 @@ ! module adios2_io_mod - use adios2_io_open_mod - use adios2_io_define_variable_mod - use adios2_io_define_attribute_mod - use adios2_variable_mod - implicit none - - external adios2_add_transport_f2c - external adios2_attribute_is_value_f2c - external adios2_attribute_length_f2c - external adios2_attribute_type_f2c - external adios2_clear_parameters_f2c - external adios2_flush_all_engines_f2c - external adios2_get_parameter_f2c - external adios2_get_parameter_length_f2c - external adios2_in_config_file_f2c - external adios2_available_variables_f2c - external adios2_available_attributes_f2c - external adios2_retrieve_namelist_f2c - external adios2_inquire_attribute_f2c - external adios2_inquire_variable_attribute_f2c - external adios2_inquire_variable_f2c - external adios2_io_engine_type_f2c - external adios2_io_engine_type_length_f2c - external adios2_remove_all_attributes_f2c - external adios2_remove_all_variables_f2c - external adios2_remove_attribute_f2c - external adios2_remove_variable_f2c - external adios2_set_engine_f2c - external adios2_set_parameter_f2c - external adios2_set_parameters_f2c - external adios2_set_transport_parameter_f2c + use adios2_io_open_mod + use adios2_io_define_variable_mod + use adios2_io_define_derived_variable_mod + use adios2_io_define_attribute_mod + use adios2_variable_mod + implicit none + + external adios2_add_transport_f2c + external adios2_attribute_is_value_f2c + external adios2_attribute_length_f2c + external adios2_attribute_type_f2c + external adios2_clear_parameters_f2c + external adios2_flush_all_engines_f2c + external adios2_get_parameter_f2c + external adios2_get_parameter_length_f2c + external adios2_in_config_file_f2c + external adios2_available_variables_f2c + external adios2_available_attributes_f2c + external adios2_retrieve_namelist_f2c + external adios2_inquire_attribute_f2c + external adios2_inquire_variable_attribute_f2c + external adios2_inquire_variable_f2c + external adios2_io_engine_type_f2c + external adios2_io_engine_type_length_f2c + external adios2_remove_all_attributes_f2c + external adios2_remove_all_variables_f2c + external adios2_remove_attribute_f2c + external adios2_remove_variable_f2c + external adios2_set_engine_f2c + external adios2_set_parameter_f2c + external adios2_set_parameters_f2c + external adios2_set_transport_parameter_f2c contains - subroutine adios2_in_config_file(result, io, ierr) - logical, intent(out):: result - type(adios2_io), intent(in):: io - integer, intent(out):: ierr + subroutine adios2_in_config_file(result, io, ierr) + logical, intent(out):: result + type(adios2_io), intent(in):: io + integer, intent(out):: ierr - ! local - integer resultInt - - call adios2_in_config_file_f2c(resultInt, io, ierr) - if(resultInt == 0) then - result = .false. - else - result = .true. - end if - - end subroutine - - subroutine adios2_io_engine_type(type, io, ierr) - character(len=:), allocatable, intent(out) :: type - type(adios2_io), intent(in) :: io - integer, intent(out) :: ierr - - !local - integer :: length - - if (allocated(type)) deallocate (type) - - call adios2_io_engine_type_length_f2c(length, io%f2c, ierr) - if (ierr == 0) then - allocate (character(length) :: type) - call adios2_io_engine_type_f2c(type, io%f2c, ierr) - end if - - end subroutine - - subroutine adios2_set_engine(io, engine_type, ierr) - type(adios2_io), intent(inout) :: io - character*(*), intent(in) :: engine_type - integer, intent(out) :: ierr - - call adios2_set_engine_f2c(io%f2c, & - TRIM(ADJUSTL(engine_type))//char(0), ierr) - - if( ierr == 0 ) io%engine_type = engine_type - - end subroutine - - subroutine adios2_set_parameters(io, parameters, ierr) - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: parameters - integer, intent(out) :: ierr - - call adios2_set_parameters_f2c(io%f2c, & - TRIM(ADJUSTL(parameters))//char(0), & - ierr) - end subroutine - - subroutine adios2_set_parameter(io, key, value, ierr) - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: key - character*(*), intent(in) :: value - integer, intent(out) :: ierr - - call adios2_set_parameter_f2c(io%f2c, TRIM(ADJUSTL(key))//char(0), & - TRIM(ADJUSTL(value))//char(0), ierr) - end subroutine - - subroutine adios2_get_parameter(value, io, key, ierr) - character(len=:), allocatable, intent(out) :: value - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: key - integer, intent(out) :: ierr - - !local - integer :: length - - if (allocated(value)) deallocate (value) - - call adios2_get_parameter_length_f2c(length, io%f2c, & - TRIM(ADJUSTL(key))//char(0), ierr) - if (ierr == 0) then - allocate (character(length) :: value) - call adios2_get_parameter_f2c(value, io%f2c, & - TRIM(ADJUSTL(key))//char(0), ierr) - end if - end subroutine - - subroutine adios2_clear_parameters(io, ierr) - type(adios2_io), intent(in) :: io - integer, intent(out) :: ierr - call adios2_clear_parameters_f2c(io%f2c, ierr) - end subroutine - - subroutine adios2_add_transport(transport_index, io, type, ierr) - integer, intent(out):: transport_index - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: type - integer, intent(out) :: ierr - - call adios2_add_transport_f2c(transport_index, io%f2c, & - TRIM(ADJUSTL(type))//char(0), ierr) - - end subroutine - - subroutine adios2_set_transport_parameter(io, transport_index, key, value, & - ierr) - type(adios2_io), intent(in):: io - integer, intent(in):: transport_index - character*(*), intent(in) :: key - character*(*), intent(in) :: value - integer, intent(out):: ierr - - call adios2_set_transport_parameter_f2c(io%f2c, transport_index, & - TRIM(ADJUSTL(key))//char(0), & - TRIM(ADJUSTL(value))//char(0), & - ierr) - end subroutine - - - subroutine adios2_available_variables(io, namestruct, ierr) - type(adios2_io), intent(in) :: io - type(adios2_namestruct), intent(out) :: namestruct - integer, intent(out) :: ierr - - call adios2_available_variables_f2c(io%f2c, namestruct%f2c, & - namestruct%count, namestruct%max_name_len, ierr) - if (ierr == 0) then - namestruct%valid = .true. - endif - end subroutine - - subroutine adios2_retrieve_names(namestruct, namelist, ierr) - type(adios2_namestruct), intent(inout) :: namestruct - character(*), dimension(*), intent(inout) :: namelist - integer, intent(out) :: ierr - - if (namestruct%valid .and. namestruct%f2c > 0_8) then - call adios2_retrieve_namelist_f2c(namestruct%f2c, namelist, ierr) - else - write(*,*) "ADIOS2 Fortran ERROR: invalid namestruct when calling adios2_retrieve_names()" - endif - namestruct%valid = .false. - end subroutine - - ! - ! F2008 implementation that allows for allocating a character array inside - ! - ! subroutine adios2_available_variables(io, nvars, varnamelist, ierr) - ! type(adios2_io), intent(in) :: io - ! integer, intent(out) :: nvars - ! character(len=:), dimension(:), allocatable, intent(out) :: varnamelist - ! integer, intent(out) :: ierr - - ! integer(kind=8):: namestruct - ! integer :: count, max_name_len - - ! call adios2_available_variables_f2c(io%f2c, namestruct, count, & - ! max_name_len, ierr) - ! if (ierr == 0) then - ! allocate(character(len=max_name_len) :: varnamelist(count)) - ! endif - - ! call adios2_retrieve_variable_names_f2c(namestruct, varnamelist, ierr) - ! nvars = count - ! end subroutine - - - subroutine adios2_inquire_variable(variable, io, name, ierr) - type(adios2_variable), intent(out) :: variable - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: name - integer, intent(out) :: ierr - - call adios2_inquire_variable_f2c(variable%f2c, io%f2c, & - TRIM(ADJUSTL(name))//char(0), ierr) - - if(variable%f2c > 0_8) then - variable%valid = .true. - variable%name = name - call adios2_variable_type(variable%type, variable, ierr) - call adios2_variable_ndims(variable%ndims, variable, ierr) - else - variable%valid = .false. - variable%name = '' - variable%type = adios2_type_unknown - variable%ndims = -1 - end if - - end subroutine - - subroutine adios2_remove_variable(result, io, name, ierr) - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: name - logical, intent(out) :: result - integer, intent(out) :: ierr - ! Local - type(adios2_variable):: variable - integer:: resultInt - - call adios2_inquire_variable(variable, io, name, ierr) - if( variable%valid ) then - call adios2_remove_variable_f2c(resultInt, io%f2c, & - TRIM(ADJUSTL(name))//char(0), ierr) - if( resultInt == 1) then - result = .true. - else - result = .false. - end if - end if - - end subroutine - - - subroutine adios2_remove_all_variables(io, ierr) - type(adios2_io), intent(in) :: io - integer, intent(out) :: ierr - - call adios2_remove_all_variables_f2c(io%f2c, ierr) - - end subroutine - - subroutine adios2_available_attributes(io, namestruct, ierr) - type(adios2_io), intent(in) :: io - type(adios2_namestruct), intent(out) :: namestruct - integer, intent(out) :: ierr - - call adios2_available_attributes_f2c(io%f2c, namestruct%f2c, & - namestruct%count, namestruct%max_name_len, ierr) - if (ierr == 0) then - namestruct%valid = .true. - endif - end subroutine - - ! subroutine adios2_available_attributes(io, nattrs, attrnamelist, ierr) - ! type(adios2_io), intent(in) :: io - ! integer, intent(out) :: nattrs - ! character(len=:), dimension(:), allocatable, intent(out) :: attrnamelist - ! integer, intent(out) :: ierr - - ! integer(kind=8):: namestruct - ! integer :: count, max_name_len - - ! call adios2_available_attributes_f2c(io%f2c, namestruct, count, & - ! max_name_len, ierr) - ! if (ierr == 0) then - ! allocate(character(len=max_name_len) :: attrnamelist(count)) - ! endif - - ! call adios2_retrieve_attribute_names_f2c(namestruct, count, & - ! max_name_len, attrnamelist, ierr) - ! nattrs = count - ! end subroutine - - subroutine adios2_inquire_attribute(attribute, io, name, ierr) - type(adios2_attribute), intent(out) :: attribute - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: name - integer, intent(out) :: ierr - !local - integer:: is_valueInt - - call adios2_inquire_attribute_f2c(attribute%f2c, io%f2c, & - TRIM(ADJUSTL(name))//char(0), ierr) - - if(attribute%f2c > 0_8) then - attribute%valid = .true. - attribute%name = name - call adios2_attribute_type_f2c(attribute%type, attribute%f2c, ierr) - call adios2_attribute_length_f2c(attribute%length, attribute%f2c, & - ierr) - call adios2_attribute_is_value_f2c(is_valueInt, attribute%f2c, ierr) - - if(is_valueInt == 0) then - attribute%is_value = .false. - else - attribute%is_value = .true. - end if - - else - attribute%valid = .false. - attribute%name = '' - attribute%type = adios2_type_unknown - attribute%length = 0 - end if - - end subroutine - - subroutine adios2_inquire_variable_attribute(attribute, io, attribute_name, variable_name, separator, ierr) - type(adios2_attribute), intent(out) :: attribute - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: attribute_name - character*(*), intent(in) :: variable_name - character*(*), intent(in) :: separator - integer, intent(out) :: ierr - !local - integer:: is_valueInt - - call adios2_inquire_variable_attribute_f2c(attribute%f2c, io%f2c, & - TRIM(ADJUSTL(attribute_name))//char(0), & - TRIM(ADJUSTL(variable_name))//char(0), & - TRIM(ADJUSTL(separator))//char(0), & - ierr) - - if(attribute%f2c > 0_8) then - attribute%valid = .true. - attribute%name = TRIM(variable_name)//TRIM(separator)//TRIM(attribute_name) - call adios2_attribute_type_f2c(attribute%type, attribute%f2c, ierr) - call adios2_attribute_length_f2c(attribute%length, attribute%f2c, & - ierr) - call adios2_attribute_is_value_f2c(is_valueInt, attribute%f2c, ierr) - - if(is_valueInt == 0) then - attribute%is_value = .false. - else - attribute%is_value = .true. - end if - - else - attribute%valid = .false. - attribute%name = '' - attribute%type = adios2_type_unknown - attribute%length = 0 - end if - - end subroutine - - - subroutine adios2_remove_attribute(result, io, name, ierr) - type(adios2_io), intent(in) :: io - character*(*), intent(in) :: name - logical, intent(out) :: result - integer, intent(out) :: ierr - - ! Local - integer :: resultInt - - call adios2_remove_attribute_f2c(resultInt, io%f2c, & - TRIM(ADJUSTL(name))//char(0), ierr) - if( resultInt == 1) then + ! local + integer resultInt + + call adios2_in_config_file_f2c(resultInt, io, ierr) + if(resultInt == 0) then + result = .false. + else + result = .true. + end if + + end subroutine + + subroutine adios2_io_engine_type(type, io, ierr) + character(len=:), allocatable, intent(out) :: type + type(adios2_io), intent(in) :: io + integer, intent(out) :: ierr + + !local + integer :: length + + if (allocated(type)) deallocate (type) + + call adios2_io_engine_type_length_f2c(length, io%f2c, ierr) + if (ierr == 0) then + allocate (character(length) :: type) + call adios2_io_engine_type_f2c(type, io%f2c, ierr) + end if + + end subroutine + + subroutine adios2_set_engine(io, engine_type, ierr) + type(adios2_io), intent(inout) :: io + character*(*), intent(in) :: engine_type + integer, intent(out) :: ierr + + call adios2_set_engine_f2c(io%f2c, & + TRIM(ADJUSTL(engine_type))//char(0), ierr) + + if( ierr == 0 ) io%engine_type = engine_type + + end subroutine + + subroutine adios2_set_parameters(io, parameters, ierr) + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: parameters + integer, intent(out) :: ierr + + call adios2_set_parameters_f2c(io%f2c, & + TRIM(ADJUSTL(parameters))//char(0), & + ierr) + end subroutine + + subroutine adios2_set_parameter(io, key, value, ierr) + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: key + character*(*), intent(in) :: value + integer, intent(out) :: ierr + + call adios2_set_parameter_f2c(io%f2c, TRIM(ADJUSTL(key))//char(0), & + TRIM(ADJUSTL(value))//char(0), ierr) + end subroutine + + subroutine adios2_get_parameter(value, io, key, ierr) + character(len=:), allocatable, intent(out) :: value + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: key + integer, intent(out) :: ierr + + !local + integer :: length + + if (allocated(value)) deallocate (value) + + call adios2_get_parameter_length_f2c(length, io%f2c, & + TRIM(ADJUSTL(key))//char(0), ierr) + if (ierr == 0) then + allocate (character(length) :: value) + call adios2_get_parameter_f2c(value, io%f2c, & + TRIM(ADJUSTL(key))//char(0), ierr) + end if + end subroutine + + subroutine adios2_clear_parameters(io, ierr) + type(adios2_io), intent(in) :: io + integer, intent(out) :: ierr + call adios2_clear_parameters_f2c(io%f2c, ierr) + end subroutine + + subroutine adios2_add_transport(transport_index, io, type, ierr) + integer, intent(out):: transport_index + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: type + integer, intent(out) :: ierr + + call adios2_add_transport_f2c(transport_index, io%f2c, & + TRIM(ADJUSTL(type))//char(0), ierr) + + end subroutine + + subroutine adios2_set_transport_parameter(io, transport_index, key, value, & + ierr) + type(adios2_io), intent(in):: io + integer, intent(in):: transport_index + character*(*), intent(in) :: key + character*(*), intent(in) :: value + integer, intent(out):: ierr + + call adios2_set_transport_parameter_f2c(io%f2c, transport_index, & + TRIM(ADJUSTL(key))//char(0), & + TRIM(ADJUSTL(value))//char(0), & + ierr) + end subroutine + + + subroutine adios2_available_variables(io, namestruct, ierr) + type(adios2_io), intent(in) :: io + type(adios2_namestruct), intent(out) :: namestruct + integer, intent(out) :: ierr + + call adios2_available_variables_f2c(io%f2c, namestruct%f2c, & + namestruct%count, namestruct%max_name_len, ierr) + if (ierr == 0) then + namestruct%valid = .true. + endif + end subroutine + + subroutine adios2_retrieve_names(namestruct, namelist, ierr) + type(adios2_namestruct), intent(inout) :: namestruct + character(*), dimension(*), intent(inout) :: namelist + integer, intent(out) :: ierr + + if (namestruct%valid .and. namestruct%f2c > 0_8) then + call adios2_retrieve_namelist_f2c(namestruct%f2c, namelist, ierr) + else + write(*,*) "ADIOS2 Fortran ERROR: invalid namestruct when calling adios2_retrieve_names()" + endif + namestruct%valid = .false. + end subroutine + + ! + ! F2008 implementation that allows for allocating a character array inside + ! + ! subroutine adios2_available_variables(io, nvars, varnamelist, ierr) + ! type(adios2_io), intent(in) :: io + ! integer, intent(out) :: nvars + ! character(len=:), dimension(:), allocatable, intent(out) :: varnamelist + ! integer, intent(out) :: ierr + + ! integer(kind=8):: namestruct + ! integer :: count, max_name_len + + ! call adios2_available_variables_f2c(io%f2c, namestruct, count, & + ! max_name_len, ierr) + ! if (ierr == 0) then + ! allocate(character(len=max_name_len) :: varnamelist(count)) + ! endif + + ! call adios2_retrieve_variable_names_f2c(namestruct, varnamelist, ierr) + ! nvars = count + ! end subroutine + + + subroutine adios2_inquire_variable(variable, io, name, ierr) + type(adios2_variable), intent(out) :: variable + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: name + integer, intent(out) :: ierr + + call adios2_inquire_variable_f2c(variable%f2c, io%f2c, & + TRIM(ADJUSTL(name))//char(0), ierr) + + if(variable%f2c > 0_8) then + variable%valid = .true. + variable%name = name + call adios2_variable_type(variable%type, variable, ierr) + call adios2_variable_ndims(variable%ndims, variable, ierr) + else + variable%valid = .false. + variable%name = '' + variable%type = adios2_type_unknown + variable%ndims = -1 + end if + + end subroutine + + subroutine adios2_remove_variable(result, io, name, ierr) + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: name + logical, intent(out) :: result + integer, intent(out) :: ierr + ! Local + type(adios2_variable):: variable + integer:: resultInt + + call adios2_inquire_variable(variable, io, name, ierr) + if( variable%valid ) then + call adios2_remove_variable_f2c(resultInt, io%f2c, & + TRIM(ADJUSTL(name))//char(0), ierr) + if( resultInt == 1) then result = .true. - else + else result = .false. - end if - - end subroutine - - - subroutine adios2_remove_all_attributes(io, ierr) - type(adios2_io), intent(in) :: io - integer, intent(out) :: ierr - - call adios2_remove_all_attributes_f2c(io%f2c, ierr) - - end subroutine - - - subroutine adios2_flush_all_engines(io, ierr) - type(adios2_io), intent(in) :: io - integer, intent(out) :: ierr - - call adios2_flush_all_engines_f2c(io%f2c, ierr) - - end subroutine + end if + end if + + end subroutine + + + subroutine adios2_remove_all_variables(io, ierr) + type(adios2_io), intent(in) :: io + integer, intent(out) :: ierr + + call adios2_remove_all_variables_f2c(io%f2c, ierr) + + end subroutine + + subroutine adios2_available_attributes(io, namestruct, ierr) + type(adios2_io), intent(in) :: io + type(adios2_namestruct), intent(out) :: namestruct + integer, intent(out) :: ierr + + call adios2_available_attributes_f2c(io%f2c, namestruct%f2c, & + namestruct%count, namestruct%max_name_len, ierr) + if (ierr == 0) then + namestruct%valid = .true. + endif + end subroutine + + ! subroutine adios2_available_attributes(io, nattrs, attrnamelist, ierr) + ! type(adios2_io), intent(in) :: io + ! integer, intent(out) :: nattrs + ! character(len=:), dimension(:), allocatable, intent(out) :: attrnamelist + ! integer, intent(out) :: ierr + + ! integer(kind=8):: namestruct + ! integer :: count, max_name_len + + ! call adios2_available_attributes_f2c(io%f2c, namestruct, count, & + ! max_name_len, ierr) + ! if (ierr == 0) then + ! allocate(character(len=max_name_len) :: attrnamelist(count)) + ! endif + + ! call adios2_retrieve_attribute_names_f2c(namestruct, count, & + ! max_name_len, attrnamelist, ierr) + ! nattrs = count + ! end subroutine + + subroutine adios2_inquire_attribute(attribute, io, name, ierr) + type(adios2_attribute), intent(out) :: attribute + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: name + integer, intent(out) :: ierr + !local + integer:: is_valueInt + + call adios2_inquire_attribute_f2c(attribute%f2c, io%f2c, & + TRIM(ADJUSTL(name))//char(0), ierr) + + if(attribute%f2c > 0_8) then + attribute%valid = .true. + attribute%name = name + call adios2_attribute_type_f2c(attribute%type, attribute%f2c, ierr) + call adios2_attribute_length_f2c(attribute%length, attribute%f2c, & + ierr) + call adios2_attribute_is_value_f2c(is_valueInt, attribute%f2c, ierr) + + if(is_valueInt == 0) then + attribute%is_value = .false. + else + attribute%is_value = .true. + end if + + else + attribute%valid = .false. + attribute%name = '' + attribute%type = adios2_type_unknown + attribute%length = 0 + end if + + end subroutine + + subroutine adios2_inquire_variable_attribute(attribute, io, attribute_name, variable_name, separator, ierr) + type(adios2_attribute), intent(out) :: attribute + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: attribute_name + character*(*), intent(in) :: variable_name + character*(*), intent(in) :: separator + integer, intent(out) :: ierr + !local + integer:: is_valueInt + + call adios2_inquire_variable_attribute_f2c(attribute%f2c, io%f2c, & + TRIM(ADJUSTL(attribute_name))//char(0), & + TRIM(ADJUSTL(variable_name))//char(0), & + TRIM(ADJUSTL(separator))//char(0), & + ierr) + + if(attribute%f2c > 0_8) then + attribute%valid = .true. + attribute%name = TRIM(variable_name)//TRIM(separator)//TRIM(attribute_name) + call adios2_attribute_type_f2c(attribute%type, attribute%f2c, ierr) + call adios2_attribute_length_f2c(attribute%length, attribute%f2c, & + ierr) + call adios2_attribute_is_value_f2c(is_valueInt, attribute%f2c, ierr) + + if(is_valueInt == 0) then + attribute%is_value = .false. + else + attribute%is_value = .true. + end if + + else + attribute%valid = .false. + attribute%name = '' + attribute%type = adios2_type_unknown + attribute%length = 0 + end if + + end subroutine + + + subroutine adios2_remove_attribute(result, io, name, ierr) + type(adios2_io), intent(in) :: io + character*(*), intent(in) :: name + logical, intent(out) :: result + integer, intent(out) :: ierr + + ! Local + integer :: resultInt + + call adios2_remove_attribute_f2c(resultInt, io%f2c, & + TRIM(ADJUSTL(name))//char(0), ierr) + if( resultInt == 1) then + result = .true. + else + result = .false. + end if + + end subroutine + + + subroutine adios2_remove_all_attributes(io, ierr) + type(adios2_io), intent(in) :: io + integer, intent(out) :: ierr + + call adios2_remove_all_attributes_f2c(io%f2c, ierr) + + end subroutine + + + subroutine adios2_flush_all_engines(io, ierr) + type(adios2_io), intent(in) :: io + integer, intent(out) :: ierr + + call adios2_flush_all_engines_f2c(io%f2c, ierr) + + end subroutine end module diff --git a/bindings/Fortran/modules/adios2_parameters_mod.f90 b/bindings/Fortran/modules/adios2_parameters_mod.f90 index a96fd8549a..bf0dd18c9b 100644 --- a/bindings/Fortran/modules/adios2_parameters_mod.f90 +++ b/bindings/Fortran/modules/adios2_parameters_mod.f90 @@ -9,131 +9,143 @@ ! module adios2_parameters_mod - implicit none - - ! Types - integer, parameter :: adios2_type_unknown = -1 - - integer, parameter :: adios2_type_character = 0 - integer, parameter :: adios2_type_string = 0 - - integer, parameter :: adios2_type_real4 = 1 - integer, parameter :: adios2_type_real = 1 - - integer, parameter :: adios2_type_real8 = 2 - integer, parameter :: adios2_type_dp = 2 - integer, parameter :: adios2_type_double_precision = 2 - - integer, parameter :: adios2_type_complex4 = 3 - integer, parameter :: adios2_type_complex = 3 - - integer, parameter :: adios2_type_complex8 = 4 - integer, parameter :: adios2_type_complex_dp = 4 - - integer, parameter :: adios2_type_integer1 = 5 - integer, parameter :: adios2_type_integer2 = 6 - integer, parameter :: adios2_type_integer4 = 7 - integer, parameter :: adios2_type_integer8 = 8 - - ! is_constant_dims - logical, parameter :: adios2_constant_dims = .true. - logical, parameter :: adios2_variable_dims = .false. - - ! Variable Found or not found, ierr value - integer, parameter :: adios2_not_found = -1 - integer, parameter :: adios2_found = 0 - - ! error - integer, parameter :: adios2_error_none = 0 - integer, parameter :: adios2_error_invalid_argument = 1 - integer, parameter :: adios2_error_system_error = 2 - integer, parameter :: adios2_error_runtime_error = 3 - integer, parameter :: adios2_error_exception = 4 - - ! Mode - integer, parameter :: adios2_mode_undefined = 0 - integer, parameter :: adios2_mode_write = 1 - integer, parameter :: adios2_mode_read = 2 - integer, parameter :: adios2_mode_append = 3 - integer, parameter :: adios2_mode_readRandomAccess = 6 - - integer, parameter :: adios2_mode_deferred = 4 - integer, parameter :: adios2_mode_sync = 5 - - integer, parameter :: adios2_memory_space_detect = 0 - integer, parameter :: adios2_memory_space_host = 1 - integer, parameter :: adios2_memory_space_gpu = 2 - - ! Step Mode - integer, parameter :: adios2_step_mode_append = 0 - integer, parameter :: adios2_step_mode_update = 1 - integer, parameter :: adios2_step_mode_read = 2 - - ! Step Status - integer, parameter :: adios2_step_status_other_error = -1 - integer, parameter :: adios2_step_status_ok = 0 - integer, parameter :: adios2_step_status_not_ready = 1 - integer, parameter :: adios2_step_status_end_of_stream = 2 - - !> Fixed size for string array, used in variables and attributes, - !! must be less or equal than C equivalent in adios2_c_types.h - integer, parameter :: adios2_string_array_element_max_size = 4096 - - integer(kind=8), parameter, dimension(1) :: adios2_null_dims = (/-1/) - integer(kind=8), parameter :: adios2_local_value_dim = -2 - - logical, parameter :: adios2_advance_yes = .true. - logical, parameter :: adios2_advance_no = .false. - - ! Low level API handlers - type adios2_adios - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - end type - - type adios2_io - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - character(len=15):: engine_type = 'BPFile' - end type - - type adios2_variable - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - character(len=4096):: name = '' - integer :: type = -1 - integer :: ndims = -1 - end type - - type adios2_attribute - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - logical :: is_value = .false. - character(len=4096):: name = '' - integer :: type = -1 - integer :: length = -1 - end type - - type adios2_engine - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - character(len=64):: name = '' - character(len=15):: type = '' - integer :: mode = adios2_mode_undefined - end type - - type adios2_operator - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - character(len=64):: name = '' - character(len=64):: type = '' - end type - - type adios2_namestruct - integer(kind=8):: f2c = 0_8 - logical :: valid = .false. - integer :: count - integer :: max_name_len - end type + implicit none + + ! Types + integer, parameter :: adios2_type_unknown = -1 + + integer, parameter :: adios2_type_character = 0 + integer, parameter :: adios2_type_string = 0 + + integer, parameter :: adios2_type_real4 = 1 + integer, parameter :: adios2_type_real = 1 + + integer, parameter :: adios2_type_real8 = 2 + integer, parameter :: adios2_type_dp = 2 + integer, parameter :: adios2_type_double_precision = 2 + + integer, parameter :: adios2_type_complex4 = 3 + integer, parameter :: adios2_type_complex = 3 + + integer, parameter :: adios2_type_complex8 = 4 + integer, parameter :: adios2_type_complex_dp = 4 + + integer, parameter :: adios2_type_integer1 = 5 + integer, parameter :: adios2_type_integer2 = 6 + integer, parameter :: adios2_type_integer4 = 7 + integer, parameter :: adios2_type_integer8 = 8 + + ! is_constant_dims + logical, parameter :: adios2_constant_dims = .true. + logical, parameter :: adios2_variable_dims = .false. + + ! Variable Found or not found, ierr value + integer, parameter :: adios2_not_found = -1 + integer, parameter :: adios2_found = 0 + + ! error + integer, parameter :: adios2_error_none = 0 + integer, parameter :: adios2_error_invalid_argument = 1 + integer, parameter :: adios2_error_system_error = 2 + integer, parameter :: adios2_error_runtime_error = 3 + integer, parameter :: adios2_error_exception = 4 + + ! Mode + integer, parameter :: adios2_mode_undefined = 0 + integer, parameter :: adios2_mode_write = 1 + integer, parameter :: adios2_mode_read = 2 + integer, parameter :: adios2_mode_append = 3 + integer, parameter :: adios2_mode_readRandomAccess = 6 + + integer, parameter :: adios2_mode_deferred = 4 + integer, parameter :: adios2_mode_sync = 5 + + integer, parameter :: adios2_memory_space_detect = 0 + integer, parameter :: adios2_memory_space_host = 1 + integer, parameter :: adios2_memory_space_gpu = 2 + + ! Step Mode + integer, parameter :: adios2_step_mode_append = 0 + integer, parameter :: adios2_step_mode_update = 1 + integer, parameter :: adios2_step_mode_read = 2 + + ! Step Status + integer, parameter :: adios2_step_status_other_error = -1 + integer, parameter :: adios2_step_status_ok = 0 + integer, parameter :: adios2_step_status_not_ready = 1 + integer, parameter :: adios2_step_status_end_of_stream = 2 + + ! Derived variable type + integer, parameter :: adios2_derived_var_type_metadata_only = 0 + integer, parameter :: adios2_derived_var_type_expression_string = 1 + integer, parameter :: adios2_derived_var_type_store_data = 2 + + !> Fixed size for string array, used in variables and attributes, + !! must be less or equal than C equivalent in adios2_c_types.h + integer, parameter :: adios2_string_array_element_max_size = 4096 + + integer(kind=8), parameter, dimension(1) :: adios2_null_dims = (/-1/) + integer(kind=8), parameter :: adios2_local_value_dim = -2 + + logical, parameter :: adios2_advance_yes = .true. + logical, parameter :: adios2_advance_no = .false. + + ! Low level API handlers + type adios2_adios + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + end type + + type adios2_io + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + character(len=15):: engine_type = 'BPFile' + end type + + type adios2_variable + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + character(len=4096):: name = '' + integer :: type = -1 + integer :: ndims = -1 + end type + + type adios2_derived_variable + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + character(len=4096):: name = '' + integer :: type = -1 + end type + + type adios2_attribute + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + logical :: is_value = .false. + character(len=4096):: name = '' + integer :: type = -1 + integer :: length = -1 + end type + + type adios2_engine + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + character(len=64):: name = '' + character(len=15):: type = '' + integer :: mode = adios2_mode_undefined + end type + + type adios2_operator + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + character(len=64):: name = '' + character(len=64):: type = '' + end type + + type adios2_namestruct + integer(kind=8):: f2c = 0_8 + logical :: valid = .false. + integer :: count + integer :: max_name_len + end type end module diff --git a/cmake/ADIOSBisonFlexSub.cmake b/cmake/ADIOSBisonFlexSub.cmake new file mode 100644 index 0000000000..2a95e1bbcd --- /dev/null +++ b/cmake/ADIOSBisonFlexSub.cmake @@ -0,0 +1,15 @@ +FUNCTION (SETUP_ADIOS_BISON_FLEX_SUB) + +set (BISON_FLEX_PRECOMPILE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/toolkit/derived/parser/pregen-source") + +ADD_CUSTOM_COMMAND(OUTPUT parser.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${BISON_FLEX_PRECOMPILE_DIR}/parser.cpp ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${BISON_FLEX_PRECOMPILE_DIR}/parser.h ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${BISON_FLEX_PRECOMPILE_DIR}/location.hh ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Using pre-generated Bison Output from ${BISON_FLEX_PRECOMPILE_DIR}") +ADD_CUSTOM_COMMAND(OUTPUT lexer.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${BISON_FLEX_PRECOMPILE_DIR}/lexer.cpp ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Using pre-generated Flex Output from ${BISON_FLEX_PRECOMPILE_DIR}") + +set (BISON_Parser_OUTPUT_SOURCE parser.cpp PARENT_SCOPE) +ENDFUNCTION() diff --git a/cmake/DetectOptions.cmake b/cmake/DetectOptions.cmake index 8d53f039a6..a0a306b5ad 100644 --- a/cmake/DetectOptions.cmake +++ b/cmake/DetectOptions.cmake @@ -72,31 +72,26 @@ find_package(Threads REQUIRED) # Blosc2 if(ADIOS2_USE_Blosc2 STREQUAL AUTO) - # Prefect CONFIG mode - find_package(Blosc2 2.4 CONFIG QUIET) - if(NOT Blosc2_FOUND) - find_package(Blosc2 2.4 MODULE QUIET) - endif() + find_package(Blosc2 2.10.1 QUIET) elseif(ADIOS2_USE_Blosc2) - # Prefect CONFIG mode - find_package(Blosc2 2.4 CONFIG) - if(NOT Blosc2_FOUND) - find_package(Blosc2 2.4 MODULE REQUIRED) - endif() + find_package(Blosc2 2.10.1) endif() if(Blosc2_FOUND) set(ADIOS2_HAVE_Blosc2 TRUE) if(TARGET Blosc2::blosc2_shared) - set(Blosc2_shlib_available ON) + set(blosc2_shlib_available ON) endif() - set(adios2_blosc2_tgt Blosc2::Blosc2) - if (Blosc2_VERSION VERSION_GREATER_EQUAL 2.10.1) - if (Blosc2_shlib_available AND ADIOS2_Blosc2_PREFER_SHARED) - set(adios2_blosc2_tgt Blosc2::blosc2_shared) - else() - set(adios2_blosc2_tgt Blosc2::blosc2_static) - endif() + if(TARGET Blosc2::blosc2_static) + set(blosc2_slib_available ON) + endif() + + if (blosc2_shlib_available AND (NOT blosc2_slib_available OR ADIOS2_Blosc2_PREFER_SHARED)) + set(adios2_blosc2_tgt Blosc2::blosc2_shared) + elseif(blosc2_slib_available) + set(adios2_blosc2_tgt Blosc2::blosc2_static) + else() + message(FATAL_ERROR "Blosc2 cmake package found but no targets exists inside it.") endif() add_library(adios2_blosc2 ALIAS ${adios2_blosc2_tgt}) @@ -465,13 +460,14 @@ if(ADIOS2_USE_SST AND NOT WIN32) "-DLINK_DIRECTORIES=${LIBFABRIC_LIBRARIES}") message(STATUS "Libfabric support for the HPE CXI provider: ${ADIOS2_SST_HAVE_CRAY_CXI}") endif() - if(ADIOS2_HAVE_MPI) + if(ADIOS2_HAVE_MPI AND NOT "${ADIOS2_SST_HAVE_MPI_DP}") set(CMAKE_REQUIRED_LIBRARIES "MPI::MPI_C;Threads::Threads") include(CheckCXXSourceRuns) check_cxx_source_runs([=[ #include #include #include + #include #include #if !defined(MPICH) @@ -496,7 +492,11 @@ if(ADIOS2_USE_SST AND NOT WIN32) ADIOS2_HAVE_MPI_CLIENT_SERVER) unset(CMAKE_REQUIRED_LIBRARIES) if (ADIOS2_HAVE_MPI_CLIENT_SERVER) - set(ADIOS2_SST_HAVE_MPI TRUE) + set(ADIOS2_SST_HAVE_MPI_DP TRUE) + else() + if ("${ADIOS2_SST_EXPECT_MPI_DP}") + message(FATAL_ERROR "Expected MPI to support Client-server connection model, but test failed.") + endif() endif() endif() # UCX diff --git a/cmake/FindBlosc2.cmake b/cmake/FindBlosc2.cmake deleted file mode 100644 index 10762297cc..0000000000 --- a/cmake/FindBlosc2.cmake +++ /dev/null @@ -1,91 +0,0 @@ -#------------------------------------------------------------------------------# -# Distributed under the OSI-approved Apache License, Version 2.0. See -# accompanying file Copyright.txt for details. -#------------------------------------------------------------------------------# -# -# FindBLOSC22 -# ----------- -# -# Try to find the BLOSC2 library -# -# This module defines the following variables: -# -# BLOSC2_FOUND - System has BLOSC2 -# BLOSC2_INCLUDE_DIRS - The BLOSC2 include directory -# BLOSC2_LIBRARIES - Link these to use BLOSC2 -# BLOSC2_VERSION - Version of the BLOSC2 library to support -# -# and the following imported targets: -# Blosc2::Blosc2 - The core BLOSC2 library -# -# You can also set the following variable to help guide the search: -# BLOSC2_ROOT - The install prefix for BLOSC2 containing the -# include and lib folders -# Note: this can be set as a CMake variable or an -# environment variable. If specified as a CMake -# variable, it will override any setting specified -# as an environment variable. - -if(NOT BLOSC2_FOUND) - if((NOT BLOSC2_ROOT) AND (DEFINED ENV{BLOSC2_ROOT})) - set(BLOSC2_ROOT "$ENV{BLOSC2_ROOT}") - endif() - if(BLOSC2_ROOT) - set(BLOSC2_INCLUDE_OPTS HINTS ${BLOSC2_ROOT}/include NO_DEFAULT_PATHS) - set(BLOSC2_LIBRARY_OPTS - HINTS ${BLOSC2_ROOT}/lib ${BLOSC2_ROOT}/lib64 - NO_DEFAULT_PATHS - ) - endif() - if(WIN32) # uses a Unix-like library prefix on Windows - set(BLOSC2_LIBRARY_OPTS - libblosc2 ${BLOSC2_LIBRARY_OPTS} - ) - endif() - - find_path(BLOSC2_INCLUDE_DIR blosc2.h ${BLOSC2_INCLUDE_OPTS}) - find_library(BLOSC2_LIBRARY NAMES blosc2 ${BLOSC2_LIBRARY_OPTS}) - if(BLOSC2_INCLUDE_DIR) - file(STRINGS ${BLOSC2_INCLUDE_DIR}/blosc2.h _ver_string - REGEX [=[BLOSC2_VERSION_STRING +"[^"]*"]=] - ) - if(_ver_string MATCHES [=[BLOSC2_VERSION_STRING +"([0-9]+.[0-9]+.[0-9]+)]=]) - set(BLOSC2_VERSION ${CMAKE_MATCH_1}) - endif() - endif() - - # Blosc2 depends on pthreads - set(THREADS_PREFER_PTHREAD_FLAG TRUE) - if(WIN32) - # try to use the system library - find_package(Threads) - if(NOT Threads_FOUND) - message(STATUS "Blosc2: used the internal pthread library for win32 systems.") - set(BLOSC2_LIBRARIES) - else() - set(BLOSC2_LIBRARIES Threads::Threads) - endif() - else() - find_package(Threads REQUIRED) - set(BLOSC2_LIBRARIES Threads::Threads) - endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Blosc2 - FOUND_VAR BLOSC2_FOUND - VERSION_VAR BLOSC2_VERSION - REQUIRED_VARS BLOSC2_LIBRARY BLOSC2_INCLUDE_DIR - ) - if(BLOSC2_FOUND) - set(BLOSC2_INCLUDE_DIRS ${BLOSC2_INCLUDE_DIR}) - set(BLOSC2_LIBRARIES ${BLOSC2_LIBRARY}) - if(BLOSC2_FOUND AND NOT TARGET Blosc2::Blosc2) - add_library(Blosc2::Blosc2 UNKNOWN IMPORTED) - set_target_properties(Blosc2::Blosc2 PROPERTIES - IMPORTED_LOCATION "${BLOSC2_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${BLOSC2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${BLOSC2_LIBRARIES}" - ) - endif() - endif() -endif() diff --git a/cmake/adios2-config-common.cmake.in b/cmake/adios2-config-common.cmake.in index 37651ecad6..77982f5d25 100644 --- a/cmake/adios2-config-common.cmake.in +++ b/cmake/adios2-config-common.cmake.in @@ -81,6 +81,11 @@ else() endif() if(NOT @BUILD_SHARED_LIBS@) + set(ADIOS2_HAVE_Blosc2 @ADIOS2_HAVE_Blosc2@) + if(ADIOS2_HAVE_Blosc2) + find_dependency(Blosc2 2.10.1) + endif() + set(ADIOS2_HAVE_BZip2 @ADIOS2_HAVE_BZip2@) if(ADIOS2_HAVE_BZip2) find_dependency(BZip2) @@ -142,10 +147,16 @@ if(NOT @BUILD_SHARED_LIBS@) find_dependency(AWSSDK) endif() + set(ADIOS2_HAVE_XRootD @ADIOS2_HAVE_XRootD@) if(ADIOS2_HAVE_XRootD) find_dependency(XRootD) endif() + set(ADIOS2_HAVE_Campaign @ADIOS2_HAVE_Campaign@) + if(ADIOS2_HAVE_Campaign) + find_dependency(ZLIB) + find_dependency(SQLite3) + endif() adios2_add_thirdparty_target(pugixml) diff --git a/docs/user_guide/source/advanced/campaign_management.rst b/docs/user_guide/source/advanced/campaign_management.rst new file mode 100644 index 0000000000..fd57f703a7 --- /dev/null +++ b/docs/user_guide/source/advanced/campaign_management.rst @@ -0,0 +1,186 @@ +#################### +Campaign Management +#################### + +The campaign management in ADIOS2 is for collecting basic information and metadata about a collection of ADIOS2 output files, from a single application run or multiple runs. The campaign archive is a single file (.ACA) that can be transferred to other locations. The campaign file can be opened by ADIOS2 and all the metadata can be processed (including the values of GlobalValue and LocalValue variables, or min/max of each Arrays at each step and decomposition/min/max of each block in an Array at each step). However, Get() operations will only succeed to read actual data of the arrays, if the data belonging to the campaign is either local or some mechanism for remote data access to the location of the data is set up in advance. + +.. warning:: + + In 2.10, Campaign Management is just a first prototype and is included only for evaluation purposes. It will change substantially in the future and campaign files produced by this version will unlikely to be supported going forward. + +The idea +======== +Applications produce one or more output files in a single run. Subsequent analysis and visualization runs produce more output files. Campaign is a data organization concept one step higher than a file. A campaign archive includes information about multiple files, including the scalar variable's values and the min/max of arrays and the location of the data files (host and directory information). A science project can agree on how to organize their campaigns, i.e., how to name them, what files to include in a single campaign archive, how to distribute them, how to name the hosts where the actual data resides. + +Example +------- + +The Gray-Scott example, that is included with ADIOS2, in `examples/simulation/gray-scott`, has two programs, Gray-Scott and PDF-Calc. The first one produces the main output `gs.bp` which includes the main 3D variables `U` and `V`, and a checkpoint file `ckpt.bp` with a single step in it. PDF-Calc processes the main output and produces histograms on 2D slices of U and V (`U/bins` and `U/pdf`) in `pdf.bp`. A campaign can include all the three output files as they logically belong together. + +.. code-block:: bash + + # run application as usual + $ mpirun -n 4 adios2_simulations_gray-scott settings-files.json + $ ls -d *.bp + ckpt.bp gs.bp + + $ adios2_campaign_manager.py create demoproject/frontier_gray-scott_100 + + $ mpirun -n 3 adios2_simulations_gray-scott_pdf-calc gs.bp pdf.bp 1000 + $ ls -d *.bp + ckpt.bp gs.bp pdf.bp + + $ adios2_campaign_manager.py update demoproject/frontier_gray-scott_100 + + $ adios2_campaign_manager.py info demoproject/frontier_gray-scott_100 + info archive + ADIOS Campaign Archive, version 1.0, created on 2024-04-01 10:44:11.644942 + hostname = OLCF longhostname = frontier.olcf.ornl.gov + dir = /lustre/orion/csc143/proj-shared/demo/gray-scott + dataset = ckpt.bp created on 2024-04-01 10:38:19 + dataset = gs.bp created on 2024-04-01 10:38:17 + dataset = pdf.bp created on 2024-04-01 10:38:08 + + # The campaign archive is small compared to the data it points to + $ du -sh *bp + 7.9M ckpt.bp + 40M gs.bp + 9.9M pdf.bp + + $ du -sh /lustre/orion/csc143/proj-shared/adios-campaign-store/demoproject/frontier_gray-scott_100.aca + 97K /lustre/orion/csc143/proj-shared/adios-campaign-store/demoproject/frontier_gray-scott_100.aca + + # ADIOS can list the content of the campaign archive + $ bpls -l demoproject/frontier_gray-scott_100 + double ckpt.bp/U {4, 34, 34, 66} = 0.171103 / 1 + double ckpt.bp/V {4, 34, 34, 66} = 1.71085e-19 / 0.438921 + int32_t ckpt.bp/step scalar = 700 + double gs.bp/U 10*{64, 64, 64} = 0.090778 / 1 + double gs.bp/V 10*{64, 64, 64} = 8.24719e-63 / 0.515145 + int32_t gs.bp/step 10*scalar = 100 / 1000 + double pdf.bp/U/bins 10*{1000} = 0.0908158 / 0.999938 + double pdf.bp/U/pdf 10*{64, 1000} = 0 / 4096 + double pdf.bp/V/bins 10*{1000} = 8.24719e-63 / 0.514267 + double pdf.bp/V/pdf 10*{64, 1000} = 0 / 4096 + int32_t pdf.bp/step 10*scalar = 100 / 1000 + + # scalar over steps is available in metadata + $ bpls -l demoproject/frontier_gray-scott_100 -d pdf.bp/step -n 10 + int32_t pdf.bp/step 10*scalar = 100 / 1000 + (0) 100 200 300 400 500 600 700 800 900 1000 + + # Array decomposition including min/max are available in metadata + $ bpls -l demoproject/frontier_gray-scott_100 -D gs.bp/V + double gs.bp/V 10*{64, 64, 64} = 8.24719e-63 / 0.515145 + step 0: + block 0: [ 0:63, 0:31, 0:31] = 8.24719e-63 / 0.410653 + block 1: [ 0:63, 32:63, 0:31] = 8.24719e-63 / 0.410652 + block 2: [ 0:63, 0:31, 32:63] = 8.24719e-63 / 0.410653 + block 3: [ 0:63, 32:63, 32:63] = 8.24719e-63 / 0.410653 + ... + step 9: + block 0: [ 0:63, 0:31, 0:31] = 3.99908e-09 / 0.441847 + block 1: [ 0:63, 32:63, 0:31] = 3.99931e-09 / 0.44192 + block 2: [ 0:63, 0:31, 32:63] = 3.99928e-09 / 0.441813 + block 3: [ 0:63, 32:63, 32:63] = 3.99899e-09 / 0.441796 + + # Array data is only available if data is local + $ ./bin/bpls -l demoproject/frontier_gray-scott_100 -d pdf.bp/U/bins + double pdf.bp/U/bins 10*{1000} = 0.0908158 / 0.999938 + (0, 0) 0.93792 0.937982 0.938044 0.938106 0.938168 0.93823 0.938292 0.938354 0.938416 0.938479 + ... + (9,990) 0.990306 0.991157 0.992007 0.992858 0.993708 0.994559 0.995409 0.99626 0.99711 0.997961 + + +Setup +===== + +There are three paths/names important in the campaign setup. + +- `hostname` is the name detected by the adios2_campaign_manager when creating a campaign archive, however, it is better to define a specific name the project agrees upon (e.g. OLCF, NERSC, ALCF) that identifies the generic location of the data and then use that name later to specify the modes of remote data access (not available in this release). + +- `campaignstorepath` is the directory where all the campaign archives are stored. This should be shared between project members in a center, and a private one on every member's laptop. It is up to the project to determine what file sharing / synchronization mechanism to use to sync this directories. `Rclone is a great command-line tool `_ to sync the campaign store with many cloud-based file sharing services and cloud instances. + +- `cachepath` is the directory where ADIOS can unpack metadata from the campaign archive so that ADIOS engines can read them as if they were entirely local datasets. The cache only contains the metadata for now but in the future data that have already been retrieved by previous read requests will be stored here as well. + + +Use `~/.config/adios2/adios2.yaml` to specify these options. + +.. code-block:: bash + + $ cat ~/.config/adios2/adios2.yaml + + Campaign: + active: true + hostname: OLCF + campaignstorepath: /lustre/orion/csc143/proj-shared/adios-campaign-store + cachepath: /lustre/orion/csc143/proj-shared/campaign-cache + verbose: 0 + + $ ls -R ~/dropbox/adios-campaign-store + /lustre/orion/csc143/proj-shared/adios-campaign-store/demoproject: + frontier_gray-scott_100.aca + + $ adios2_campaign_manager.py list + demoproject/frontier_gray-scott_100.aca + + +Remote access +============= +For now, we have one way to access data, through SSH port forwarding and running a remote server program to read in data on the remote host and to send back the data to the local ADIOS program. `adios2_remote_server` is included in the adios installation. You need to use the one built on the host. + +Launch the server by SSH-ing to the remote machine, and specifying the `26200` port for fowarding. For example: + +.. code-block:: bash + + $ ssh -L 26200:dtn.olcf.ornl.gov:26200 -l dtn.olcf.ornl.gov "/bin/adios2_remote_server -v " + +Assuming the campaign archive was synced to a local machine's campaign store under `csc143/demoproject`, now we can retrieve data: + +.. code-block:: bash + + $ adios2_campaign_manager.py list + csc143/demoproject/frontier_gray-scott_100.aca + + $ bpls -l csc143/demoproject/frontier_gray-scott_100 + double ckpt.bp/U {4, 34, 34, 66} = 0.171103 / 1 + ... + double pdf.bp/U/bins 10*{1000} = 0.0908158 / 0.999938 + + # metadata is extracted to the local cachepath + $ du -sh /tmp/campaign/OLCF/csc143/demoproject/frontier_gray-scott_100.aca/* + 20K /tmp/campaign/OLCF/csc143/demoproject/frontier_gray-scott_100.aca/ckpt.bp + 40K /tmp/campaign/OLCF/csc143/demoproject/frontier_gray-scott_100.aca/gs.bp + 32K /tmp/campaign/OLCF/csc143/demoproject/frontier_gray-scott_100.aca/pdf.bp + + # data is requested from the remote server + # read 16 values (4x4x4) from U from last step, from offset 30,30,30 + $ bpls -l csc143/demoproject/frontier_gray-scott_100 -d gs.bp/U -s "-1,30,30,30" -c "1,4,4,4" -n 4 + double gs.bp/U 10*{64, 64, 64} + slice (9:9, 30:33, 30:33, 30:33) + (9,30,30,30) 0.89189 0.899854 0.899854 0.891891 + (9,30,31,30) 0.899851 0.908278 0.908278 0.899852 + (9,30,32,30) 0.899849 0.908276 0.908277 0.899851 + (9,30,33,30) 0.891885 0.899848 0.899849 0.891886 + (9,31,30,30) 0.89985 0.908276 0.908276 0.899849 + (9,31,31,30) 0.908274 0.916977 0.916977 0.908274 + (9,31,32,30) 0.908273 0.916976 0.916976 0.908273 + (9,31,33,30) 0.899844 0.908271 0.908271 0.899844 + (9,32,30,30) 0.89985 0.908276 0.908275 0.899848 + (9,32,31,30) 0.908274 0.916976 0.916976 0.908272 + (9,32,32,30) 0.908272 0.916975 0.916974 0.908271 + (9,32,33,30) 0.899844 0.90827 0.90827 0.899842 + (9,33,30,30) 0.89189 0.899851 0.899851 0.891886 + (9,33,31,30) 0.89985 0.908275 0.908275 0.899847 + (9,33,32,30) 0.899848 0.908274 0.908273 0.899845 + (9,33,33,30) 0.891882 0.899845 0.899844 0.89188 + +Requirements +============ +The Campaign Manager uses SQlite3 and ZLIB for its operations, and Python3 3.8 or higher for the `adios2_campaign_manager` tool. Check `bpls -Vv` to see if `CAMPAIGN` is in the list of "Available features". + +Limitations +=========== + +- The Campaign Reader engine only supports ReadRandomAccess mode, not step-by-step reading. Campaign management will need to change in the future to support sorting the steps from different outputs to a coherent order. +- Updates to moving data for other location is not supported yet diff --git a/docs/user_guide/source/api_full/fortran.rst b/docs/user_guide/source/api_full/fortran.rst index f45648bf98..026a55d4d2 100644 --- a/docs/user_guide/source/api_full/fortran.rst +++ b/docs/user_guide/source/api_full/fortran.rst @@ -746,11 +746,11 @@ ADIOS2 Fortran bindings handlers are mapped 1-to-1 to the ADIOS2 components desc integer, intent(out) :: ierr -* :f90:`subroutine adios2_set_steps_selection` set a list of steps by specifying the starting step and the step count +* :f90:`subroutine adios2_set_step_selection` set a list of steps by specifying the starting step and the step count .. code-block:: fortran - subroutine adios2_set_selection(variable, step_start, step_count, ierr) + subroutine adios2_set_step_selection(variable, step_start, step_count, ierr) ! WHERE diff --git a/docs/user_guide/source/index.rst b/docs/user_guide/source/index.rst index a30daad270..f2bf42b8cd 100644 --- a/docs/user_guide/source/index.rst +++ b/docs/user_guide/source/index.rst @@ -40,6 +40,7 @@ Funded by the `Exascale Computing Project (ECP) =1.19" Write-Host "::endgroup::" +Write-Host "::group::Setup CONDA" +$Env:Path += ";$Env:CONDA\condabin" +conda.bat init powershell +conda.bat init bash +Write-Host "::endgroup::" + +Write-Host "::group::Installing c-blosc2" +conda.bat install -y conda-forge::c-blosc2 +Write-Host "::endgroup::" + if($Env:GH_YML_MATRIX_PARALLEL -eq "ompi") { # This is taken from the MSMPI VCPKG diff --git a/scripts/ci/scripts/run-clang-format.sh b/scripts/ci/scripts/run-clang-format.sh index c37ab4444d..b85f7fa636 100755 --- a/scripts/ci/scripts/run-clang-format.sh +++ b/scripts/ci/scripts/run-clang-format.sh @@ -12,7 +12,7 @@ then fi # Check C and C++ code with clang-format -find source plugins testing examples bindings -regextype posix-extended -iregex '.*\.(h|c|cpp|tcc|cu)' | xargs clang-format -i +find source plugins testing examples bindings -regextype posix-extended -iregex '.*\.(h|c|cpp|tcc|cu)' ! -path "source/adios2/toolkit/derived/parser/pregen-source/*" | xargs clang-format -i DIFF="$(git diff)" if [ -n "${DIFF}" ] then diff --git a/scripts/ci/setup-run/ci-Windows.sh b/scripts/ci/setup-run/ci-Windows.sh new file mode 100755 index 0000000000..1965fc4990 --- /dev/null +++ b/scripts/ci/setup-run/ci-Windows.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set +u +# We do not use conda cmake, thus we have to hint cmake where is +# conda root dir. +export CMAKE_PREFIX_PATH="C:/Miniconda/Library;$CMAKE_PREFIX_PATH" diff --git a/source/adios2/CMakeLists.txt b/source/adios2/CMakeLists.txt index 142a3fe0e4..3e640940d7 100644 --- a/source/adios2/CMakeLists.txt +++ b/source/adios2/CMakeLists.txt @@ -136,12 +136,51 @@ if (ADIOS2_HAVE_Derived_Variable) toolkit/derived/Expression.cpp toolkit/derived/Function.cpp toolkit/derived/Function.tcc toolkit/derived/ExprHelper.h) + set_target_properties(adios2_core PROPERTIES + INCLUDE_DIRECTORIES "$;$") + find_package(BISON "3.8.2") + find_package(FLEX) + + if(NOT BISON_FOUND OR NOT FLEX_FOUND) + include(ADIOSBisonFlexSub) + SETUP_ADIOS_BISON_FLEX_SUB() + else() + BISON_TARGET(MyParser + toolkit/derived/parser/parser.y + ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp + COMPILE_FLAGS "-o parser.cpp --header=parser.h" + DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h) + FLEX_TARGET(MyScanner + toolkit/derived/parser/lexer.l + COMPILE_FLAGS "-o lexer.cpp --header-file=lexer.h" + ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp + DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/lexer.h) + ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp PROPERTIES COMPILE_FLAGS -Wno-sign-compare) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/parser.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/parser.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + SET_SOURCE_FILES_PROPERTIES(toolkit/derived/Expression.cpp toolkit/derived/Function.cpp PROPERTIES COMPILE_FLAGS "/wd4005 /wd4065 /wd4267 -DYY_NO_UNISTD_H") + endif() add_library(adios2_core_derived - toolkit/derived/parser/lexer.cpp - toolkit/derived/parser/parser.cpp + ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp + ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp + toolkit/derived/parser/ASTDriver.cpp toolkit/derived/parser/ASTNode.cpp) + set_target_properties(adios2_core_derived PROPERTIES + VISIBILITY_INLINES_HIDDEN ON + INCLUDE_DIRECTORIES "$;$" + EXPORT_NAME core_derived + OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_core_derived) target_link_libraries(adios2_core PRIVATE adios2_core_derived) set(maybe_adios2_core_derived adios2_core_derived) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set_target_properties(adios2_core_derived PROPERTIES COMPILE_FLAGS "/wd4005 /wd4267 /wd4065 -DYY_NO_UNISTD_H") + endif() endif() set(maybe_adios2_core_cuda) diff --git a/source/adios2/common/ADIOSTypes.cpp b/source/adios2/common/ADIOSTypes.cpp index 5fbdb69216..51dc8b2ca4 100644 --- a/source/adios2/common/ADIOSTypes.cpp +++ b/source/adios2/common/ADIOSTypes.cpp @@ -18,6 +18,23 @@ namespace adios2 { +std::string ToString(MemorySpace value) +{ + switch (value) + { + case MemorySpace::Detect: + return "MemorySpace::Detect"; + case MemorySpace::Host: + return "MemorySpace::Host"; +#ifdef ADIOS2_HAVE_GPU_SUPPORT + case MemorySpace::GPU: + return "MemorySpace::GPU"; +#endif + default: + return "ToString: Unknown MemorySpace"; + } +} + std::string ToString(ShapeID value) { switch (value) diff --git a/source/adios2/common/ADIOSTypes.h b/source/adios2/common/ADIOSTypes.h index 817e4da2b1..fad51e8fd9 100644 --- a/source/adios2/common/ADIOSTypes.h +++ b/source/adios2/common/ADIOSTypes.h @@ -355,6 +355,34 @@ std::string ToString(SelectionType value); std::string ToString(DataType type); std::string ToString(const Dims &dims); std::string ToString(const Box &box); +std::string ToString(const MemorySpace value); + +/** UserOptions holds all user options from ~/.config/adios2/adios2.yaml */ +struct UserOptions +{ + struct General + { + int verbose; + }; + + struct Campaign + { + bool active; + int verbose; + std::string hostname; + std::string campaignstorepath; + std::string cachepath; + }; + + struct SST + { + int verbose; + }; + + General general; + Campaign campaign; + SST sst; +}; /** * os << [adios2_type] enables output of adios2 enums/classes directly diff --git a/source/adios2/core/ADIOS.cpp b/source/adios2/core/ADIOS.cpp index 6504474d81..a280483ce2 100644 --- a/source/adios2/core/ADIOS.cpp +++ b/source/adios2/core/ADIOS.cpp @@ -19,6 +19,7 @@ #include "adios2/core/IO.h" #include "adios2/helper/adiosCommDummy.h" #include "adios2/helper/adiosFunctions.h" //InquireKey, BroadcastFile +#include "adios2/helper/adiosYAML.h" #include "adios2/operator/OperatorFactory.h" #include @@ -106,6 +107,9 @@ std::mutex PerfStubsMutex; static std::atomic_uint adios_refcount(0); // adios objects at the same time static std::atomic_uint adios_count(0); // total adios objects during runtime +/** User defined options from ~/.config/adios2/adios2.yaml if it exists */ +const adios2::UserOptions &ADIOS::GetUserOptions() { return m_UserOptions; }; + ADIOS::ADIOS(const std::string configFile, helper::Comm comm, const std::string hostLanguage) : m_HostLanguage(hostLanguage), m_Comm(std::move(comm)), m_ConfigFile(configFile), m_CampaignManager(m_Comm) @@ -124,6 +128,7 @@ ADIOS::ADIOS(const std::string configFile, helper::Comm comm, const std::string } } #endif + ProcessUserConfig(); if (!configFile.empty()) { if (!adios2sys::SystemTools::FileExists(configFile)) @@ -143,8 +148,12 @@ ADIOS::ADIOS(const std::string configFile, helper::Comm comm, const std::string #ifdef ADIOS2_HAVE_KOKKOS m_GlobalServices.Init_Kokkos_API(); #endif - std::string campaignName = "campaign_" + std::to_string(adios_count); - m_CampaignManager.Open(campaignName); + if (m_UserOptions.campaign.active) + { + std::string campaignName = + "campaign_" + helper::RandomString(8) + "_" + std::to_string(adios_count); + m_CampaignManager.Open(campaignName, m_UserOptions); + } } ADIOS::ADIOS(const std::string configFile, const std::string hostLanguage) @@ -166,7 +175,40 @@ ADIOS::~ADIOS() { m_GlobalServices.Finalize(); } - m_CampaignManager.Close(); + if (m_UserOptions.campaign.active) + { + m_CampaignManager.Close(); + } +} + +void ADIOS::SetUserOptionDefaults() +{ + m_UserOptions.general.verbose = 0; + + m_UserOptions.campaign.active = true; + m_UserOptions.campaign.verbose = 0; + m_UserOptions.campaign.hostname = ""; + m_UserOptions.campaign.campaignstorepath = ""; + m_UserOptions.campaign.cachepath = "/tmp/adios2-cache"; + + m_UserOptions.sst.verbose = 0; +} + +void ADIOS::ProcessUserConfig() +{ + // read config parameters from config file + std::string homePath; +#ifdef _WIN32 + homePath = getenv("HOMEPATH"); +#else + homePath = getenv("HOME"); +#endif + SetUserOptionDefaults(); + const std::string cfgFile = homePath + "/.config/adios2/adios2.yaml"; + if (adios2sys::SystemTools::FileExists(cfgFile)) + { + helper::ParseUserOptionsFile(m_Comm, cfgFile, m_UserOptions, homePath); + } } IO &ADIOS::DeclareIO(const std::string name, const ArrayOrdering ArrayOrder) @@ -330,7 +372,10 @@ void ADIOS::YAMLInitIO(const std::string &configFileYAML, const std::string &con void ADIOS::RecordOutputStep(const std::string &name, const size_t step, const double time) { - m_CampaignManager.Record(name, step, time); + if (m_UserOptions.campaign.active) + { + m_CampaignManager.Record(name, step, time); + } } void ADIOS::Global_init_AWS_API() diff --git a/source/adios2/core/ADIOS.h b/source/adios2/core/ADIOS.h index bf534a960e..00bff3f89c 100644 --- a/source/adios2/core/ADIOS.h +++ b/source/adios2/core/ADIOS.h @@ -164,6 +164,9 @@ class ADIOS void RecordOutputStep(const std::string &name, const size_t step = UnknownStep, const double time = UnknownTime); + /** A constant reference to the user options from ~/.config/adios2/adios2.yaml */ + const adios2::UserOptions &GetUserOptions(); + private: /** Communicator given to parallel constructor. */ helper::Comm m_Comm; @@ -204,6 +207,10 @@ class ADIOS void YAMLInitIO(const std::string &configFileYAML, const std::string &configFileContents, core::IO &io); + adios2::UserOptions m_UserOptions; + void SetUserOptionDefaults(); + void ProcessUserConfig(); + private: /* Global services that we want to initialize at most once and shutdown automatically when the ADIOS object is destructed. This only works diff --git a/source/adios2/core/Engine.cpp b/source/adios2/core/Engine.cpp index ab0a5e1761..72ab54d4ac 100644 --- a/source/adios2/core/Engine.cpp +++ b/source/adios2/core/Engine.cpp @@ -23,7 +23,8 @@ namespace core Engine::Engine(const std::string engineType, IO &io, const std::string &name, const Mode openMode, helper::Comm comm) -: m_EngineType(engineType), m_IO(io), m_Name(name), m_OpenMode(openMode), m_Comm(std::move(comm)) +: m_EngineType(engineType), m_IO(io), m_Name(name), m_OpenMode(openMode), m_Comm(std::move(comm)), + m_UserOptions(io.m_ADIOS.GetUserOptions()) { m_FailVerbose = (m_Comm.Rank() == 0); } diff --git a/source/adios2/core/Engine.h b/source/adios2/core/Engine.h index 5e2a721cae..0ab6ed4a00 100644 --- a/source/adios2/core/Engine.h +++ b/source/adios2/core/Engine.h @@ -505,6 +505,9 @@ class Engine * if no communicator is passed */ helper::Comm m_Comm; + /** User options parsed by the ADIOS object, here just for easy reference */ + const UserOptions &m_UserOptions; + /** keeps track of current advance status */ StepStatus m_AdvanceStatus = StepStatus::OK; diff --git a/source/adios2/core/VariableBase.h b/source/adios2/core/VariableBase.h index dc410ec78d..5b585d46a2 100644 --- a/source/adios2/core/VariableBase.h +++ b/source/adios2/core/VariableBase.h @@ -52,11 +52,7 @@ class VariableBase const size_t m_ElementSize; /* User requested memory space */ -#ifdef ADIOS2_HAVE_GPU_SUPPORT MemorySpace m_MemSpace = MemorySpace::Detect; -#else - MemorySpace m_MemSpace = MemorySpace::Host; -#endif #if defined(ADIOS2_HAVE_KOKKOS) || defined(ADIOS2_HAVE_GPU_SUPPORT) ArrayOrdering m_BaseLayout; ArrayOrdering m_ArrayLayout = ArrayOrdering::Auto; diff --git a/source/adios2/core/VariableDerived.cpp b/source/adios2/core/VariableDerived.cpp index 670ad0bc35..07819bf00e 100644 --- a/source/adios2/core/VariableDerived.cpp +++ b/source/adios2/core/VariableDerived.cpp @@ -11,7 +11,7 @@ VariableDerived::VariableDerived(const std::string &name, adios2::derived::Expre const DerivedVarType varType) : VariableBase(name, exprType, helper::GetDataTypeSize(exprType), expr.GetShape(), expr.GetStart(), expr.GetCount(), isConstant), - m_Expr(expr), m_DerivedType(varType) + m_DerivedType(varType), m_Expr(expr) { } @@ -27,15 +27,15 @@ void VariableDerived::UpdateExprDim(std::map> -VariableDerived::ApplyExpression(std::map NameToMVI) +VariableDerived::ApplyExpression(std::map> &NameToMVI) { size_t numBlocks = 0; // check that all variables have the same number of blocks - for (auto variable : NameToMVI) + for (const auto &variable : NameToMVI) { if (numBlocks == 0) - numBlocks = variable.second.BlocksInfo.size(); - if (numBlocks != variable.second.BlocksInfo.size()) + numBlocks = variable.second->BlocksInfo.size(); + if (numBlocks != variable.second->BlocksInfo.size()) helper::Throw("Core", "VariableDerived", "ApplyExpression", " variables do not have the same number of blocks " " in computing the derived variable " + @@ -44,7 +44,7 @@ VariableDerived::ApplyExpression(std::map NameToMVI) std::map> inputData; // create the map between variable name and DerivedData object - for (auto variable : NameToMVI) + for (const auto &variable : NameToMVI) { // add the dimensions of all blocks into a vector std::vector varData; @@ -52,13 +52,13 @@ VariableDerived::ApplyExpression(std::map NameToMVI) { Dims start; Dims count; - for (size_t d = 0; d < variable.second.Dims; d++) + for (int d = 0; d < variable.second->Dims; d++) { - start.push_back(variable.second.BlocksInfo[i].Start[d]); - count.push_back(variable.second.BlocksInfo[i].Count[d]); + start.push_back(variable.second->BlocksInfo[i].Start[d]); + count.push_back(variable.second->BlocksInfo[i].Count[d]); } varData.push_back(adios2::derived::DerivedData( - {variable.second.BlocksInfo[i].BufferP, start, count})); + {variable.second->BlocksInfo[i].BufferP, start, count})); } inputData.insert({variable.first, varData}); } diff --git a/source/adios2/core/VariableDerived.h b/source/adios2/core/VariableDerived.h index 2ff9eb3903..cc7bf8cbf2 100644 --- a/source/adios2/core/VariableDerived.h +++ b/source/adios2/core/VariableDerived.h @@ -32,7 +32,7 @@ class VariableDerived : public VariableBase ApplyExpression(std::map> NameToData, std::map> NameToDims); std::vector> - ApplyExpression(std::map mvi); + ApplyExpression(std::map> &mvi); }; } // end namespace core diff --git a/source/adios2/engine/bp5/BP5Writer.cpp b/source/adios2/engine/bp5/BP5Writer.cpp index 78c0646e6b..ff1889577e 100644 --- a/source/adios2/engine/bp5/BP5Writer.cpp +++ b/source/adios2/engine/bp5/BP5Writer.cpp @@ -516,7 +516,7 @@ void BP5Writer::ComputeDerivedVariables() auto derivedVar = dynamic_cast((*it).second.get()); std::vector varList = derivedVar->VariableNameList(); // to create a mapping between variable name and the varInfo (dim and data pointer) - std::map nameToVarInfo; + std::map> nameToVarInfo; bool computeDerived = true; for (auto varName : varList) { @@ -536,7 +536,7 @@ void BP5Writer::ComputeDerivedVariables() std::cout << " .. skip derived variable " << (*it).second->m_Name << std::endl; break; } - nameToVarInfo.insert({varName, *mvi}); + nameToVarInfo.insert({varName, std::unique_ptr(mvi)}); } // skip computing derived variables if it contains variables that are not written this step if (!computeDerived) diff --git a/source/adios2/engine/campaign/CampaignData.cpp b/source/adios2/engine/campaign/CampaignData.cpp index fa6dda7770..62b2825919 100644 --- a/source/adios2/engine/campaign/CampaignData.cpp +++ b/source/adios2/engine/campaign/CampaignData.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include namespace adios2 @@ -70,12 +69,13 @@ static int sqlcb_bpdataset(void *p, int argc, char **argv, char **azColName) { CampaignData *cdp = reinterpret_cast(p); CampaignBPDataset cds; - size_t hostid = helper::StringToSizeT(std::string(argv[0]), "SQL callback convert text to int"); - size_t dirid = helper::StringToSizeT(std::string(argv[1]), "SQL callback convert text to int"); + size_t dsid = helper::StringToSizeT(std::string(argv[0]), "SQL callback convert text to int"); + size_t hostid = helper::StringToSizeT(std::string(argv[1]), "SQL callback convert text to int"); + size_t dirid = helper::StringToSizeT(std::string(argv[2]), "SQL callback convert text to int"); cds.hostIdx = hostid - 1; // SQL rows start from 1, vector idx start from 0 cds.dirIdx = dirid - 1; - cds.name = argv[2]; - cdp->bpdatasets.push_back(cds); + cds.name = argv[3]; + cdp->bpdatasets[dsid] = cds; return 0; }; @@ -84,7 +84,7 @@ static int sqlcb_bpfile(void *p, int argc, char **argv, char **azColName) CampaignData *cdp = reinterpret_cast(p); CampaignBPFile cf; size_t dsid = helper::StringToSizeT(std::string(argv[0]), "SQL callback convert text to int"); - cf.bpDatasetIdx = dsid - 1; + cf.bpDatasetIdx = dsid; cf.name = std::string(argv[1]); int comp = helper::StringTo(std::string(argv[2]), "SQL callback convert text to int"); cf.compressed = (bool)comp; @@ -92,8 +92,7 @@ static int sqlcb_bpfile(void *p, int argc, char **argv, char **azColName) helper::StringToSizeT(std::string(argv[3]), "SQL callback convert text to int"); cf.lengthCompressed = helper::StringToSizeT(std::string(argv[4]), "SQL callback convert text to int"); - cf.ctime = static_cast( - helper::StringTo(std::string(argv[5]), "SQL callback convert ctime to int")); + cf.ctime = helper::StringTo(std::string(argv[5]), "SQL callback convert ctime to int"); CampaignBPDataset &cds = cdp->bpdatasets[cf.bpDatasetIdx]; cds.files.push_back(cf); @@ -139,7 +138,7 @@ void ReadCampaignData(sqlite3 *db, CampaignData &cd) sqlite3_free(zErrMsg); } - sqlcmd = "SELECT hostid, dirid, name FROM bpdataset"; + sqlcmd = "SELECT rowid, hostid, dirid, name FROM bpdataset"; rc = sqlite3_exec(db, sqlcmd.c_str(), sqlcb_bpdataset, &cd, &zErrMsg); if (rc != SQLITE_OK) { @@ -233,9 +232,9 @@ int inflateToFile(const unsigned char *source, const size_t blobsize, std::ofstr return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; } -static long timeToSec(long ct) +static int64_t timeToSec(int64_t ct) { - long t; + int64_t t; if (ct > 99999999999999999) { /* nanosec to sec */ @@ -258,7 +257,7 @@ static long timeToSec(long ct) return t; } -static bool isFileNewer(const std::string path, long ctime) +static bool isFileNewer(const std::string path, int64_t ctime) { int result; #ifdef _WIN32 @@ -273,9 +272,9 @@ static bool isFileNewer(const std::string path, long ctime) return false; } - long ct = s.st_ctime; - long ctSec = timeToSec(ct); - long ctimeSec = timeToSec(ctime); + int64_t ct = static_cast(s.st_ctime); + int64_t ctSec = timeToSec(ct); + int64_t ctimeSec = timeToSec(ctime); /*std::cout << " Stat(" << path << "): size = " << s.st_size << " ct = " << ctSec << " ctime = " << ctimeSec << "\n";*/ @@ -292,13 +291,13 @@ void SaveToFile(sqlite3 *db, const std::string &path, const CampaignBPFile &bpfi int rc; char *zErrMsg = 0; std::string sqlcmd; - std::string id = std::to_string(bpfile.bpDatasetIdx + 1); + std::string id = std::to_string(bpfile.bpDatasetIdx); sqlite3_stmt *statement; sqlcmd = "SELECT data FROM bpfile WHERE bpdatasetid = " + id + " AND name = '" + bpfile.name + "'"; // std::cout << "SQL statement: " << sqlcmd << "\n"; - rc = sqlite3_prepare_v2(db, sqlcmd.c_str(), sqlcmd.size(), &statement, NULL); + rc = sqlite3_prepare_v2(db, sqlcmd.c_str(), static_cast(sqlcmd.size()), &statement, NULL); if (rc != SQLITE_OK) { std::cout << "SQL error: " << zErrMsg << std::endl; @@ -319,10 +318,10 @@ void SaveToFile(sqlite3 *db, const std::string &path, const CampaignBPFile &bpfi int iBlobsize = sqlite3_column_bytes(statement, 0); const void *p = sqlite3_column_blob(statement, 0); - std::cout << "-- Retrieved from DB data of " << bpfile.name << " size = " << iBlobsize + /*std::cout << "-- Retrieved from DB data of " << bpfile.name << " size = " << iBlobsize << " compressed = " << bpfile.compressed << " compressed size = " << bpfile.lengthCompressed - << " original size = " << bpfile.lengthOriginal << " blob = " << p << "\n"; + << " original size = " << bpfile.lengthOriginal << " blob = " << p << "\n";*/ size_t blobsize = static_cast(iBlobsize); std::ofstream f; diff --git a/source/adios2/engine/campaign/CampaignData.h b/source/adios2/engine/campaign/CampaignData.h index 8d360abfa4..fa316c1bcb 100644 --- a/source/adios2/engine/campaign/CampaignData.h +++ b/source/adios2/engine/campaign/CampaignData.h @@ -14,8 +14,8 @@ #include #include +#include #include -#include #include #include @@ -37,11 +37,11 @@ struct CampaignHost struct CampaignBPFile { std::string name; - size_t bpDatasetIdx; + size_t bpDatasetIdx; // index of parent CampaignBPDataset in the map bool compressed; size_t lengthOriginal; size_t lengthCompressed; - long ctime; + int64_t ctime; }; struct CampaignBPDataset @@ -56,7 +56,7 @@ struct CampaignData { std::string version; std::vector hosts; - std::vector bpdatasets; + std::map bpdatasets; }; void ReadCampaignData(sqlite3 *db, CampaignData &cd); diff --git a/source/adios2/engine/campaign/CampaignManager.cpp b/source/adios2/engine/campaign/CampaignManager.cpp index 2b963f5907..3375464d6b 100644 --- a/source/adios2/engine/campaign/CampaignManager.cpp +++ b/source/adios2/engine/campaign/CampaignManager.cpp @@ -43,7 +43,7 @@ int CMapToSqlite(const CampaignRecordMap &cmap, const int rank, std::string name "SQL error on writing records:"); sqlite3_free(zErrMsg); } - sqlcmd = "CREATE TABLE if not exists bpfiles (name);"; + sqlcmd = "CREATE TABLE if not exists bpfiles (name PRIMARY KEY);"; rc = sqlite3_exec(db, sqlcmd.c_str(), 0, 0, &zErrMsg); if (rc != SQLITE_OK) { @@ -56,7 +56,7 @@ int CMapToSqlite(const CampaignRecordMap &cmap, const int rank, std::string name for (auto &r : cmap) { - sqlcmd = "INSERT INTO bpfiles (name)\n"; + sqlcmd = "INSERT OR IGNORE INTO bpfiles (name)\n"; sqlcmd += "VALUES('" + r.first + "');"; rc = sqlite3_exec(db, sqlcmd.c_str(), 0, 0, &zErrMsg); if (rc != SQLITE_OK) @@ -74,40 +74,36 @@ int CMapToSqlite(const CampaignRecordMap &cmap, const int rank, std::string name return 0; } -CampaignManager::CampaignManager(adios2::helper::Comm &comm) -{ - m_WriterRank = comm.Rank(); - if (m_Verbosity == 5) - { - std::cout << "Campaign Manager " << m_WriterRank << " constructor called" << std::endl; - } - helper::CreateDirectory(m_CampaignDir); -} +CampaignManager::CampaignManager(adios2::helper::Comm &comm) { m_WriterRank = comm.Rank(); } CampaignManager::~CampaignManager() { - if (m_Verbosity == 5) - { - std::cout << "Campaign Manager " << m_WriterRank << " desctructor called\n"; - } if (m_Opened) { Close(); } } -void CampaignManager::Open(const std::string &name) +void CampaignManager::Open(const std::string &name, const UserOptions &options) { - m_Name = m_CampaignDir + "/" + name + "_" + std::to_string(m_WriterRank); - if (m_Verbosity == 5) + const UserOptions::Campaign &opts = options.campaign; + m_Options.active = opts.active; + m_Options.hostname = opts.hostname; + m_Options.campaignstorepath = opts.campaignstorepath; + m_Options.cachepath = opts.cachepath; + m_Options.verbose = opts.verbose; + + m_Name = m_CampaignDir + PathSeparator + name + "_" + std::to_string(m_WriterRank); + if (m_Options.verbose > 0) { std::cout << "Campaign Manager " << m_WriterRank << " Open(" << m_Name << ")\n"; } + m_Opened = true; } void CampaignManager::Record(const std::string &name, const size_t step, const double time) { - if (m_Verbosity == 5) + if (m_Options.verbose > 0) { std::cout << "Campaign Manager " << m_WriterRank << " Record name = " << name << " step = " << step << " time = " << time << "\n"; @@ -151,8 +147,10 @@ void CampaignManager::Close() { if (!cmap.empty()) { + helper::CreateDirectory(m_CampaignDir); CMapToSqlite(cmap, m_WriterRank, m_Name); } + m_Opened = false; } } // end namespace engine diff --git a/source/adios2/engine/campaign/CampaignManager.h b/source/adios2/engine/campaign/CampaignManager.h index 7a313f5627..2a23064cd6 100644 --- a/source/adios2/engine/campaign/CampaignManager.h +++ b/source/adios2/engine/campaign/CampaignManager.h @@ -16,6 +16,7 @@ #define ADIOS2_ENGINE_CAMPAIGNMANAGER_H_ #include "adios2/common/ADIOSConfig.h" +#include "adios2/common/ADIOSTypes.h" #include "adios2/helper/adiosComm.h" #ifdef ADIOS2_HAVE_CAMPAIGN @@ -39,15 +40,15 @@ class CampaignManager CampaignManager(helper::Comm &comm); ~CampaignManager(); - void Open(const std::string &name); + void Open(const std::string &name, const UserOptions &options); void Record(const std::string &name, const size_t step, const double time); void Close(); private: + UserOptions::Campaign m_Options; bool m_Opened = false; std::string m_Name; int m_WriterRank; - int m_Verbosity = 0; CampaignRecordMap cmap; std::ofstream m_Output; const std::string m_CampaignDir = "adios-campaign"; @@ -56,7 +57,7 @@ class CampaignManager public: CampaignManager(helper::Comm &comm){}; ~CampaignManager() = default; - void Open(const std::string &name){}; + void Open(const std::string &name, const UserOptions &options){}; void Record(const std::string &name, const size_t step, const double time){}; void Close(){}; diff --git a/source/adios2/engine/campaign/CampaignReader.cpp b/source/adios2/engine/campaign/CampaignReader.cpp index 29642d64dc..dbf6ea3d43 100644 --- a/source/adios2/engine/campaign/CampaignReader.cpp +++ b/source/adios2/engine/campaign/CampaignReader.cpp @@ -15,6 +15,7 @@ #include "adios2/helper/adiosNetwork.h" // GetFQDN #include "adios2/helper/adiosSystem.h" // CreateDirectory #include +#include #include #include @@ -33,21 +34,11 @@ CampaignReader::CampaignReader(IO &io, const std::string &name, const Mode mode, { m_ReaderRank = m_Comm.Rank(); Init(); - if (m_Verbosity == 5) - { - std::cout << "Campaign Reader " << m_ReaderRank << " Open(" << m_Name << ") in constructor." - << std::endl; - } m_IsOpen = true; } CampaignReader::~CampaignReader() { - /* CampaignReader destructor does close and finalize */ - if (m_Verbosity == 5) - { - std::cout << "Campaign Reader " << m_ReaderRank << " destructor on " << m_Name << "\n"; - } if (m_IsOpen) { DestructorClose(m_FailVerbose); @@ -61,7 +52,7 @@ StepStatus CampaignReader::BeginStep(const StepMode mode, const float timeoutSec // so this forced increase should not be here ++m_CurrentStep; - if (m_Verbosity == 5) + if (m_Options.verbose > 1) { std::cout << "Campaign Reader " << m_ReaderRank << " BeginStep() new step " << m_CurrentStep << "\n"; @@ -88,7 +79,7 @@ StepStatus CampaignReader::BeginStep(const StepMode mode, const float timeoutSec void CampaignReader::PerformGets() { - if (m_Verbosity == 5) + if (m_Options.verbose > 1) { std::cout << "Campaign Reader " << m_ReaderRank << " PerformGets()\n"; } @@ -106,7 +97,7 @@ void CampaignReader::EndStep() PerformGets(); } - if (m_Verbosity == 5) + if (m_Options.verbose > 1) { std::cout << "Campaign Reader " << m_ReaderRank << " EndStep()\n"; } @@ -116,49 +107,18 @@ void CampaignReader::EndStep() void CampaignReader::Init() { - // read config parameters from config file - const std::string cfgFile = "/.config/adios2/campaign.cfg"; - std::string homePath; -#ifdef _WIN32 - homePath = getenv("HOMEPATH"); -#else - homePath = getenv("HOME"); -#endif - ReadConfig(std::string(homePath + cfgFile)); InitParameters(); InitTransports(); } -void CampaignReader::ReadConfig(std::string configPath) -{ - std::ifstream fileStream(configPath); - - if (!fileStream) - { - return; - } - - std::ostringstream fileSS; - fileSS << fileStream.rdbuf(); - fileStream.close(); - size_t posEndline = 0; - size_t posSpace = 0; - std::string token; - std::string endline = "\n"; - std::string fileString = fileSS.str(); - while ((posEndline = fileString.find(endline)) != std::string::npos) - { - std::string line = fileString.substr(0, posEndline); - posSpace = fileString.find(" "); - std::string token1 = line.substr(0, posSpace); - std::string token2 = line.substr(posSpace + 1, line.size()); - // trim? - fileString.erase(0, posEndline + endline.length()); - } - return; -} void CampaignReader::InitParameters() { + const UserOptions::Campaign &opts = m_UserOptions.campaign; + m_Options.active = true; // this is really just for Recording + m_Options.hostname = opts.hostname; + m_Options.campaignstorepath = opts.campaignstorepath; + m_Options.cachepath = opts.cachepath; + m_Options.verbose = opts.verbose; for (const auto &pair : m_IO.m_Parameters) { std::string key(pair.first); @@ -169,8 +129,8 @@ void CampaignReader::InitParameters() if (key == "verbose") { - m_Verbosity = std::stoi(value); - if (m_Verbosity < 0 || m_Verbosity > 5) + m_Options.verbose = std::stoi(value); + if (m_Options.verbose < 0 || m_Options.verbose > 5) helper::Throw("Engine", "CampaignReader", "InitParameters", "Method verbose argument must be an " "integer in the range [0,5], in call to " @@ -178,37 +138,59 @@ void CampaignReader::InitParameters() } if (key == "hostname") { - m_Hostname = pair.second; + m_Options.hostname = pair.second; + } + if (key == "campaignstorepath") + { + m_Options.campaignstorepath = pair.second; } if (key == "cachepath") { - m_CachePath = pair.second; + m_Options.cachepath = pair.second; } } - if (m_Hostname.empty()) + if (m_Options.hostname.empty()) + { + m_Options.hostname = helper::GetClusterName(); + } + + if (m_Options.verbose > 0) { - m_Hostname = helper::GetClusterName(); + std::cout << "CampaignReader: \n"; + std::cout << " Hostname = " << m_Options.hostname << std::endl; + std::cout << " Campaign Store Path = " << m_Options.campaignstorepath << std::endl; + std::cout << " Cache Path = " << m_Options.cachepath << std::endl; } - // std::cout << "My Hostname is " << m_Hostname << std::endl; } void CampaignReader::InitTransports() { - int rc = sqlite3_open(m_Name.c_str(), &m_DB); + std::string path = m_Name; + if (!adios2sys::SystemTools::FileExists(path) && path[0] != '/' && path[0] != '\\' && + !m_Options.campaignstorepath.empty()) + { + std::string path2 = m_Options.campaignstorepath + PathSeparator + m_Name; + if (adios2sys::SystemTools::FileExists(path2)) + { + path = path2; + } + } + + int rc = sqlite3_open(path.c_str(), &m_DB); if (rc) { std::string dbmsg(sqlite3_errmsg(m_DB)); sqlite3_close(m_DB); helper::Throw("Engine", "CampaignReader", "Open", - "Cannot open database" + m_Name + ": " + dbmsg); + "Cannot open database" + path + ": " + dbmsg); } ReadCampaignData(m_DB, m_CampaignData); - if (m_Verbosity == 1) + if (m_Options.verbose > 0) { - std::cout << "Local hostname = " << m_Hostname << "\n"; + std::cout << "Local hostname = " << m_Options.hostname << "\n"; std::cout << "Database result:\n version = " << m_CampaignData.version << "\n hosts:\n"; for (size_t hostidx = 0; hostidx < m_CampaignData.hosts.size(); ++hostidx) @@ -222,8 +204,9 @@ void CampaignReader::InitTransports() } } std::cout << " datasets:\n"; - for (auto &ds : m_CampaignData.bpdatasets) + for (auto &it : m_CampaignData.bpdatasets) { + CampaignBPDataset &ds = it.second; std::cout << " " << m_CampaignData.hosts[ds.hostIdx].hostname << ":" << m_CampaignData.hosts[ds.hostIdx].directory[ds.dirIdx] << PathSeparator << ds.name << "\n"; @@ -239,22 +222,25 @@ void CampaignReader::InitTransports() // std::cout << "JSON rank " << m_ReaderRank << ": " << js.size() << // std::endl; int i = 0; - for (auto &ds : m_CampaignData.bpdatasets) + for (auto &it : m_CampaignData.bpdatasets) { + CampaignBPDataset &ds = it.second; adios2::core::IO &io = m_IO.m_ADIOS.DeclareIO("CampaignReader" + std::to_string(i)); std::string localPath; - if (m_CampaignData.hosts[ds.hostIdx].hostname != m_Hostname) + if (m_CampaignData.hosts[ds.hostIdx].hostname != m_Options.hostname) { const std::string remotePath = m_CampaignData.hosts[ds.hostIdx].directory[ds.dirIdx] + PathSeparator + ds.name; const std::string remoteURL = m_CampaignData.hosts[ds.hostIdx].hostname + ":" + remotePath; - if (m_Verbosity == 1) + localPath = m_Options.cachepath + PathSeparator + + m_CampaignData.hosts[ds.hostIdx].hostname + PathSeparator + m_Name + + PathSeparator + ds.name; + if (m_Options.verbose > 0) { - std::cout << "Open remote file " << remoteURL << "\n"; + std::cout << "Open remote file " << remoteURL + << "\n and use local cache for metadata at " << localPath << " \n"; } - localPath = m_CachePath + PathSeparator + m_CampaignData.hosts[ds.hostIdx].hostname + - PathSeparator + ds.name; helper::CreateDirectory(localPath); for (auto &bpf : ds.files) { @@ -269,7 +255,7 @@ void CampaignReader::InitTransports() { localPath = m_CampaignData.hosts[ds.hostIdx].directory[ds.dirIdx] + PathSeparator + ds.name; - if (m_Verbosity == 1) + if (m_Options.verbose > 0) { std::cout << "Open local file " << localPath << "\n"; } @@ -305,13 +291,35 @@ void CampaignReader::InitTransports() ADIOS2_FOREACH_STDTYPE_1ARG(declare_type) #undef declare_type } + + for (auto &ar : amap) + { + auto aname = ar.first; + std::string fname = ds.name; + std::string newname = fname + "/" + aname; + + const DataType type = io.InquireAttributeType(aname); + + if (type == DataType::Struct) + { + } +#define declare_type(T) \ + else if (type == helper::GetDataType()) \ + { \ + Attribute *ai = io.InquireAttribute(aname); \ + Attribute v = DuplicateAttribute(ai, m_IO, newname); \ + } + + ADIOS2_FOREACH_STDTYPE_1ARG(declare_type) +#undef declare_type + } ++i; } } void CampaignReader::DoClose(const int transportIndex) { - if (m_Verbosity == 5) + if (m_Options.verbose > 1) { std::cout << "Campaign Reader " << m_ReaderRank << " Close(" << m_Name << ")\n"; } diff --git a/source/adios2/engine/campaign/CampaignReader.h b/source/adios2/engine/campaign/CampaignReader.h index 3678318f16..d56475bf20 100644 --- a/source/adios2/engine/campaign/CampaignReader.h +++ b/source/adios2/engine/campaign/CampaignReader.h @@ -54,10 +54,8 @@ class CampaignReader : public Engine bool VariableMinMax(const VariableBase &, const size_t Step, MinMaxStruct &MinMax); private: - int m_Verbosity = 0; // runtime parameter Verbose - std::string m_Hostname; // runtime parameter Hostname - std::string m_CachePath = "/tmp"; // runtime parameter CachePath - int m_ReaderRank; // my rank in the readers' comm + UserOptions::Campaign m_Options; + int m_ReaderRank; // my rank in the readers' comm int m_CurrentStep = 0; @@ -117,6 +115,13 @@ class CampaignReader : public Engine Variable DuplicateVariable(Variable *variable, IO &io, std::string &name, VarInternalInfo &vii); + /** + * Create a new attribute with name `name` in `io` + * based on an existing attribute. + */ + template + Attribute DuplicateAttribute(Attribute *attribute, IO &io, std::string &name); + /** * Create a new variable with name `name` in `io` * based on an existing variable. diff --git a/source/adios2/engine/campaign/CampaignReader.tcc b/source/adios2/engine/campaign/CampaignReader.tcc index d635a1a976..1a5357a25f 100644 --- a/source/adios2/engine/campaign/CampaignReader.tcc +++ b/source/adios2/engine/campaign/CampaignReader.tcc @@ -52,6 +52,19 @@ inline Variable CampaignReader::DuplicateVariable(Variable *variable, IO & return v; } +template +inline Attribute CampaignReader::DuplicateAttribute(Attribute *attribute, IO &io, + std::string &name) +{ + if (attribute->m_IsSingleValue) + { + auto &a = io.DefineAttribute(name, attribute->m_DataSingleValue); + return a; + } + auto &a = io.DefineAttribute(name, attribute->m_DataArray.data(), attribute->m_Elements); + return a; +} + template inline std::pair *, Engine *> CampaignReader::TranslateToActualVariable(Variable &variable) diff --git a/source/adios2/engine/dataman/DataManReader.tcc b/source/adios2/engine/dataman/DataManReader.tcc index 9edd962b96..df1af3ac67 100644 --- a/source/adios2/engine/dataman/DataManReader.tcc +++ b/source/adios2/engine/dataman/DataManReader.tcc @@ -31,12 +31,13 @@ void DataManReader::GetSyncCommon(Variable &variable, T *data) template void DataManReader::GetDeferredCommon(Variable &variable, T *data) { + auto varMemSpace = variable.GetMemorySpace(data); if (m_IO.m_ArrayOrder == ArrayOrdering::RowMajor) { while (true) { int ret = m_Serializer.GetData(data, variable.m_Name, variable.m_Start, - variable.m_Count, m_CurrentStep, variable.m_MemSpace, + variable.m_Count, m_CurrentStep, varMemSpace, variable.m_MemoryStart, variable.m_MemoryCount); if (ret == 0) { @@ -57,7 +58,7 @@ void DataManReader::GetDeferredCommon(Variable &variable, T *data) while (true) { int ret = m_Serializer.GetData(data, variable.m_Name, start, count, m_CurrentStep, - variable.m_MemSpace, memstart, memcount); + varMemSpace, memstart, memcount); if (ret == 0) { break; diff --git a/source/adios2/engine/dataman/DataManWriter.tcc b/source/adios2/engine/dataman/DataManWriter.tcc index f9996e4678..ba5f1a6974 100644 --- a/source/adios2/engine/dataman/DataManWriter.tcc +++ b/source/adios2/engine/dataman/DataManWriter.tcc @@ -31,10 +31,11 @@ void DataManWriter::PutSyncCommon(Variable &variable, const T *values) template void DataManWriter::PutDeferredCommon(Variable &variable, const T *values) { + auto varMemSpace = variable.GetMemorySpace(values); variable.SetData(values); if (m_IO.m_ArrayOrder == ArrayOrdering::RowMajor) { - m_Serializer.PutData(variable, m_Name, CurrentStep(), m_MpiRank, ""); + m_Serializer.PutData(variable, m_Name, CurrentStep(), m_MpiRank, varMemSpace, ""); } else { @@ -49,7 +50,7 @@ void DataManWriter::PutDeferredCommon(Variable &variable, const T *values) std::reverse(memstart.begin(), memstart.end()); std::reverse(memcount.begin(), memcount.end()); m_Serializer.PutData(variable.m_Data, variable.m_Name, shape, start, count, memstart, - memcount, variable.m_MemSpace, m_Name, CurrentStep(), m_MpiRank, "", + memcount, varMemSpace, m_Name, CurrentStep(), m_MpiRank, "", variable.m_Operations); } diff --git a/source/adios2/engine/sst/SstParamParser.cpp b/source/adios2/engine/sst/SstParamParser.cpp index ee8bd9a8cc..2b7041afa6 100644 --- a/source/adios2/engine/sst/SstParamParser.cpp +++ b/source/adios2/engine/sst/SstParamParser.cpp @@ -9,7 +9,8 @@ using namespace adios2; using namespace adios2::core; -void SstParamParser::ParseParams(IO &io, struct _SstParams &Params) +void SstParamParser::ParseParams(IO &io, struct _SstParams &Params, + const adios2::UserOptions &userOptions) { std::memset(&Params, 0, sizeof(Params)); @@ -254,6 +255,8 @@ void SstParamParser::ParseParams(IO &io, struct _SstParams &Params) return false; }; + Params.verbose = userOptions.sst.verbose; + #define get_params(Param, Type, Typedecl, Default) \ Params.Param = Default; \ lf_Set##Type##Parameter(#Param, Params.Param); diff --git a/source/adios2/engine/sst/SstParamParser.h b/source/adios2/engine/sst/SstParamParser.h index 0502cfcd5d..251c74cfa9 100644 --- a/source/adios2/engine/sst/SstParamParser.h +++ b/source/adios2/engine/sst/SstParamParser.h @@ -2,6 +2,7 @@ #define ADIOS2_ENGINE_SST_SSTPARAMPARSER_H_ #include "adios2/common/ADIOSConfig.h" +#include "adios2/common/ADIOSTypes.h" #include "adios2/core/IO.h" #include #include @@ -13,7 +14,8 @@ using namespace adios2::core; class SstParamParser { public: - void ParseParams(adios2::core::IO &io, struct _SstParams &Params); + void ParseParams(adios2::core::IO &io, struct _SstParams &Params, + const adios2::UserOptions &userOptions); }; #endif diff --git a/source/adios2/engine/sst/SstReader.cpp b/source/adios2/engine/sst/SstReader.cpp index 2754e75f6e..03bfced452 100644 --- a/source/adios2/engine/sst/SstReader.cpp +++ b/source/adios2/engine/sst/SstReader.cpp @@ -509,7 +509,7 @@ void SstReader::Init() { SstParamParser Parser; - Parser.ParseParams(m_IO, Params); + Parser.ParseParams(m_IO, Params, m_UserOptions); } #define declare_gets(T) \ diff --git a/source/adios2/engine/sst/SstWriter.cpp b/source/adios2/engine/sst/SstWriter.cpp index 305578ef5c..146ff0f735 100644 --- a/source/adios2/engine/sst/SstWriter.cpp +++ b/source/adios2/engine/sst/SstWriter.cpp @@ -389,7 +389,7 @@ void SstWriter::Init() { SstParamParser Parser; - Parser.ParseParams(m_IO, Params); + Parser.ParseParams(m_IO, Params, m_UserOptions); if (Params.verbose < 0 || Params.verbose > 5) { diff --git a/source/adios2/helper/adiosNetwork.cpp b/source/adios2/helper/adiosNetwork.cpp index a29abd462b..11837376ae 100644 --- a/source/adios2/helper/adiosNetwork.cpp +++ b/source/adios2/helper/adiosNetwork.cpp @@ -4,8 +4,6 @@ * * adiosNetwork.cpp implementation of adiosNetwork.h functions * - * Created on: March 22, 2019 - * Author: William F Godoy godoywf@ornl.gov */ #include "adiosNetwork.h" @@ -79,10 +77,10 @@ std::string GetFQDN() noexcept { for (p = info; p != NULL; p = p->ai_next) { - printf("hostname: %s\n", p->ai_canonname); + // printf("hostname: %s\n", p->ai_canonname); if (strchr(p->ai_canonname, '.') != NULL) { - strncpy(hostname, p->ai_canonname, sizeof(hostname)); + strncpy(hostname, p->ai_canonname, sizeof(hostname) - 1); break; } } @@ -138,7 +136,7 @@ AvailableIpAddresses() noexcept for (struct if_nameindex *p = head; !(p->if_index == 0 && p->if_name == NULL); ++p) { struct ifreq req; - strncpy(req.ifr_name, p->if_name, IFNAMSIZ); + strncpy(req.ifr_name, p->if_name, IFNAMSIZ - 1); if (ioctl(socket_handler, SIOCGIFADDR, &req) < 0) { if (errno == EADDRNOTAVAIL) diff --git a/source/adios2/helper/adiosString.cpp b/source/adios2/helper/adiosString.cpp index e160899404..895ecd450b 100644 --- a/source/adios2/helper/adiosString.cpp +++ b/source/adios2/helper/adiosString.cpp @@ -16,6 +16,7 @@ /// \cond EXCLUDE_FROM_DOXYGEN #include #include //std::ios_base::failure +#include #include #include // std::invalid_argument /// \endcond @@ -484,5 +485,23 @@ std::string RemoveTrailingSlash(const std::string &name) noexcept return name.substr(0, len); } +std::string RandomString(const size_t length) +{ + size_t len = length; + if (len == 0) + len = 1; + if (len > 64) + len = 64; + + std::string str("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzA"); + + std::random_device rd; + std::mt19937 generator(rd()); + + std::shuffle(str.begin(), str.end(), generator); + + return str.substr(0, len); +} + } // end namespace helper } // end namespace adios2 diff --git a/source/adios2/helper/adiosString.h b/source/adios2/helper/adiosString.h index cba94dd2b1..7174da61e4 100644 --- a/source/adios2/helper/adiosString.h +++ b/source/adios2/helper/adiosString.h @@ -193,6 +193,13 @@ std::set PrefixMatches(const std::string &prefix, */ std::string RemoveTrailingSlash(const std::string &name) noexcept; +/** + * Generate a random string of length between 1 and 64 + * This is a dummy string generator, don't use it for uuid or + * for generating truly random unique strings en masse + */ +std::string RandomString(const size_t length); + } // end namespace helper } // end namespace adios2 diff --git a/source/adios2/helper/adiosYAML.cpp b/source/adios2/helper/adiosYAML.cpp index ec835ce26c..07f93697e9 100644 --- a/source/adios2/helper/adiosYAML.cpp +++ b/source/adios2/helper/adiosYAML.cpp @@ -65,6 +65,44 @@ Params YAMLNodeMapToParams(const YAML::Node &node, const std::string &hint) constexpr bool isMandatory = true; constexpr bool isNotMandatory = false; + +inline void FixHomePath(std::string &path, std::string &homePath) +{ + if (!path.empty() && path[0] == '~') + { + path = homePath + path.substr(1); + } +} + +/*std::string NodeType(const YAML::Node &node) +{ + switch (node.Type()) + { + case YAML::NodeType::Null: + return "Null"; + case YAML::NodeType::Scalar: + return "Scalar"; + case YAML::NodeType::Sequence: + return "Sequence"; + case YAML::NodeType::Map: + return "Map"; + case YAML::NodeType::Undefined: + return "Undefined"; + } + return "NoIdeaWhatThisIs"; +}*/ + +template +void SetOption(T &value, const std::string nodeName, const YAML::Node &upperNode, + const std::string &hint) +{ + auto node = YAMLNode(nodeName, upperNode, hint, isNotMandatory, YAML::NodeType::Scalar); + if (node) + { + value = node.as(); + } +} + } // end empty namespace void IOVariableYAML(const YAML::Node &variableMap, core::IO ¤tIO, const std::string &hint) @@ -220,5 +258,62 @@ std::string ParseConfigYAML(core::ADIOS &adios, const std::string &configFileYAM return configFileContents; } +void ParseUserOptionsFile(Comm &comm, const std::string &configFileYAML, UserOptions &options, + std::string &homePath) +{ + const std::string hint = + "when parsing user config file " + configFileYAML + " in call to ADIOS constructor"; + + const std::string configFileContents = comm.BroadcastFile(configFileYAML, hint); + + const YAML::Node document = YAML::Load(configFileContents); + if (!document) + { + helper::Throw( + "Helper", "adiosUserOptions", "ParseUserOptionsFile", + "parser error in file " + configFileYAML + + " invalid format. Check with any YAML editor if format is ill-formed, " + hint); + } + + /* + * This code section below determines what options we recognize at all from the + * ~/.config/adios2/adios2.yaml file + */ + { + UserOptions::General &opts = options.general; + const YAML::Node general = + YAMLNode("General", document, hint, isNotMandatory, YAML::NodeType::Map); + if (general) + { + SetOption(opts.verbose, "verbose", general, hint); + } + } + + { + UserOptions::Campaign &opts = options.campaign; + const YAML::Node campaign = + YAMLNode("Campaign", document, hint, isNotMandatory, YAML::NodeType::Map); + if (campaign) + { + SetOption(opts.verbose, "verbose", campaign, hint); + SetOption(opts.active, "active", campaign, hint); + SetOption(opts.hostname, "hostname", campaign, hint); + SetOption(opts.campaignstorepath, "campaignstorepath", campaign, hint); + FixHomePath(opts.campaignstorepath, homePath); + SetOption(opts.cachepath, "cachepath", campaign, hint); + FixHomePath(opts.cachepath, homePath); + } + } + + { + UserOptions::SST &opts = options.sst; + const YAML::Node sst = YAMLNode("SST", document, hint, isNotMandatory, YAML::NodeType::Map); + if (sst) + { + SetOption(opts.verbose, "verbose", sst, hint); + } + } +} + } // end namespace helper } // end namespace adios2 diff --git a/source/adios2/helper/adiosYAML.h b/source/adios2/helper/adiosYAML.h index 8014d0cf06..8bb9df19d5 100644 --- a/source/adios2/helper/adiosYAML.h +++ b/source/adios2/helper/adiosYAML.h @@ -18,6 +18,7 @@ #include //std::pair /// \endcond +#include "adios2/common/ADIOSTypes.h" // UserOptions #include "adios2/core/ADIOS.h" #include "adios2/core/IO.h" @@ -31,6 +32,9 @@ void ParseConfigYAMLIO(core::ADIOS &adios, const std::string &configFileYAML, std::string ParseConfigYAML(core::ADIOS &adios, const std::string &configFileYAML, std::map &ios); +void ParseUserOptionsFile(Comm &comm, const std::string &configFileYAML, UserOptions &options, + std::string &homePath); + } // end namespace helper } // end namespace adios2 diff --git a/source/adios2/operator/compress/CompressBlosc.cpp b/source/adios2/operator/compress/CompressBlosc.cpp index c4bb6d53ae..97c51f0109 100644 --- a/source/adios2/operator/compress/CompressBlosc.cpp +++ b/source/adios2/operator/compress/CompressBlosc.cpp @@ -145,7 +145,7 @@ size_t CompressBlosc::Operate(const char *dataIn, const Dims &blockStart, const *headerPtr = DataHeader{}; bufferOutOffset += sizeof(DataHeader); - int32_t typesize = helper::GetDataTypeSize(type); + int32_t typesize = static_cast(helper::GetDataTypeSize(type)); if (typesize > BLOSC_MAX_TYPESIZE) typesize = 1; @@ -166,7 +166,7 @@ size_t CompressBlosc::Operate(const char *dataIn, const Dims &blockStart, const "Operator", "CompressBlosc", "Operate", "blosc library linked does not support compressor " + compressor); } - blosc2_set_nthreads(threads); + blosc2_set_nthreads(static_cast(threads)); blosc1_set_blocksize(blockSize); uint32_t chunk = 0; @@ -327,7 +327,7 @@ size_t CompressBlosc::DecompressChunkedFormat(const char *bufferIn, const size_t helper::StringTo(value, "when setting Blosc nthreads parameter\n")); } } - blosc2_set_nthreads(threads); + blosc2_set_nthreads(static_cast(threads)); while (inputOffset < inputDataSize) { @@ -398,8 +398,9 @@ size_t CompressBlosc::DecompressOldFormat(const char *bufferIn, const size_t siz helper::StringTo(value, "when setting Blosc nthreads parameter\n")); } } - blosc2_set_nthreads(threads); - const int decompressedSize = blosc2_decompress(bufferIn, sizeIn, dataOut, sizeOut); + blosc2_set_nthreads(static_cast(threads)); + const int decompressedSize = blosc2_decompress(bufferIn, static_cast(sizeIn), dataOut, + static_cast(sizeOut)); blosc2_destroy(); return static_cast(decompressedSize); } diff --git a/source/adios2/toolkit/derived/ExprHelper.h b/source/adios2/toolkit/derived/ExprHelper.h index c72888f95f..38672cfec4 100644 --- a/source/adios2/toolkit/derived/ExprHelper.h +++ b/source/adios2/toolkit/derived/ExprHelper.h @@ -21,7 +21,8 @@ enum ExpressionOperator OP_ADD, OP_SQRT, OP_POW, - OP_MAGN + OP_MAGN, + OP_CURL }; struct OperatorProperty @@ -39,6 +40,7 @@ const std::map op_property = { {ExpressionOperator::OP_ADD, {"ADD", true}}, {ExpressionOperator::OP_SQRT, {"SQRT", false}}, {ExpressionOperator::OP_POW, {"POW", false}}, + {ExpressionOperator::OP_CURL, {"CURL", false}}, {ExpressionOperator::OP_MAGN, {"MAGNITUDE", false}}}; const std::map string_to_op = { @@ -49,6 +51,7 @@ const std::map string_to_op = { {"add", ExpressionOperator::OP_ADD}, {"ADD", ExpressionOperator::OP_ADD}, {"SQRT", ExpressionOperator::OP_SQRT}, {"sqrt", ExpressionOperator::OP_SQRT}, {"POW", ExpressionOperator::OP_POW}, {"^", ExpressionOperator::OP_POW}, + {"CURL", ExpressionOperator::OP_CURL}, {"curl", ExpressionOperator::OP_CURL}, {"MAGNITUDE", ExpressionOperator::OP_MAGN}, {"magnitude", ExpressionOperator::OP_MAGN}}; inline std::string get_op_name(ExpressionOperator op) { return op_property.at(op).name; } @@ -57,4 +60,4 @@ inline ExpressionOperator get_op(std::string op) { return string_to_op.at(op); } } } -#endif \ No newline at end of file +#endif diff --git a/source/adios2/toolkit/derived/Expression.cpp b/source/adios2/toolkit/derived/Expression.cpp index d773236526..81db7ccd15 100644 --- a/source/adios2/toolkit/derived/Expression.cpp +++ b/source/adios2/toolkit/derived/Expression.cpp @@ -2,19 +2,35 @@ #define ADIOS2_DERIVED_Expression_CPP_ #include "Expression.h" -#include "parser/ASTNode.h" -#include "parser/parser.h" +#include "parser/ASTDriver.h" namespace adios2 { namespace detail { +// helper function +adios2::detail::ExpressionOperator convert_op(std::string opname) +{ + adios2::detail::ExpressionOperator op; + try + { + op = adios2::detail::get_op(opname); + } + catch (std::out_of_range &e) + { + (void)e; // use e + helper::Throw("Derived", "ExprHelper", "get_op", + "Parser cannot recognize operator '" + opname + "'."); + } + return op; +}; + adios2::derived::ExpressionTree ASTNode_to_ExpressionTree(adios2::detail::ASTNode *node) { - adios2::derived::ExpressionTree exprTree_node(node->operation); - for (adios2::detail::ASTNode *e : node->sub_expr) + adios2::derived::ExpressionTree exprTree_node(convert_op(node->get_opname())); + for (adios2::detail::ASTNode *e : node->get_subexprs()) { - switch (e->operation) + switch (convert_op(e->get_opname())) { case adios2::detail::ExpressionOperator::OP_ALIAS: // add variable given by alias // add an index operation in the chain if the variable contains indeces @@ -25,19 +41,19 @@ adios2::derived::ExpressionTree ASTNode_to_ExpressionTree(adios2::detail::ASTNod index_expr.add_child(e->lookup_var_path(e->alias)); expTree_node->add_child(expr); }*/ - exprTree_node.add_child(e->lookup_var_path(e->alias)); + exprTree_node.add_child(e->get_varname()); break; case adios2::detail::ExpressionOperator::OP_PATH: // add variable name - exprTree_node.add_child(e->alias); + exprTree_node.add_child(e->get_varname()); break; case adios2::detail::ExpressionOperator::OP_NUM: // set the base value for the operation - exprTree_node.set_base(e->value); + exprTree_node.set_base(e->get_value()); break; default: // if the children nodes are other expressions, convert them to expressions auto temp_node = ASTNode_to_ExpressionTree(e); // move from a binary to a multinary tree if the child has the same operation - if (e->operation == node->operation && - adios2::detail::op_property.at(e->operation).is_associative) + if (convert_op(e->get_opname()) == convert_op(node->get_opname()) && + adios2::detail::op_property.at(convert_op(e->get_opname())).is_associative) { // concatenate exprTree with temp_node for (std::tuple childTree : @@ -63,10 +79,10 @@ namespace derived { Expression::Expression(std::string string_exp) -: ExprString(string_exp), m_Shape({0}), m_Start({0}), m_Count({0}) +: m_Shape({0}), m_Start({0}), m_Count({0}), ExprString(string_exp) { - adios2::detail::ASTNode *root_node = adios2::detail::parse_expression(string_exp); - m_Expr = adios2::detail::ASTNode_to_ExpressionTree(root_node); + adios2::detail::ASTDriver drv(string_exp); + m_Expr = adios2::detail::ASTNode_to_ExpressionTree(drv.getAST()); } std::vector Expression::VariableNameList() { return m_Expr.VariableNameList(); } diff --git a/source/adios2/toolkit/derived/Expression.h b/source/adios2/toolkit/derived/Expression.h index 6f60f1c262..2b6f8912a3 100644 --- a/source/adios2/toolkit/derived/Expression.h +++ b/source/adios2/toolkit/derived/Expression.h @@ -34,7 +34,7 @@ class ExpressionTree std::vector> sub_exprs; OpInfo detail; - ExpressionTree(){}; + ExpressionTree() : detail({adios2::detail::ExpressionOperator::OP_NULL, {}, 0}) {} ExpressionTree(adios2::detail::ExpressionOperator o) : detail({o, {}, 0}) {} ExpressionTree(adios2::detail::ExpressionOperator o, double c) : detail({o, {}, 0}) {} ExpressionTree(std::vector> indices) diff --git a/source/adios2/toolkit/derived/Function.cpp b/source/adios2/toolkit/derived/Function.cpp index c524ac8c15..441be6a7c6 100644 --- a/source/adios2/toolkit/derived/Function.cpp +++ b/source/adios2/toolkit/derived/Function.cpp @@ -39,7 +39,7 @@ DerivedData MagnitudeFunc(std::vector inputData, DataType type) T *magValues = ApplyOneToOne(inputData, dataSize, [](T a, T b) { return a + b * b; }); \ for (size_t i = 0; i < dataSize; i++) \ { \ - magValues[i] = std::sqrt(magValues[i]); \ + magValues[i] = (T)std::sqrt(magValues[i]); \ } \ return DerivedData({(void *)magValues, inputData[0].Start, inputData[0].Count}); \ } @@ -54,15 +54,119 @@ Dims SameDimsFunc(std::vector input) // check that all dimenstions are the same if (input.size() > 1) { - bool dim_are_equal = std::equal(input.begin() + 1, input.end(), input.begin()); + Dims first_element = input[0]; + bool dim_are_equal = std::all_of(input.begin() + 1, input.end(), + [&first_element](Dims x) { return x == first_element; }); if (!dim_are_equal) - helper::Throw("Derived", "Function", "SameDimFunc", + helper::Throw("Derived", "Function", "SameDimsFunc", "Invalid variable dimensions"); } // return the first dimension return input[0]; } +// Input Dims are the same, output is combination of all inputs +Dims CurlDimsFunc(std::vector input) +{ + // check that all dimenstions are the same + if (input.size() > 1) + { + Dims first_element = input[0]; + bool dim_are_equal = std::all_of(input.begin() + 1, input.end(), + [&first_element](Dims x) { return x == first_element; }); + if (!dim_are_equal) + helper::Throw("Derived", "Function", "CurlDimsFunc", + "Invalid variable dimensions"); + } + // return original dimensions with added dimension of number of inputs + Dims output = input[0]; + output.push_back(input.size()); + return output; +} + +/* + * Linear Interpolation - average difference around point "index" + * can be used to approximate derivatives + * + * Input: + * input - data assumed to be uniform/densely populated + * index - index of point of interest + * dim - in which dimension we are approximating the partial derivative + */ +// template +float linear_interp(DerivedData input, size_t index, size_t dim) +{ + size_t stride = 1; + size_t range; + size_t offset; + float result; + float *data = (float *)input.Data; + + for (size_t i = 0; i < input.Count.size() - (dim + 1); ++i) + { + stride *= input.Count[input.Count.size() - (i + 1)]; + } + size_t ind1 = index - stride; + size_t ind2 = index + stride; + range = stride * input.Count[dim]; + offset = index % range; + + if ((offset < stride) && (range - offset <= stride)) + { + return 0; + } + else if (offset < stride) + { + result = data[ind2] - data[index]; + } + else if (range - offset <= stride) + { + result = data[index] - data[ind1]; + } + else + { + result = (data[ind2] - data[ind1]) / 2; + } + + return result; +} + +/* + * Input: 3D vector field F(x,y,z)= {F1(x,y,z), F2(x,y,z), F3(x,y,z)} + * + * inputData - (3) components of 3D vector field + * + * Computation: + * curl(F(x,y,z)) = (partial(F3,y) - partial(F2,z))i + * + (partial(F1,z) - partial(F3,x))j + * + (partial(F2,x) - partial(F1,y))k + * + * boundaries are calculated only with data in block + * (ex: partial derivatives in x direction at point (0,0,0) + * only use data from (1,0,0), etc ) + */ +DerivedData Curl3DFunc(const std::vector inputData, DataType type) +{ + size_t dataSize = inputData[0].Count[0] * inputData[0].Count[1] * inputData[0].Count[2]; + + DerivedData curl; + // ToDo - template type + float *data = (float *)malloc(dataSize * sizeof(float) * 3); + curl.Start = inputData[0].Start; + curl.Start.push_back(0); + curl.Count = inputData[0].Count; + curl.Count.push_back(3); + + for (size_t i = 0; i < dataSize; ++i) + { + data[3 * i] = linear_interp(inputData[2], i, 1) - linear_interp(inputData[1], i, 2); + data[3 * i + 1] = linear_interp(inputData[0], i, 2) - linear_interp(inputData[2], i, 0); + data[3 * i + 2] = linear_interp(inputData[1], i, 0) - linear_interp(inputData[0], i, 1); + } + curl.Data = data; + return curl; +} + #define declare_template_instantiation(T) \ T *ApplyOneToOne(std::vector, size_t, std::function); diff --git a/source/adios2/toolkit/derived/Function.h b/source/adios2/toolkit/derived/Function.h index 5dfa5aba97..d41aab6581 100644 --- a/source/adios2/toolkit/derived/Function.h +++ b/source/adios2/toolkit/derived/Function.h @@ -26,11 +26,17 @@ struct OperatorFunctions DerivedData AddFunc(std::vector input, DataType type); DerivedData MagnitudeFunc(std::vector input, DataType type); +DerivedData Curl3DFunc(std::vector input, DataType type); + +template +T linear_interp(T *data, size_t index, size_t count, size_t stride = 1); Dims SameDimsFunc(std::vector input); +Dims CurlDimsFunc(std::vector input); const std::map OpFunctions = { {adios2::detail::ExpressionOperator::OP_ADD, {AddFunc, SameDimsFunc}}, + {adios2::detail::ExpressionOperator::OP_CURL, {Curl3DFunc, CurlDimsFunc}}, {adios2::detail::ExpressionOperator::OP_MAGN, {MagnitudeFunc, SameDimsFunc}}}; template diff --git a/source/adios2/toolkit/derived/Function.tcc b/source/adios2/toolkit/derived/Function.tcc index 1c47c1665b..077ad1e933 100644 --- a/source/adios2/toolkit/derived/Function.tcc +++ b/source/adios2/toolkit/derived/Function.tcc @@ -22,7 +22,7 @@ T *ApplyOneToOne(std::vector inputData, size_t dataSize, std::cout << "Allocation failed for the derived data" << std::endl; // TODO - throw an exception } - memset(outValues, 0, dataSize * sizeof(T)); + memset((void *)outValues, 0, dataSize * sizeof(T)); for (auto &variable : inputData) { for (size_t i = 0; i < dataSize; i++) diff --git a/source/adios2/toolkit/derived/parser/ASTDriver.cpp b/source/adios2/toolkit/derived/parser/ASTDriver.cpp new file mode 100644 index 0000000000..53871e0db8 --- /dev/null +++ b/source/adios2/toolkit/derived/parser/ASTDriver.cpp @@ -0,0 +1,101 @@ +#include "ASTDriver.h" + +namespace adios2 +{ +namespace detail +{ + +using indx_type = std::vector>; + +ASTDriver::ASTDriver() {} + +ASTDriver::ASTDriver(const std::string input) { ASTDriver::parse(input); } + +ASTDriver::~ASTDriver() +{ + while (holding.size() > 0) + { + delete holding.top(); + holding.pop(); + } +} + +ASTNode *ASTDriver::getAST() +{ + // TODO: check only one ASTNode remains in holding + // else throw error that parsing failed + resolve(holding.top()); + return holding.top(); +} + +void ASTDriver::resolve(ASTNode *node) +{ + if (!node->get_alias().empty()) + { + std::tuple var_info; + var_info = lookup_var(node->get_alias()); + node->set_varname(std::get<0>(var_info)); + node->set_indices(std::get<1>(var_info)); + } + for (ASTNode *subexpr : node->get_subexprs()) + { + resolve(subexpr); + } +} + +std::tuple ASTDriver::lookup_var(const std::string alias) +{ + return aliases[alias]; +} + +std::string ASTDriver::lookup_var_name(const std::string alias) +{ + std::tuple var = aliases[alias]; + return std::get<0>(var); +} + +indx_type ASTDriver::lookup_var_indices(const std::string alias) +{ + std::tuple var = aliases[alias]; + return std::get<1>(var); +} + +void ASTDriver::add_lookup_entry(std::string alias, std::string var_name, indx_type indices) +{ + aliases.insert({alias, {var_name, indices}}); +} + +void ASTDriver::add_lookup_entry(std::string alias, std::string var_name) +{ + aliases.insert({alias, {var_name, {}}}); +} + +void ASTDriver::createNode(std::string op_name, size_t numsubexprs) +{ + ASTNode *node = new ASTNode(op_name, numsubexprs); + for (size_t i = 1; i <= numsubexprs; ++i) + { + // TODO: check that holding contains ASTNode(s) + // else throw error that parsing failed + ASTNode *subexpr = holding.top(); + node->insert_subexpr_n(subexpr, numsubexprs - i); + holding.pop(); + } + holding.push(node); +} + +void ASTDriver::createNode(std::string alias) +{ + ASTNode *node = new ASTNode("ALIAS", alias); + holding.push(node); +} + +void ASTDriver::createNode(std::string alias, indx_type indices) +{ + ASTNode *node = new ASTNode("INDEX", indices); + node->pushback_subexpr(new ASTNode("ALIAS", alias)); + holding.push(node); +} + +} +} diff --git a/source/adios2/toolkit/derived/parser/ASTDriver.h b/source/adios2/toolkit/derived/parser/ASTDriver.h new file mode 100644 index 0000000000..c1f2855800 --- /dev/null +++ b/source/adios2/toolkit/derived/parser/ASTDriver.h @@ -0,0 +1,65 @@ +#ifndef ASTDRIVER_HH_ +#define ASTDRIVER_HH_ + +#include "ASTNode.h" +#include "parser.h" +#include +#include +#include +#include + +#define YY_DECL adios2::detail::parser::symbol_type yylex(adios2::detail::ASTDriver &drv) +YY_DECL; + +namespace adios2 +{ +namespace detail +{ + +using indx_type = std::vector>; + +class ASTDriver +{ +public: + ASTDriver(); + ASTDriver(const std::string input); + ~ASTDriver(); + + // Defined in lexer.l + void parse(const std::string input); + + ASTNode *getAST(); + + void resolve(ASTNode *node); + + std::tuple lookup_var(const std::string alias); + std::string lookup_var_name(const std::string alias); + indx_type lookup_var_indices(const std::string alias); + + void add_lookup_entry(std::string alias, std::string var_name, indx_type indices); + void add_lookup_entry(std::string alias, std::string var_name); + + void createNode(std::string, size_t); + void createNode(std::string); + void createNode(std::string, indx_type); + + // Whether to generate parser debug traces. + bool trace_parsing = false; + // Whether to generate scanner debug traces. + bool trace_scanning = false; + // The token's location used by the scanner. + adios2::detail::location location; + +private: + // While parsing, holds ASTNodes until parent node is created + // (since root node is created last from bottom up design) + std::stack holding; + + // Variable lookup table: maps alias names + // to variable names and indices from alias definition + std::map> aliases; +}; + +} +} +#endif // ! ASTDRIVER_HH_ diff --git a/source/adios2/toolkit/derived/parser/ASTNode.cpp b/source/adios2/toolkit/derived/parser/ASTNode.cpp index 5cbc07322d..3563a4c78f 100644 --- a/source/adios2/toolkit/derived/parser/ASTNode.cpp +++ b/source/adios2/toolkit/derived/parser/ASTNode.cpp @@ -1,6 +1,3 @@ -#ifndef ADIOS2_DERIVED_PARSER_ASTNODE_CPP_ -#define ADIOS2_DERIVED_PARSER_ASTNODE_CPP_ - #include "ASTNode.h" namespace adios2 @@ -8,136 +5,92 @@ namespace adios2 namespace detail { -/*****************************************/ -// alias maps to pair of path and indices (indices may be empty string) -std::map> ASTNode::var_lookup; - ASTNode::ASTNode() {} -ASTNode::ASTNode(ExpressionOperator op) : operation(op) {} - -ASTNode::ASTNode(ExpressionOperator op, const char *str) : operation(op) -{ - switch (operation) - { - case ExpressionOperator::OP_ALIAS: - alias = str; - break; - case ExpressionOperator::OP_PATH: - alias = str; - break; - case ExpressionOperator::OP_INDEX: - indices = str; - break; - default: - // TODO: Make some error - // std::cout << "***That's a problem... ASTNode constructed with string should be alias - // type, path type, or index type\n"; - break; - } -} - -ASTNode::ASTNode(ExpressionOperator op, double val) : operation(op), value(val) {} +ASTNode::ASTNode(std::string op) { opname = op; } -ASTNode::ASTNode(ExpressionOperator op, ASTNode *e) : operation(op) { sub_expr.push_back(e); } - -// for index -ASTNode::ASTNode(ExpressionOperator op, ASTNode *e, const char *str) : operation(op), indices(str) +ASTNode::ASTNode(std::string op, size_t numsubexprs) { - sub_expr.push_back(e); + opname = op; + sub_exprs.resize(numsubexprs); } -ASTNode::ASTNode(ExpressionOperator op, ASTNode *e1, ASTNode *e2) : operation(op) +ASTNode::ASTNode(std::string op, std::string a) { - sub_expr.push_back(e1); - sub_expr.push_back(e2); + opname = op; + alias = a; } -// Copy constructor -ASTNode::ASTNode(const ASTNode &e) -: operation(e.operation), alias(e.alias), value(e.value), sub_expr(e.sub_expr) +ASTNode::ASTNode(std::string op, std::vector> i) { + opname = op; + indices = i; } ASTNode::~ASTNode() { - for (ASTNode *e : sub_expr) + for (ASTNode *sub_expr : sub_exprs) { - delete e; + delete sub_expr; } + sub_exprs.clear(); } -std::pair ASTNode::lookup_var(const std::string var_alias) -{ - return var_lookup[var_alias]; -} - -std::string ASTNode::lookup_var_path(const std::string var_alias) -{ - return var_lookup[var_alias].first; -} - -std::string ASTNode::lookup_var_indices(const std::string var_alias) -{ - return var_lookup[var_alias].second; -} - -void ASTNode::add_lookup_entry(const std::string alias, const std::string var_name, - const std::string indices) -{ - // std::cout << "Adding alias to lookup table:\n\talias: " << alias << "\n\tvar_name: " << - // var_name << "\n\tindices: " << indices << std::endl; - var_lookup[alias] = std::make_pair(var_name, indices); -} - -void ASTNode::add_subexpr(ASTNode *e) { sub_expr.push_back(e); } +void ASTNode::set_num_subexprs(size_t n) { sub_exprs.resize(n); } -void ASTNode::add_back_subexpr(ASTNode *e, size_t n) -{ - size_t index = sub_expr.size() - n; - // std::cout << "ASTNode add_back_subexpr index: " << index << std::endl; - // if (index > 0 && sub_expr[index] == nullptr) - sub_expr[index] = e; -} +void ASTNode::pushback_subexpr(ASTNode *subexpr) { sub_exprs.push_back(subexpr); } -void ASTNode::extend_subexprs(size_t n) -{ - // std::cout << "ASTNode extending subexprs from size " << sub_expr.size() << " to " << - // (sub_expr.size() + n) << std::endl; - sub_expr.resize(sub_expr.size() + n); -} +void ASTNode::insert_subexpr_n(ASTNode *subexpr, size_t index) { sub_exprs[index] = subexpr; } -void ASTNode::printpretty(std::string indent) +std::string ASTNode::printpretty(std::string indent) { - std::cout << indent << get_op_name(operation) << ":"; - if (operation == ExpressionOperator::OP_ALIAS) + std::string result = indent + "Node: " + opname + "\n"; + if (!alias.empty()) { - std::cout << " (alias " << alias << " maps to Variable '"; - std::cout << lookup_var_path(alias) << "'"; - if (lookup_var_indices(alias) != "") - { - std::cout << " [" << lookup_var_indices(alias) << "]"; - } - std::cout << ")"; + result += indent + " (alias: \"" + alias + "\")\n"; } - else if (operation == ExpressionOperator::OP_PATH) + if (!varname.empty()) { - std::cout << " (" << alias << ")"; + result += indent + " (varname: \"" + varname + "\")\n"; } - else if (operation == ExpressionOperator::OP_INDEX) + else if (!alias.empty()) { - std::cout << " [" << indices << "]"; + result += indent + " (varname not found)\n"; + } + if (!indices.empty()) + { + result += indent + " (indices: [ "; + for (std::tuple idx : indices) + { + result += std::to_string(std::get<0>(idx)) + ":"; + result += std::to_string(std::get<1>(idx)) + ":"; + result += std::to_string(std::get<2>(idx)) + " "; + } + result += "] )\n"; } - std::cout << std::endl; - for (ASTNode *e : sub_expr) + for (ASTNode *node : sub_exprs) { - if (e != nullptr) - e->printpretty(indent + " "); - else - std::cout << "sub_expr is nullptr" << std::endl; + result += node->printpretty(indent + " "); } + + return result; } +std::vector ASTNode::get_subexprs() { return sub_exprs; } + +std::string ASTNode::get_opname() { return opname; } + +std::string ASTNode::get_alias() { return alias; } + +std::string ASTNode::get_varname() { return varname; } + +std::vector> ASTNode::get_indices() { return indices; } + +double ASTNode::get_value() { return value; } + +void ASTNode::set_varname(const std::string s) { varname = s; } + +void ASTNode::set_indices(const std::vector> idx) { indices = idx; } + } } -#endif diff --git a/source/adios2/toolkit/derived/parser/ASTNode.h b/source/adios2/toolkit/derived/parser/ASTNode.h index 72cec1a812..1d83ab5855 100644 --- a/source/adios2/toolkit/derived/parser/ASTNode.h +++ b/source/adios2/toolkit/derived/parser/ASTNode.h @@ -1,15 +1,9 @@ -#ifndef ADIOS2_DERIVED_PARSER_ASTNODE_H_ -#define ADIOS2_DERIVED_PARSER_ASTNODE_H_ - -#include -#include +#ifndef ASTNODE_HH +#define ASTNODE_HH #include +#include #include -#include "../ExprHelper.h" - -/*****************************************/ - namespace adios2 { namespace detail @@ -19,40 +13,36 @@ class ASTNode { public: ASTNode(); - ASTNode(ExpressionOperator); - ASTNode(ExpressionOperator, const char *a); - ASTNode(ExpressionOperator, double val); - ASTNode(ExpressionOperator, ASTNode *e); - ASTNode(ExpressionOperator, ASTNode *e, const char *i); - ASTNode(ExpressionOperator, ASTNode *e1, ASTNode *e2); - - // Copy constructor - ASTNode(const ASTNode &e); - + ASTNode(std::string); + ASTNode(std::string, size_t); + ASTNode(std::string, std::string); + ASTNode(std::string, std::vector>); ~ASTNode(); - static std::pair lookup_var(const std::string var_alias); - static std::string lookup_var_path(const std::string var_alias); - static std::string lookup_var_indices(const std::string var_alias); - static void add_lookup_entry(const std::string alias, const std::string var_name, - const std::string indices); + void set_num_subexprs(size_t); + void pushback_subexpr(ASTNode *); + void insert_subexpr_n(ASTNode *, size_t); + std::string printpretty(std::string = ""); + + std::vector get_subexprs(); + std::string get_opname(); + std::string get_alias(); + std::string get_varname(); + std::vector> get_indices(); + double get_value(); - void add_subexpr(ASTNode *e); - void add_back_subexpr(ASTNode *e, size_t i); - void extend_subexprs(size_t n); - void infer_type(); - void printpretty(std::string indent = ""); + void set_varname(const std::string); + void set_indices(const std::vector>); - // private: - ExpressionOperator operation; +private: + std::vector sub_exprs; + std::string opname; std::string alias; - std::string indices; + std::string varname; + std::vector> indices; double value; - std::vector sub_expr; - - static std::map> var_lookup; }; } } -#endif \ No newline at end of file +#endif // ! ASTNODE_HH diff --git a/source/adios2/toolkit/derived/parser/lexer.cpp b/source/adios2/toolkit/derived/parser/lexer.cpp deleted file mode 100644 index 03b101c191..0000000000 --- a/source/adios2/toolkit/derived/parser/lexer.cpp +++ /dev/null @@ -1,1884 +0,0 @@ -#line 1 "lexer.cpp" - -#line 3 "lexer.cpp" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767 - 1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647 - 1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -/* begin standard C++ headers. */ - -/* TODO: this is always defined, so inline it */ -#define yyconst const - -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) -#else -#define yynoreturn -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. - */ -#define YY_SC_TO_UI(c) ((YY_CHAR)(c)) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start)-1) / 2) -#define YYSTATE YY_START -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin) -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -#define YY_LESS_LINENO(n) -#define YY_LINENO_REWIND_TO(ptr) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } while (0) -#define unput(c) yyunput(c, (yytext_ptr)) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state -{ - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 -}; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE *yy_buffer_stack = NULL; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL) -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart(FILE *input_file); -void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer); -YY_BUFFER_STATE yy_create_buffer(FILE *file, int size); -void yy_delete_buffer(YY_BUFFER_STATE b); -void yy_flush_buffer(YY_BUFFER_STATE b); -void yypush_buffer_state(YY_BUFFER_STATE new_buffer); -void yypop_buffer_state(void); - -static void yyensure_buffer_stack(void); -static void yy_load_buffer_state(void); -static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file); -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER) - -YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size); -YY_BUFFER_STATE yy_scan_string(const char *yy_str); -YY_BUFFER_STATE yy_scan_bytes(const char *bytes, yy_size_t len); - -void *yyalloc(yy_size_t); -void *yyrealloc(void *, yy_size_t); -void yyfree(void *); - -#define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if (!YY_CURRENT_BUFFER) \ - { \ - yyensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if (!YY_CURRENT_BUFFER) \ - { \ - yyensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define yywrap() (/*CONSTCOND*/ 1) -#define YY_SKIP_YYWRAP -typedef flex_uint8_t YY_CHAR; - -FILE *yyin = NULL, *yyout = NULL; - -typedef int yy_state_type; - -extern int yylineno; -int yylineno = 1; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state(void); -static yy_state_type yy_try_NUL_trans(yy_state_type current_state); -static int yy_get_next_buffer(void); -static void yynoreturn yy_fatal_error(const char *msg); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (yy_size_t)(yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 24 -#define YY_END_OF_BUFFER 25 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info -{ - flex_int32_t yy_verify; - flex_int32_t yy_nxt; -}; -static const flex_int16_t yy_accept[91] = { - 0, 0, 0, 25, 23, 17, 18, 23, 23, 6, 7, 3, 1, 8, 2, 23, 4, 16, 23, 19, 19, 23, 5, - 19, 19, 19, 19, 19, 18, 17, 0, 0, 0, 16, 16, 16, 19, 19, 0, 20, 19, 0, 0, 19, 19, 19, - 19, 19, 19, 19, 0, 21, 0, 0, 16, 0, 0, 16, 20, 20, 18, 0, 22, 0, 0, 9, 12, 19, 19, - 11, 19, 13, 18, 0, 16, 20, 0, 0, 0, 15, 19, 10, 0, 0, 19, 0, 19, 19, 19, 14, 0}; - -static const YY_CHAR yy_ec[256] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 1, 1, 1, 1, - 1, 1, 16, 16, 16, 16, 17, 18, 16, 16, 16, 16, 16, 16, 16, 16, 19, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 20, 21, 22, 23, 24, 1, 25, 26, 27, 28, - - 29, 26, 30, 26, 31, 26, 26, 32, 33, 34, 35, 26, 36, 37, 38, 39, 40, 26, 26, 26, 26, - 26, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - -static const YY_CHAR yy_meta[42] = {0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 4, 5, 6, 1, 6, 6, 6, 6, 1, - 5, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1}; - -static const flex_int16_t yy_base[98] = { - 0, 0, 0, 221, 254, 218, 254, 190, 29, 254, 254, 254, 254, 254, 254, 203, 254, - 32, 34, 204, 33, 42, 254, 39, 42, 47, 48, 50, 254, 213, 180, 50, 75, 199, - 52, 56, 200, 81, 84, 89, 89, 101, 103, 66, 53, 75, 92, 94, 97, 102, 183, - 254, 116, 128, 118, 134, 196, 112, 140, 144, 196, 105, 254, 145, 152, 195, 193, 138, - 144, 157, 132, 126, 254, 162, 117, 166, 174, 167, 181, 113, 173, 71, 178, 184, 160, - 187, 188, 190, 134, 64, 254, 224, 227, 229, 234, 238, 243, 247 - -}; - -static const flex_int16_t yy_def[98] = { - 0, 90, 1, 90, 90, 90, 90, 90, 91, 90, 90, 90, 90, 90, 90, 90, 90, 92, 93, 92, - 92, 90, 90, 92, 92, 92, 92, 92, 90, 90, 90, 91, 94, 90, 90, 92, 92, 92, 93, 95, - 92, 90, 90, 92, 92, 92, 92, 92, 92, 92, 90, 90, 96, 94, 90, 90, 90, 92, 97, 95, - 92, 90, 90, 90, 90, 92, 92, 92, 92, 92, 92, 92, 90, 96, 90, 97, 90, 90, 90, 92, - 92, 92, 90, 90, 92, 90, 92, 92, 92, 92, 0, 90, 90, 90, 90, 90, 90, 90 - -}; - -static const flex_int16_t yy_nxt[296] = { - 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 19, 21, 4, 4, 22, - 19, 23, 19, 24, 19, 19, 19, 19, 19, 25, 19, 19, 19, 19, 26, 27, 19, 28, 31, 31, 34, 90, 35, 38, - 38, 37, 31, 90, 40, 31, 90, 38, 41, 42, 38, 90, 90, 37, 90, 31, 31, 90, 54, 43, 34, 55, 35, 31, - 46, 37, 31, 49, 90, 44, 90, 47, 51, 55, 45, 90, 48, 37, 52, 90, 52, 52, 56, 66, 56, 90, 65, 57, - 52, 38, 38, 52, 58, - - 90, 58, 58, 90, 38, 90, 60, 38, 90, 58, 61, 67, 58, 90, 41, 42, 63, 64, 76, 77, 51, 68, 62, 90, - 90, 57, 52, 69, 52, 52, 74, 54, 51, 70, 55, 71, 52, 90, 52, 52, 52, 52, 56, 90, 56, 90, 55, 74, - 52, 90, 58, 52, 58, 58, 58, 90, 58, 58, 63, 64, 58, 61, 89, 58, 58, 78, 51, 58, 90, 79, 81, 90, - 52, 62, 52, 52, 58, 80, 58, 58, 82, 83, 52, 61, 90, 52, 58, 76, 77, 58, 61, 82, 83, 61, 78, 62, - 61, 85, 86, 90, - - 85, 90, 62, 84, 90, 62, 90, 90, 62, 74, 72, 90, 33, 50, 29, 90, 33, 88, 30, 29, 90, 90, 90, 90, - 90, 90, 90, 87, 32, 32, 36, 90, 36, 39, 39, 53, 53, 90, 53, 53, 59, 90, 59, 59, 73, 73, 90, 73, - 73, 75, 90, 75, 75, 3, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90 - -}; - -static const flex_int16_t yy_chk[296] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 17, 20, 17, 18, - 18, 17, 8, 23, 20, 8, 24, 18, 21, 21, 18, 25, 26, 17, 27, 31, 31, 44, 34, 23, 35, 34, 35, 31, - 25, 35, 31, 27, 89, 24, 43, 26, 32, 34, 24, 81, 26, 35, 32, 45, 32, 32, 37, 44, 37, 37, 43, 37, - 32, 38, 38, 32, 39, - - 40, 39, 39, 46, 38, 47, 40, 38, 48, 39, 41, 45, 39, 49, 41, 41, 42, 42, 61, 61, 52, 46, 41, 57, - 79, 57, 52, 47, 52, 52, 74, 54, 53, 48, 54, 49, 52, 71, 53, 52, 53, 53, 55, 70, 55, 88, 54, 55, - 53, 67, 58, 53, 58, 58, 59, 68, 59, 59, 63, 63, 58, 64, 88, 58, 59, 64, 73, 59, 69, 67, 70, 84, - 73, 64, 73, 73, 75, 68, 75, 75, 77, 77, 73, 76, 80, 73, 75, 76, 76, 75, 78, 82, 82, 83, 78, 76, - 85, 83, 84, 86, - - 85, 87, 78, 80, 66, 83, 65, 60, 85, 56, 50, 36, 33, 30, 29, 19, 15, 87, 7, 5, 3, 0, 0, 0, - 0, 0, 0, 86, 91, 91, 92, 0, 92, 93, 93, 94, 94, 0, 94, 94, 95, 0, 95, 95, 96, 96, 0, 96, - 96, 97, 0, 97, 97, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90 - -}; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "lexer.l" -#line 2 "lexer.l" -#include "parser.h" -#define YY_USER_ACTION yylloc.first_line = yylloc.last_line = yylineno; -#line 544 "lexer.cpp" -#line 545 "lexer.cpp" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals(void); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy(void); - -int yyget_debug(void); - -void yyset_debug(int debug_flag); - -YY_EXTRA_TYPE yyget_extra(void); - -void yyset_extra(YY_EXTRA_TYPE user_defined); - -FILE *yyget_in(void); - -void yyset_in(FILE *_in_str); - -FILE *yyget_out(void); - -void yyset_out(FILE *_out_str); - -yy_size_t yyget_leng(void); - -char *yyget_text(void); - -int yyget_lineno(void); - -void yyset_lineno(int _line_number); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap(void); -#else -extern int yywrap(void); -#endif -#endif - -#ifndef YY_NO_UNPUT - -static void yyunput(int c, char *buf_ptr); - -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy(char *, const char *, int); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen(const char *); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput(void); -#else -static int input(void); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO \ - do \ - { \ - if (fwrite(yytext, (size_t)yyleng, 1, yyout)) \ - { \ - } \ - } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf, result, max_size) \ - if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \ - { \ - int c = '*'; \ - yy_size_t n; \ - for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \ - buf[n] = (char)c; \ - if (c == '\n') \ - buf[n++] = (char)c; \ - if (c == EOF && ferror(yyin)) \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - result = n; \ - } \ - else \ - { \ - errno = 0; \ - while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) \ - { \ - if (errno != EINTR) \ - { \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - break; \ - } \ - errno = 0; \ - clearerr(yyin); \ - } \ - } - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error(msg) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex(void); - -#define YY_DECL int yylex(void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/ break; -#endif - -#define YY_RULE_SETUP YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if (!(yy_init)) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if (!(yy_start)) - (yy_start) = 1; /* first start state */ - - if (!yyin) - yyin = stdin; - - if (!yyout) - yyout = stdout; - - if (!YY_CURRENT_BUFFER) - { - yyensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); - } - - yy_load_buffer_state(); - } - - { -#line 12 "lexer.l" - -#line 765 "lexer.cpp" - - while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if (yy_accept[yy_current_state]) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) - { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 91) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } while (yy_base[yy_current_state] != 254); - - yy_find_action: - yy_act = yy_accept[yy_current_state]; - if (yy_act == 0) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - do_action: /* This label is used only to access EOF actions. */ - - switch (yy_act) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - - case 1: - YY_RULE_SETUP -#line 14 "lexer.l" - { - yylval.sval = strdup(yytext); - return OPERATOR; - } - YY_BREAK - case 2: - YY_RULE_SETUP -#line 15 "lexer.l" - { - yylval.sval = strdup(yytext); - return OPERATOR; - } - YY_BREAK - case 3: - YY_RULE_SETUP -#line 16 "lexer.l" - { - yylval.sval = strdup(yytext); - return OPERATOR; - } - YY_BREAK - case 4: - YY_RULE_SETUP -#line 17 "lexer.l" - { - yylval.sval = strdup(yytext); - return OPERATOR; - } - YY_BREAK - case 5: - YY_RULE_SETUP -#line 18 "lexer.l" - { - yylval.sval = strdup(yytext); - return OPERATOR; - } - YY_BREAK - case 6: - YY_RULE_SETUP -#line 19 "lexer.l" - { - return L_PAREN; - } - YY_BREAK - case 7: - YY_RULE_SETUP -#line 20 "lexer.l" - { - return R_PAREN; - } - YY_BREAK - case 8: - YY_RULE_SETUP -#line 21 "lexer.l" - { - return COMMA; - } - YY_BREAK - case 9: - YY_RULE_SETUP -#line 22 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 10: - YY_RULE_SETUP -#line 23 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 11: - YY_RULE_SETUP -#line 24 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 12: - YY_RULE_SETUP -#line 25 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 13: - YY_RULE_SETUP -#line 26 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 14: - YY_RULE_SETUP -#line 27 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 15: - YY_RULE_SETUP -#line 28 "lexer.l" - { - yylval.sval = strdup(yytext); - return FUNCTION; - } - YY_BREAK - case 16: - YY_RULE_SETUP -#line 31 "lexer.l" - { - yylval.dval = atof(yytext); - return NUMBER; - } - YY_BREAK - case 17: - YY_RULE_SETUP -#line 33 "lexer.l" - { /* ignore spaces */ - } - YY_BREAK - case 18: - /* rule 18 can match eol */ - YY_RULE_SETUP -#line 35 "lexer.l" - { - return ENDL; - } - YY_BREAK - case 19: - YY_RULE_SETUP -#line 37 "lexer.l" - { - yylval.sval = strdup(yytext); - return ALIAS; - } - YY_BREAK - case 20: - YY_RULE_SETUP -#line 39 "lexer.l" - { - yylval.sval = strndup(yytext + 1, strlen(yytext) - 1); - return PATH; - } - YY_BREAK - case 21: - YY_RULE_SETUP -#line 41 "lexer.l" - { - yylval.sval = strndup(yytext + 1, strlen(yytext) - 2); - return PATH; - } - YY_BREAK - case 22: - YY_RULE_SETUP -#line 43 "lexer.l" - { - yylval.sval = strndup(yytext + 1, strlen(yytext) - 2); - return INDICES; - } - YY_BREAK - case 23: - YY_RULE_SETUP -#line 45 "lexer.l" - { - printf("Error at line %d: unrecognized symbol \"%s\"\n", yylloc.first_line, - yytext); - exit(0); - } - YY_BREAK - case 24: - YY_RULE_SETUP -#line 47 "lexer.l" - ECHO; - YY_BREAK -#line 943 "lexer.cpp" - case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans(yy_current_state); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if (yy_next_state) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else - switch (yy_get_next_buffer()) - { - case EOB_ACT_END_OF_FILE: { - (yy_did_buffer_switch_on_eof) = 0; - - if (yywrap()) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer(void) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; - int ret_val; - - if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1]) - YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); - - if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int)((yy_c_buf_p) - (yytext_ptr)-1); - - for (i = 0; i < number_to_move; ++i) - *(dest++) = *(source++); - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while (num_to_read <= 0) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = (int)((yy_c_buf_p)-b->yy_ch_buf); - - if (b->yy_is_our_buffer) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if (new_size <= 0) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2)); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; - - if (!b->yy_ch_buf) - YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - } - - if (num_to_read > YY_READ_BUF_SIZE) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ((yy_n_chars) == 0) - { - if (number_to_move == YY_MORE_ADJ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) - { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = - (char *)yyrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t)new_size); - if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state(void) -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - - for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 41); - if (yy_accept[yy_current_state]) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) - { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 91) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ -static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state) -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 41; - if (yy_accept[yy_current_state]) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) - { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 91) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 90); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - -static void yyunput(int c, char *yy_bp) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; - char *dest = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - *--dest = *--source; - - yy_cp += (int)(dest - source); - yy_bp += (int)(dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = - (int)YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - YY_FATAL_ERROR("flex scanner push-back overflow"); - } - - *--yy_cp = (char)c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput(void) -#else -static int input(void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch (yy_get_next_buffer()) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: { - if (yywrap()) - return 0; - - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *)(yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ -void yyrestart(FILE *input_file) -{ - - if (!YY_CURRENT_BUFFER) - { - yyensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); - } - - yy_init_buffer(YY_CURRENT_BUFFER, input_file); - yy_load_buffer_state(); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ -void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack(); - if (YY_CURRENT_BUFFER == new_buffer) - return; - - if (YY_CURRENT_BUFFER) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state(void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ -YY_BUFFER_STATE yy_create_buffer(FILE *file, int size) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *)yyalloc((yy_size_t)(b->yy_buf_size + 2)); - if (!b->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b, file); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ -void yy_delete_buffer(YY_BUFFER_STATE b) -{ - - if (!b) - return; - - if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0; - - if (b->yy_is_our_buffer) - yyfree((void *)b->yy_ch_buf); - - yyfree((void *)b); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ -static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file) - -{ - int oerrno = errno; - - yy_flush_buffer(b); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER) - { - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ -void yy_flush_buffer(YY_BUFFER_STATE b) -{ - if (!b) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if (b == YY_CURRENT_BUFFER) - yy_load_buffer_state(); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state(YY_BUFFER_STATE new_buffer) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if (YY_CURRENT_BUFFER) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state(void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) - { - yy_load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack(void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) - { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = - (struct yy_buffer_state **)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state *)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state *)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) - { - - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state **)yyrealloc( - (yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, - grow_size * sizeof(struct yy_buffer_state *)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size) -{ - YY_BUFFER_STATE b; - - if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || - base[size - 1] != YY_END_OF_BUFFER_CHAR) - /* They forgot to leave room for the EOB's. */ - return NULL; - - b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); - - b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string(const char *yystr) -{ - - return yy_scan_bytes(yystr, (int)strlen(yystr)); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, yy_size_t _yybytes_len) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t)(_yybytes_len + 2); - buf = (char *)yyalloc(n); - if (!buf) - YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); - - for (i = 0; i < _yybytes_len; ++i) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf, n); - if (!b) - YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yynoreturn yy_fatal_error(const char *msg) -{ - fprintf(stderr, "%s\n", msg); - exit(YY_EXIT_FAILURE); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yy_size_t yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } while (0) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno(void) { return yylineno; } - -/** Get the input stream. - * - */ -FILE *yyget_in(void) { return yyin; } - -/** Get the output stream. - * - */ -FILE *yyget_out(void) { return yyout; } - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng(void) { return yyleng; } - -/** Get the current token. - * - */ - -char *yyget_text(void) { return yytext; } - -/** Set the current line number. - * @param _line_number line number - * - */ -void yyset_lineno(int _line_number) { yylineno = _line_number; } - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in(FILE *_in_str) { yyin = _in_str; } - -void yyset_out(FILE *_out_str) { yyout = _out_str; } - -int yyget_debug(void) { return yy_flex_debug; } - -void yyset_debug(int _bdebug) { yy_flex_debug = _bdebug; } - -static int yy_init_globals(void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = NULL; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = NULL; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = NULL; - yyout = NULL; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy(void) -{ - - /* Pop the buffer stack, destroying each element. */ - while (YY_CURRENT_BUFFER) - { - yy_delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack)); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals(); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy(char *s1, const char *s2, int n) -{ - - int i; - for (i = 0; i < n; ++i) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen(const char *s) -{ - int n; - for (n = 0; s[n]; ++n) - ; - - return n; -} -#endif - -void *yyalloc(yy_size_t size) { return malloc(size); } - -void *yyrealloc(void *ptr, yy_size_t size) -{ - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return realloc(ptr, size); -} - -void yyfree(void *ptr) { free((char *)ptr); /* see yyrealloc() for (char *) cast */ } - -#define YYTABLES_NAME "yytables" - -#line 47 "lexer.l" diff --git a/source/adios2/toolkit/derived/parser/lexer.l b/source/adios2/toolkit/derived/parser/lexer.l index f81a98bcf9..566e4a41c7 100644 --- a/source/adios2/toolkit/derived/parser/lexer.l +++ b/source/adios2/toolkit/derived/parser/lexer.l @@ -1,47 +1,155 @@ -%{ -#include "parser.hpp" -#define YY_USER_ACTION yylloc.first_line = yylloc.last_line = yylineno; +%{ +#include +#include +#include +#include // strerror +#include +#include "ASTDriver.h" +#include "parser.h" +#if defined(_MSC_VER) +#include +#define YY_NO_UNISTD_H +#define strdup _strdup +#define isatty _isatty +#define fileno _fileno +#include +#include +#endif %} -%option noyywrap +%{ +#if defined __clang__ +# define CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) +#endif +// Clang and ICC like to pretend they are GCC. +#if defined __GNUC__ && !defined __clang__ && !defined __ICC +# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +#endif -DIGIT [0-9] -CHAR ([a-z]|[A-Z]) - -%% +// Pacify warnings in yy_init_buffer (observed with Flex 2.6.4) +// and GCC 6.4.0, 7.3.0 with -O3. +#if defined GCC_VERSION && 600 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wnull-dereference" +#endif + +// This example uses Flex's C back end, yet compiles it as C++. +// So expect warnings about C style casts and NULL. +#if defined CLANG_VERSION && 500 <= CLANG_VERSION +# pragma clang diagnostic ignored "-Wold-style-cast" +# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#elif defined GCC_VERSION && 407 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wold-style-cast" +# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif + +#define FLEX_VERSION (YY_FLEX_MAJOR_VERSION * 100 + YY_FLEX_MINOR_VERSION) -"+" {yylval.sval=strdup(yytext); return OPERATOR;} -"-" {yylval.sval=strdup(yytext); return OPERATOR;} -"*" {yylval.sval=strdup(yytext); return OPERATOR;} -"/" {yylval.sval=strdup(yytext); return OPERATOR;} -"^" {yylval.sval=strdup(yytext); return OPERATOR;} -"(" {return L_PAREN;} -")" {return R_PAREN;} -"," {return COMMA;} -"add" {yylval.sval=strdup(yytext); return FUNCTION;} -"sqrt" {yylval.sval=strdup(yytext); return FUNCTION;} -"sin" {yylval.sval=strdup(yytext); return FUNCTION;} -"cos" {yylval.sval=strdup(yytext); return FUNCTION;} -"tan" {yylval.sval=strdup(yytext); return FUNCTION;} -"magnitude" {yylval.sval=strdup(yytext); return FUNCTION;} -"curl" {yylval.sval=strdup(yytext); return FUNCTION;} +// Old versions of Flex (2.5.35) generate an incomplete documentation comment. +// +// In file included from src/scan-code-c.c:3: +// src/scan-code.c:2198:21: error: empty paragraph passed to '@param' command +// [-Werror,-Wdocumentation] +// * @param line_number +// ~~~~~~~~~~~~~~~~~^ +// 1 error generated. +#if FLEX_VERSION < 206 && defined CLANG_VERSION +# pragma clang diagnostic ignored "-Wdocumentation" +#endif +// Old versions of Flex (2.5.35) use 'register'. Warnings introduced in +// GCC 7 and Clang 6. +#if FLEX_VERSION < 206 +# if defined CLANG_VERSION && 600 <= CLANG_VERSION +# pragma clang diagnostic ignored "-Wdeprecated-register" +# elif defined GCC_VERSION && 700 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wregister" +# endif +#endif -(\.{DIGIT}+)|({DIGIT}+(\.{DIGIT}*)?([eE][+-]?[0-9]+)?) {yylval.dval = atof(yytext); return NUMBER;} +#if FLEX_VERSION < 206 +# if defined CLANG_VERSION +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wdocumentation" +# pragma clang diagnostic ignored "-Wshorten-64-to-32" +# pragma clang diagnostic ignored "-Wsign-conversion" +# elif defined GCC_VERSION +# pragma GCC diagnostic ignored "-Wconversion" +# pragma GCC diagnostic ignored "-Wsign-conversion" +# endif +#endif + +// Flex 2.6.4, GCC 9 +// warning: useless cast to type 'int' [-Wuseless-cast] +// 1361 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); +// | ^ +#if defined GCC_VERSION && 900 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif +%} -[ \t]+ {/* ignore spaces */} +%option noyywrap nounput noinput batch -(\n|\0|EOF|$end) {return ENDL;} +%{ + // A number symbol corresponding to the value in S. + adios2::detail::parser::symbol_type + make_INT (const std::string &s, const adios2::detail::parser::location_type& loc); +%} -({CHAR}|{DIGIT}|_)+ {yylval.sval=strdup(yytext); return ALIAS;} +op [-+*/^] +id [a-zA-Z][a-zA-Z_0-9_]* +path [a-zA-Z][a-zA-Z0-9_\\./-]* +int [0-9]+ +blank [ \t\r] -:(\\|\/|_|{DIGIT})*{CHAR}+(\\|\/|-|_|{DIGIT}|{CHAR})* {yylval.sval=strndup(yytext + 1,strlen(yytext)-1); return PATH;} +%{ + // Code run each time a pattern is matched. + # define YY_USER_ACTION loc.columns (yyleng); +%} +%% +%{ + // A handy shortcut to the location held by the adios2::detail::ASTDriver. + adios2::detail::location& loc = drv.location; + // Code run each time yylex is called. + loc.step (); +%} +{blank}+ loc.step (); +\n+ loc.lines (yyleng); loc.step (); -'(\\|\/|_|{DIGIT})*{CHAR}+(\\|\/|-|_|{DIGIT}|{CHAR})*' {yylval.sval=strndup(yytext + 1,strlen(yytext)-2); return PATH;} +"=" return adios2::detail::parser::make_ASSIGN (loc); +"," return adios2::detail::parser::make_COMMA (loc); +":" return adios2::detail::parser::make_COLON (loc); +"(" return adios2::detail::parser::make_L_PAREN (loc); +")" return adios2::detail::parser::make_R_PAREN (loc); +"[" return adios2::detail::parser::make_L_BRACE (loc); +"]" return adios2::detail::parser::make_R_BRACE (loc); -"["({DIGIT}+|{DIGIT}*":"{DIGIT}*":"{DIGIT}*)(,({DIGIT}+|{DIGIT}*":"{DIGIT}*":"{DIGIT}*))*"]" {yylval.sval=strndup(yytext + 1,strlen(yytext)-2); return INDICES;} +{int} return make_INT (yytext, loc); +{op} return adios2::detail::parser::make_OPERATOR (yytext, loc); +{id} return adios2::detail::parser::make_IDENTIFIER (yytext, loc); +{path} return adios2::detail::parser::make_VARNAME (yytext, loc); +. { + throw adios2::detail::parser::syntax_error + (loc, "invalid character: " + std::string(yytext)); +} +<> return adios2::detail::parser::make_YYEOF (loc); +%% -. {printf("Error at line %d: unrecognized symbol \"%s\"\n", yylloc.first_line, yytext); exit(0);} +adios2::detail::parser::symbol_type +make_INT (const std::string &s, const adios2::detail::parser::location_type& loc) +{ + errno = 0; + long n = strtol (s.c_str(), NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + throw adios2::detail::parser::syntax_error (loc, "integer is out of range: " + s); + return adios2::detail::parser::make_INT ((int) n, loc); +} -%% \ No newline at end of file +void +adios2::detail::ASTDriver::parse (const std::string input) +{ + adios2::detail::parser parse (*this); + yy_scan_string(input.c_str()); + parse.set_debug_level (trace_parsing); + parse (); +} diff --git a/source/adios2/toolkit/derived/parser/parser.cpp b/source/adios2/toolkit/derived/parser/parser.cpp deleted file mode 100644 index 03938fc8d6..0000000000 --- a/source/adios2/toolkit/derived/parser/parser.cpp +++ /dev/null @@ -1,1666 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 1 - -/* Tokens. */ -#ifndef YYTOKENTYPE -#define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype -{ - COMMA = 258, - L_PAREN = 259, - R_PAREN = 260, - ENDL = 261, - FUNCTION = 262, - OPERATOR = 263, - INDICES = 264, - NUMBER = 265, - ALIAS = 266, - PATH = 267 -}; -#endif -/* Tokens. */ -#define COMMA 258 -#define L_PAREN 259 -#define R_PAREN 260 -#define ENDL 261 -#define FUNCTION 262 -#define OPERATOR 263 -#define INDICES 264 -#define NUMBER 265 -#define ALIAS 266 -#define PATH 267 - -/* Copy the first part of user declarations. */ -#line 2 "parser.y" - -#include "parser.h" -#include "lexer.h" -#include -#include -#include -#include -#include -#include - -extern int yyparse(std::stack *expr_stack); - -static void *yyparse_value; - -void yyerror(std::stack *expr_stack, const char *msg); - -namespace adios2 -{ -namespace detail -{ -void *createExpr(std::stack *, std::string, const char *, double, size_t); -} -} - -/* Enabling traces. */ -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -#undef YYERROR_VERBOSE -#define YYERROR_VERBOSE 1 -#else -#define YYERROR_VERBOSE 1 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -#define YYTOKEN_TABLE 0 -#endif - -#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 25 "parser.y" -{ - double dval; - int ival; - char *sval; - void *expr_ptr; -} -/* Line 193 of yacc.c. */ -#line 148 "parser.cpp" -YYSTYPE; -#define yystype YYSTYPE /* obsolescent; will be withdrawn */ -#define YYSTYPE_IS_DECLARED 1 -#define YYSTYPE_IS_TRIVIAL 1 -#endif - -#if !defined YYLTYPE && !defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -} YYLTYPE; -#define yyltype YYLTYPE /* obsolescent; will be withdrawn */ -#define YYLTYPE_IS_DECLARED 1 -#define YYLTYPE_IS_TRIVIAL 1 -#endif - -/* Copy the second part of user declarations. */ - -/* Line 216 of yacc.c. */ -#line 173 "parser.cpp" - -#ifdef short -#undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -#ifdef __SIZE_TYPE__ -#define YYSIZE_T __SIZE_TYPE__ -#elif defined size_t -#define YYSIZE_T size_t -#elif !defined YYSIZE_T && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -#include /* INFRINGES ON USER NAME SPACE */ -#define YYSIZE_T size_t -#else -#define YYSIZE_T unsigned int -#endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T)-1) - -#ifndef YY_ -#if defined YYENABLE_NLS && YYENABLE_NLS -#if ENABLE_NLS -#include /* INFRINGES ON USER NAME SPACE */ -#define YY_(msgid) dgettext("bison-runtime", msgid) -#endif -#endif -#ifndef YY_ -#define YY_(msgid) msgid -#endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if !defined lint || defined __GNUC__ -#define YYUSE(e) ((void)(e)) -#else -#define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -#define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static int YYID(int i) -#else -static int YYID(i) -int i; -#endif -{ - return i; -} -#endif - -#if !defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -#ifdef YYSTACK_USE_ALLOCA -#if YYSTACK_USE_ALLOCA -#ifdef __GNUC__ -#define YYSTACK_ALLOC __builtin_alloca -#elif defined __BUILTIN_VA_ARG_INCR -#include /* INFRINGES ON USER NAME SPACE */ -#elif defined _AIX -#define YYSTACK_ALLOC __alloca -#elif defined _MSC_VER -#include /* INFRINGES ON USER NAME SPACE */ -#define alloca _alloca -#else -#define YYSTACK_ALLOC alloca -#if !defined _ALLOCA_H && !defined _STDLIB_H && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -#include /* INFRINGES ON USER NAME SPACE */ -#ifndef _STDLIB_H -#define _STDLIB_H 1 -#endif -#endif -#endif -#endif -#endif - -#ifdef YYSTACK_ALLOC -/* Pacify GCC's `empty if-body' warning. */ -#define YYSTACK_FREE(Ptr) \ - do \ - { /* empty */ \ - ; \ - } while (YYID(0)) -#ifndef YYSTACK_ALLOC_MAXIMUM -/* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -#endif -#else -#define YYSTACK_ALLOC YYMALLOC -#define YYSTACK_FREE YYFREE -#ifndef YYSTACK_ALLOC_MAXIMUM -#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -#endif -#if (defined __cplusplus && !defined _STDLIB_H && \ - !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free))) -#include /* INFRINGES ON USER NAME SPACE */ -#ifndef _STDLIB_H -#define _STDLIB_H 1 -#endif -#endif -#ifndef YYMALLOC -#define YYMALLOC malloc -#if !defined malloc && !defined _STDLIB_H && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -#endif -#endif -#ifndef YYFREE -#define YYFREE free -#if !defined free && !defined _STDLIB_H && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -void free(void *); /* INFRINGES ON USER NAME SPACE */ -#endif -#endif -#endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - -#if (!defined yyoverflow && \ - (!defined __cplusplus || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL && \ - defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -#define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -#define YYSTACK_BYTES(N) \ - ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE) + sizeof(YYLTYPE)) + 2 * YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -#ifndef YYCOPY -#if defined __GNUC__ && 1 < __GNUC__ -#define YYCOPY(To, From, Count) __builtin_memcpy(To, From, (Count) * sizeof(*(From))) -#else -#define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } while (YYID(0)) -#endif -#endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -#define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY(&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof(*yyptr); \ - } while (YYID(0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 16 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 37 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 13 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 5 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 16 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 28 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 267 - -#define YYTRANSLATE(YYX) ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = { - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = {0, 0, 3, 4, 7, 10, 13, 16, 20, - 24, 26, 28, 31, 33, 35, 39, 43}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = {14, 0, -1, -1, 6, 14, -1, 15, 14, -1, 17, 14, -1, 11, 12, -1, - 11, 12, 9, -1, 16, 3, 17, -1, 17, -1, 11, -1, 11, 9, -1, 12, - -1, 10, -1, 4, 17, 5, -1, 17, 8, 17, -1, 7, 4, 16, 5, -1}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = {0, 51, 51, 52, 53, 54, 57, 58, 65, - 66, 69, 70, 71, 72, 73, 74, 75}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = {"$end", "error", "$undefined", "COMMA", "L_PAREN", - "R_PAREN", "ENDL", "FUNCTION", "OPERATOR", "INDICES", - "NUMBER", "ALIAS", "PATH", "$accept", "input", - "decl", "list", "exp", 0}; -#endif - -#ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267}; -#endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = {0, 13, 14, 14, 14, 14, 15, 15, 16, - 16, 17, 17, 17, 17, 17, 17, 17}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = {0, 2, 0, 2, 2, 2, 2, 3, 3, 1, 1, 2, 1, 1, 3, 3, 4}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = {2, 0, 2, 0, 13, 10, 12, 0, 2, 2, 10, 0, 3, 0, - 11, 6, 1, 4, 0, 5, 14, 0, 9, 7, 15, 0, 16, 8}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = {-1, 7, 8, 21, 9}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -4 -static const yytype_int8 yypact[] = {9, 18, 9, -2, -4, 2, -4, 6, 9, -3, 1, 26, -4, 18, - -4, 14, -4, -4, 18, -4, -4, 32, 10, -4, 10, 18, -4, 10}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = {-4, 24, -4, -4, -1}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = {11, 1, 13, 2, 3, 18, 16, 4, 5, 6, 14, 14, 22, - 1, 15, 2, 3, 24, 18, 4, 5, 6, 1, 23, 27, 3, - 12, 0, 4, 10, 6, 20, 17, 19, 18, 25, 0, 26}; - -static const yytype_int8 yycheck[] = {1, 4, 4, 6, 7, 8, 0, 10, 11, 12, 9, 9, 13, - 4, 12, 6, 7, 18, 8, 10, 11, 12, 4, 9, 25, 7, - 2, -1, 10, 11, 12, 5, 8, 9, 8, 3, -1, 5}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = {0, 4, 6, 7, 10, 11, 12, 14, 15, 17, 11, 17, 14, 4, - 9, 12, 0, 14, 8, 14, 5, 16, 17, 9, 17, 3, 5, 17}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE(yychar); \ - YYPOPSTACK(1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror(expr_stack, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (YYID(0)) - -#define YYTERROR 1 -#define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -#define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID(N)) \ - { \ - (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = YYRHSLOC(Rhs, 0).last_column; \ - } \ - while (YYID(0)) -#endif - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -#define YY_LOCATION_PRINT(File, Loc) \ - fprintf(File, "%d.%d-%d.%d", (Loc).first_line, (Loc).first_column, (Loc).last_line, \ - (Loc).last_column) -#else -#define YY_LOCATION_PRINT(File, Loc) ((void)0) -#endif -#endif - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -#define YYLEX yylex(YYLEX_PARAM) -#else -#define YYLEX yylex() -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -#ifndef YYFPRINTF -#include /* INFRINGES ON USER NAME SPACE */ -#define YYFPRINTF fprintf -#endif - -#define YYDPRINTF(Args) \ - do \ - { \ - if (yydebug) \ - YYFPRINTF Args; \ - } while (YYID(0)) - -#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ - do \ - { \ - if (yydebug) \ - { \ - YYFPRINTF(stderr, "%s ", Title); \ - yy_symbol_print(stderr, Type, Value, Location, expr_stack); \ - YYFPRINTF(stderr, "\n"); \ - } \ - } while (YYID(0)) - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, - YYLTYPE const *const yylocationp, - std::stack *expr_stack) -#else -static void yy_symbol_value_print(yyoutput, yytype, yyvaluep, yylocationp, - expr_stack) FILE *yyoutput; -int yytype; -YYSTYPE const *const yyvaluep; -YYLTYPE const *const yylocationp; -std::stack *expr_stack; -#endif -{ - if (!yyvaluep) - return; - YYUSE(yylocationp); - YYUSE(expr_stack); -#ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); -#else - YYUSE(yyoutput); -#endif - switch (yytype) - { - default: - break; - } -} - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, - YYLTYPE const *const yylocationp, - std::stack *expr_stack) -#else -static void yy_symbol_print(yyoutput, yytype, yyvaluep, yylocationp, expr_stack) FILE *yyoutput; -int yytype; -YYSTYPE const *const yyvaluep; -YYLTYPE const *const yylocationp; -std::stack *expr_stack; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF(yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]); - - YY_LOCATION_PRINT(yyoutput, *yylocationp); - YYFPRINTF(yyoutput, ": "); - yy_symbol_value_print(yyoutput, yytype, yyvaluep, yylocationp, expr_stack); - YYFPRINTF(yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void yy_stack_print(yytype_int16 *bottom, yytype_int16 *top) -#else -static void yy_stack_print(bottom, top) yytype_int16 *bottom; -yytype_int16 *top; -#endif -{ - YYFPRINTF(stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF(stderr, " %d", *bottom); - YYFPRINTF(stderr, "\n"); -} - -#define YY_STACK_PRINT(Bottom, Top) \ - do \ - { \ - if (yydebug) \ - yy_stack_print((Bottom), (Top)); \ - } while (YYID(0)) - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void yy_reduce_print(YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, - std::stack *expr_stack) -#else -static void yy_reduce_print(yyvsp, yylsp, yyrule, expr_stack) YYSTYPE *yyvsp; -YYLTYPE *yylsp; -int yyrule; -std::stack *expr_stack; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf(stderr, " $%d = ", yyi + 1); - yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]), - &(yylsp[(yyi + 1) - (yynrhs)]), expr_stack); - fprintf(stderr, "\n"); - } -} - -#define YY_REDUCE_PRINT(Rule) \ - do \ - { \ - if (yydebug) \ - yy_reduce_print(yyvsp, yylsp, Rule, expr_stack); \ - } while (YYID(0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -#define YYDPRINTF(Args) -#define YY_SYMBOL_PRINT(Title, Type, Value, Location) -#define YY_STACK_PRINT(Bottom, Top) -#define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -#if YYERROR_VERBOSE - -#ifndef yystrlen -#if defined __GLIBC__ && defined _STRING_H -#define yystrlen strlen -#else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T yystrlen(const char *yystr) -#else -static YYSIZE_T yystrlen(yystr) const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -#endif -#endif - -#ifndef yystpcpy -#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -#define yystpcpy stpcpy -#else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static char *yystpcpy(char *yydest, const char *yysrc) -#else -static char *yystpcpy(yydest, yysrc) -char *yydest; -const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -#endif -#endif - -#ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T yytnamerr(char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes:; - } - - if (!yyres) - return yystrlen(yystr); - - return yystpcpy(yyres, yystr) - yyres; -} -#endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T yysyntax_error(char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE(yychar); - YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum - { - YYERROR_VERBOSE_ARGS_MAXIMUM = 5 - }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + - ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy(yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr(0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy(yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen(yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr(yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, - std::stack *expr_stack) -#else -static void yydestruct(yymsg, yytype, yyvaluep, yylocationp, expr_stack) const char *yymsg; -int yytype; -YYSTYPE *yyvaluep; -YYLTYPE *yylocationp; -std::stack *expr_stack; -#endif -{ - YYUSE(yyvaluep); - YYUSE(yylocationp); - YYUSE(expr_stack); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse(void *YYPARSE_PARAM); -#else -int yyparse(); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse(std::stack *expr_stack); -#else -int yyparse(); -#endif -#endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ -YYLTYPE yylloc; - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -int yyparse(void *YYPARSE_PARAM) -#else -int yyparse(YYPARSE_PARAM) void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -int yyparse(std::stack *expr_stack) -#else -int yyparse(expr_stack) std::stack *expr_stack; -#endif -#endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - yylsp = yyls; -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - /* Initialize the default location before parsing starts. */ - yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; -#endif - - goto yysetstate; - - /*------------------------------------------------------------. - | yynewstate -- Push a new state, which is found in yystate. | - `------------------------------------------------------------*/ -yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - -yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - YYLTYPE *yyls1 = yyls; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1, - yysize * sizeof(*yyvsp), &yyls1, yysize * sizeof(*yylsp), &yystacksize); - yyls = yyls1; - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -#ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -#else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = (union yyalloc *)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); - if (!yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE(yyss); - YYSTACK_RELOCATE(yyvs); - YYSTACK_RELOCATE(yyls); -#undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE(yyss1); - } -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - yylsp = yyls + yysize - 1; - - YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE(yychar); - YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - *++yylsp = yylloc; - goto yynewstate; - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1 - yylen]; - - /* Default location. */ - YYLLOC_DEFAULT(yyloc, (yylsp - yylen), yylen); - YY_REDUCE_PRINT(yyn); - switch (yyn) - { - case 2: -#line 51 "parser.y" - { - ; - } - break; - - case 3: -#line 52 "parser.y" - { - ; - } - break; - - case 4: -#line 53 "parser.y" - { - ; - } - break; - - case 5: -#line 54 "parser.y" - { /*yyparse_value = $1->expression;*/ - ; - } - break; - - case 6: -#line 57 "parser.y" - { - adios2::detail::ASTNode::add_lookup_entry((yyvsp[(1) - (2)].sval), (yyvsp[(2) - (2)].sval), - ""); - ; - } - break; - - case 7: -#line 58 "parser.y" - { - adios2::detail::ASTNode::add_lookup_entry((yyvsp[(1) - (3)].sval), (yyvsp[(2) - (3)].sval), - (yyvsp[(3) - (3)].sval)); - ; - } - break; - - case 8: -#line 65 "parser.y" - { - (yyval.ival) = (yyvsp[(1) - (3)].ival) + 1; - ; - } - break; - - case 9: -#line 66 "parser.y" - { - (yyval.ival) = 1; - ; - } - break; - - case 10: -#line 69 "parser.y" - { - (yyval.expr_ptr) = createExpr(expr_stack, "ALIAS", (yyvsp[(1) - (1)].sval), 0, 0); - ; - } - break; - - case 11: -#line 70 "parser.y" - { - createExpr(expr_stack, "ALIAS", (yyvsp[(1) - (2)].sval), 0, 0); - (yyval.expr_ptr) = createExpr(expr_stack, "INDEX", (yyvsp[(2) - (2)].sval), 0, 1); - ; - } - break; - - case 12: -#line 71 "parser.y" - { - (yyval.expr_ptr) = createExpr(expr_stack, "PATH", (yyvsp[(1) - (1)].sval), 0, 0); - ; - } - break; - - case 13: -#line 72 "parser.y" - { - (yyval.expr_ptr) = createExpr(expr_stack, "NUM", "", (yyvsp[(1) - (1)].dval), 0); - ; - } - break; - - case 14: -#line 73 "parser.y" - { - (yyval.expr_ptr) = (yyvsp[(2) - (3)].expr_ptr); - ; - } - break; - - case 15: -#line 74 "parser.y" - { - (yyval.expr_ptr) = createExpr(expr_stack, (yyvsp[(2) - (3)].sval), "", 0, 2); - ; - } - break; - - case 16: -#line 75 "parser.y" - { - (yyval.expr_ptr) = - createExpr(expr_stack, (yyvsp[(1) - (4)].sval), "", 0, (yyvsp[(3) - (4)].ival)); - ; - } - break; - -/* Line 1267 of yacc.c. */ -#line 1480 "parser.cpp" - default: - break; - } - YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); - - *++yyvsp = yyval; - *++yylsp = yyloc; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if !YYERROR_VERBOSE - yyerror(expr_stack, YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error(0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); - yymsg = (char *)YYSTACK_ALLOC(yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void)yysyntax_error(yymsg, yystate, yychar); - yyerror(expr_stack, yymsg); - } - else - { - yyerror(expr_stack, YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - yyerror_range[0] = yylloc; - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct("Error: discarding", yytoken, &yylval, &yylloc, expr_stack); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto yyerrlab1; - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - yyerror_range[0] = yylsp[1 - yylen]; - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - yyerror_range[0] = *yylsp; - yydestruct("Error: popping", yystos[yystate], yyvsp, yylsp, expr_stack); - YYPOPSTACK(1); - yystate = *yyssp; - YY_STACK_PRINT(yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - yyerror_range[1] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ - YYLLOC_DEFAULT(yyloc, (yyerror_range - 1), 2); - *++yylsp = yyloc; - - /* Shift the error token. */ - YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror(expr_stack, YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, expr_stack); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK(yylen); - YY_STACK_PRINT(yyss, yyssp); - while (yyssp != yyss) - { - yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp, yylsp, expr_stack); - YYPOPSTACK(1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE(yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); -#endif - /* Make sure YYID is used. */ - return YYID(yyresult); -} - -#line 77 "parser.y" - -namespace adios2 -{ -namespace detail -{ - -void *createExpr(std::stack *expr_stack, std::string str_op, const char *name, - double value, size_t numsubexprs) -{ - // std::cout << "Creating ASTNode in function createExpr" << std::endl; - // std::cout << "\tstack size: " << expr_stack->size() << "\n\top: " << str_op << "\n\tname: " - // << name << "\n\tvalue: " << value << "\n\tnumsubexprs: " << numsubexprs << std::endl; - - ExpressionOperator op = get_op(str_op); - - ASTNode *node = new ASTNode(op); - switch (op) - { - case ExpressionOperator::OP_ALIAS: - node = new ASTNode(op, name); - break; - case ExpressionOperator::OP_PATH: - node = new ASTNode(op, name); - break; - case ExpressionOperator::OP_NUM: - node = new ASTNode(op, value); - break; - case ExpressionOperator::OP_INDEX: - // TODO: translate indices - node = new ASTNode(op, name); - break; - default: - node = new ASTNode(op); - }; - node->extend_subexprs(numsubexprs); - for (size_t i = 1; i <= numsubexprs; ++i) - { - ASTNode *subexpr = expr_stack->top(); - node->add_back_subexpr(subexpr, i); - expr_stack->pop(); - } - expr_stack->push(node); - - return &expr_stack->top(); -} - -ASTNode *parse_expression(std::string input) -{ - yy_scan_string(input.c_str()); - std::stack expr_stack; - yyparse(&expr_stack); - - // DEBUGGING - // std::cout << "yyparse complete. Stack size: " << expr_stack.size() << std::endl; - // std::cout << "parser prettyprint:" << std::endl; - // expr_stack.top()->printpretty(""); - return expr_stack.top(); -} - -} -} - -void yyerror(std::stack *expr_stack, const char *msg) -{ - printf("** Line %d: %s\n", yylloc.first_line, msg); -} diff --git a/source/adios2/toolkit/derived/parser/parser.h b/source/adios2/toolkit/derived/parser/parser.h deleted file mode 100644 index 38c3c96d58..0000000000 --- a/source/adios2/toolkit/derived/parser/parser.h +++ /dev/null @@ -1,110 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -#define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype -{ - COMMA = 258, - L_PAREN = 259, - R_PAREN = 260, - ENDL = 261, - FUNCTION = 262, - OPERATOR = 263, - INDICES = 264, - NUMBER = 265, - ALIAS = 266, - PATH = 267 -}; -#endif -/* Tokens. */ -#define COMMA 258 -#define L_PAREN 259 -#define R_PAREN 260 -#define ENDL 261 -#define FUNCTION 262 -#define OPERATOR 263 -#define INDICES 264 -#define NUMBER 265 -#define ALIAS 266 -#define PATH 267 - -#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 25 "parser.y" -{ - double dval; - int ival; - char *sval; - void *expr_ptr; -} -/* Line 1529 of yacc.c. */ -#line 80 "parser.h" -YYSTYPE; -#define yystype YYSTYPE /* obsolescent; will be withdrawn */ -#define YYSTYPE_IS_DECLARED 1 -#define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE yylval; - -#if !defined YYLTYPE && !defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -} YYLTYPE; -#define yyltype YYLTYPE /* obsolescent; will be withdrawn */ -#define YYLTYPE_IS_DECLARED 1 -#define YYLTYPE_IS_TRIVIAL 1 -#endif - -extern YYLTYPE yylloc; - -#include "ASTNode.h" -#include - -namespace adios2 -{ -namespace detail -{ -ASTNode *parse_expression(std::string input); -} -} diff --git a/source/adios2/toolkit/derived/parser/parser.output b/source/adios2/toolkit/derived/parser/parser.output deleted file mode 100644 index ae7a9b24a1..0000000000 --- a/source/adios2/toolkit/derived/parser/parser.output +++ /dev/null @@ -1,350 +0,0 @@ -State 5 conflicts: 1 shift/reduce -State 24 conflicts: 1 shift/reduce - - -Grammar - - 0 $accept: input $end - - 1 input: /* empty */ - 2 | ENDL input - 3 | decl input - 4 | exp input - - 5 decl: ALIAS PATH - 6 | ALIAS PATH INDICES - - 7 list: list COMMA exp - 8 | exp - - 9 exp: ALIAS - 10 | ALIAS INDICES - 11 | PATH - 12 | NUMBER - 13 | L_PAREN exp R_PAREN - 14 | exp OPERATOR exp - 15 | FUNCTION L_PAREN list R_PAREN - - -Terminals, with rules where they appear - -$end (0) 0 -error (256) -COMMA (258) 7 -L_PAREN (259) 13 15 -R_PAREN (260) 13 15 -ENDL (261) 2 -FUNCTION (262) 15 -OPERATOR (263) 14 -INDICES (264) 6 10 -NUMBER (265) 12 -ALIAS (266) 5 6 9 10 -PATH (267) 5 6 11 - - -Nonterminals, with rules where they appear - -$accept (13) - on left: 0 -input (14) - on left: 1 2 3 4, on right: 0 2 3 4 -decl (15) - on left: 5 6, on right: 3 -list (16) - on left: 7 8, on right: 7 15 -exp (17) - on left: 9 10 11 12 13 14 15, on right: 4 7 8 13 14 - - -state 0 - - 0 $accept: . input $end - - L_PAREN shift, and go to state 1 - ENDL shift, and go to state 2 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 5 - PATH shift, and go to state 6 - - $default reduce using rule 1 (input) - - input go to state 7 - decl go to state 8 - exp go to state 9 - - -state 1 - - 13 exp: L_PAREN . exp R_PAREN - - L_PAREN shift, and go to state 1 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 10 - PATH shift, and go to state 6 - - exp go to state 11 - - -state 2 - - 2 input: ENDL . input - - L_PAREN shift, and go to state 1 - ENDL shift, and go to state 2 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 5 - PATH shift, and go to state 6 - - $default reduce using rule 1 (input) - - input go to state 12 - decl go to state 8 - exp go to state 9 - - -state 3 - - 15 exp: FUNCTION . L_PAREN list R_PAREN - - L_PAREN shift, and go to state 13 - - -state 4 - - 12 exp: NUMBER . - - $default reduce using rule 12 (exp) - - -state 5 - - 5 decl: ALIAS . PATH - 6 | ALIAS . PATH INDICES - 9 exp: ALIAS . - 10 | ALIAS . INDICES - - INDICES shift, and go to state 14 - PATH shift, and go to state 15 - - PATH [reduce using rule 9 (exp)] - $default reduce using rule 9 (exp) - - -state 6 - - 11 exp: PATH . - - $default reduce using rule 11 (exp) - - -state 7 - - 0 $accept: input . $end - - $end shift, and go to state 16 - - -state 8 - - 3 input: decl . input - - L_PAREN shift, and go to state 1 - ENDL shift, and go to state 2 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 5 - PATH shift, and go to state 6 - - $default reduce using rule 1 (input) - - input go to state 17 - decl go to state 8 - exp go to state 9 - - -state 9 - - 4 input: exp . input - 14 exp: exp . OPERATOR exp - - L_PAREN shift, and go to state 1 - ENDL shift, and go to state 2 - FUNCTION shift, and go to state 3 - OPERATOR shift, and go to state 18 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 5 - PATH shift, and go to state 6 - - $default reduce using rule 1 (input) - - input go to state 19 - decl go to state 8 - exp go to state 9 - - -state 10 - - 9 exp: ALIAS . - 10 | ALIAS . INDICES - - INDICES shift, and go to state 14 - - $default reduce using rule 9 (exp) - - -state 11 - - 13 exp: L_PAREN exp . R_PAREN - 14 | exp . OPERATOR exp - - R_PAREN shift, and go to state 20 - OPERATOR shift, and go to state 18 - - -state 12 - - 2 input: ENDL input . - - $default reduce using rule 2 (input) - - -state 13 - - 15 exp: FUNCTION L_PAREN . list R_PAREN - - L_PAREN shift, and go to state 1 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 10 - PATH shift, and go to state 6 - - list go to state 21 - exp go to state 22 - - -state 14 - - 10 exp: ALIAS INDICES . - - $default reduce using rule 10 (exp) - - -state 15 - - 5 decl: ALIAS PATH . - 6 | ALIAS PATH . INDICES - - INDICES shift, and go to state 23 - - $default reduce using rule 5 (decl) - - -state 16 - - 0 $accept: input $end . - - $default accept - - -state 17 - - 3 input: decl input . - - $default reduce using rule 3 (input) - - -state 18 - - 14 exp: exp OPERATOR . exp - - L_PAREN shift, and go to state 1 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 10 - PATH shift, and go to state 6 - - exp go to state 24 - - -state 19 - - 4 input: exp input . - - $default reduce using rule 4 (input) - - -state 20 - - 13 exp: L_PAREN exp R_PAREN . - - $default reduce using rule 13 (exp) - - -state 21 - - 7 list: list . COMMA exp - 15 exp: FUNCTION L_PAREN list . R_PAREN - - COMMA shift, and go to state 25 - R_PAREN shift, and go to state 26 - - -state 22 - - 8 list: exp . - 14 exp: exp . OPERATOR exp - - OPERATOR shift, and go to state 18 - - $default reduce using rule 8 (list) - - -state 23 - - 6 decl: ALIAS PATH INDICES . - - $default reduce using rule 6 (decl) - - -state 24 - - 14 exp: exp . OPERATOR exp - 14 | exp OPERATOR exp . - - OPERATOR shift, and go to state 18 - - OPERATOR [reduce using rule 14 (exp)] - $default reduce using rule 14 (exp) - - -state 25 - - 7 list: list COMMA . exp - - L_PAREN shift, and go to state 1 - FUNCTION shift, and go to state 3 - NUMBER shift, and go to state 4 - ALIAS shift, and go to state 10 - PATH shift, and go to state 6 - - exp go to state 27 - - -state 26 - - 15 exp: FUNCTION L_PAREN list R_PAREN . - - $default reduce using rule 15 (exp) - - -state 27 - - 7 list: list COMMA exp . - 14 exp: exp . OPERATOR exp - - OPERATOR shift, and go to state 18 - - $default reduce using rule 7 (list) \ No newline at end of file diff --git a/source/adios2/toolkit/derived/parser/parser.y b/source/adios2/toolkit/derived/parser/parser.y index d9bf172459..a258b34bc1 100644 --- a/source/adios2/toolkit/derived/parser/parser.y +++ b/source/adios2/toolkit/derived/parser/parser.y @@ -1,132 +1,113 @@ -/* calculator. */ -%{ - #include - #include - #include - #include - #include - #include - #include - #include "lexer.h" - #include "ASTNode.h" - - extern int yyparse(std::stack* expr_stack); - - void* createExpr(std::stack*, std::string, const char*, double, size_t); - - static void* yyparse_value; - - void yyerror(std::stack* expr_stack, const char *msg); - -%} - -%parse-param {std::stack* expr_stack} - -%union{ - double dval; - int ival; - char* sval; - void* expr_ptr; +%skeleton "lalr1.cc" +%require "3.8.2" +%header + +%define api.token.raw +%define api.namespace {adios2::detail} +%define api.token.constructor +%define api.value.type variant +%define parse.assert + +%code requires { + #include + #include + #include + namespace adios2 + { + namespace detail + { + class ASTDriver; + } + } } -%error-verbose -%locations +// The parsing context. +%param { ASTDriver& drv } -%start input -%token COMMA L_PAREN R_PAREN ENDL -%token FUNCTION -%token OPERATOR -%token INDICES -%token NUMBER -%token ALIAS PATH -%type NUMBER -%type ALIAS PATH INDICES -%type FUNCTION OPERATOR -%type input exp -%type list - - -%% - -input: {} - | ENDL input {} - | decl input {} - | exp input { /*yyparse_value = $1->expression;*/ } - ; - -decl: ALIAS PATH { ASTNode::add_lookup_entry($1, $2, ""); } - | ALIAS PATH INDICES { ASTNode::add_lookup_entry($1, $2, $3); } - ; - -//index: NUMBER comma index { ASTNode::extend_current_lookup_indices($1); } -// | NUMBER { ASTNode::extend_current_lookup_indices($1); } -// ; - -list: list COMMA exp { $$ = $1 +1; } - | exp { $$ = 1;} - ; - -exp: ALIAS { $$ = createExpr(expr_stack, "ALIAS", $1, 0, 0); } -| ALIAS INDICES { createExpr(expr_stack, "ALIAS", $1, 0, 0); $$ = createExpr(expr_stack, "INDEX", $2, 0, 1); } -| PATH { $$ = createExpr(expr_stack, "PATH", $1, 0, 0); } -| NUMBER { $$ = createExpr(expr_stack, "NUM", "", $1, 0); } -| L_PAREN exp R_PAREN { $$ = $2; } -| exp OPERATOR exp { $$ = createExpr(expr_stack, $2, "", 0, 2); } -| FUNCTION L_PAREN list R_PAREN { $$ = createExpr(expr_stack, $1, "", 0, $3); } - ; -%% +%locations -void* createExpr(std::stack* expr_stack, std::string str_op, const char* name, double value, size_t numsubexprs) { - std::cout << "Creating ASTNode in function createExpr" << std::endl; - std::cout << "\tstack size: " << expr_stack->size() << "\n\top: " << str_op << "\n\tname: " << name << "\n\tvalue: " << value << "\n\tnumsubexprs: " << numsubexprs << std::endl; - - ExprHelper::expr_op op = ExprHelper::get_op(str_op); - - ASTNode *node = new ASTNode(op); - switch(op) { - case ExprHelper::OP_ALIAS: - node = new ASTNode(op, name); - break; - case ExprHelper::OP_PATH: - node = new ASTNode(op, name); - break; - case ExprHelper::OP_NUM: - node = new ASTNode(op, value); - break; - case ExprHelper::OP_INDEX: - // TODO: translate indices - node = new ASTNode(op, name); - break; - default: - node = new ASTNode(op); - }; - node->extend_subexprs(numsubexprs); - for (size_t i = 1; i <= numsubexprs; ++i) - { - ASTNode *subexpr = expr_stack->top(); - node->add_back_subexpr(subexpr,i); - expr_stack->pop(); - } - expr_stack->push(node); +%define parse.trace +%define parse.error detailed +%define parse.lac full - return &expr_stack->top(); +%code { +#include "ASTDriver.h" +#include "ASTNode.h" } -Expression* parse_expression(const char* input) { - yy_scan_string(input); - std::stack expr_stack; - yyparse(&expr_stack); +%define api.token.prefix {TOK_} +%token + ASSIGN "=" + COMMA "," + COLON ":" + L_PAREN "(" + R_PAREN ")" + L_BRACE "[" + R_BRACE "]" +; + +%token OPERATOR +%token IDENTIFIER "identifier" +%token VARNAME +%token INT "number" +%nterm list +%nterm >> indices_list +%nterm > index +%left OPERATOR - // DEBUGGING - std::cout << "yyparse complete. Stack size: " << expr_stack.size() << std::endl; - std::cout << "parser prettyprint:" << std::endl; - expr_stack.top()->printpretty(""); +%% +%start lines; +lines: + assignment lines {} +| exp {} +; + +assignment: + IDENTIFIER ASSIGN VARNAME { drv.add_lookup_entry($1, $3); } +| IDENTIFIER ASSIGN IDENTIFIER { drv.add_lookup_entry($1, $3); } +| IDENTIFIER ASSIGN VARNAME L_BRACE indices_list R_BRACE { drv.add_lookup_entry($1, $3, $5); } +| IDENTIFIER ASSIGN IDENTIFIER L_BRACE indices_list R_BRACE { drv.add_lookup_entry($1, $3, $5); } +; + +exp: + "number" { } +| exp OPERATOR exp { drv.createNode($2, 2); } +| "(" exp ")" { } +| IDENTIFIER "(" list ")" { drv.createNode($1, $3); } +| IDENTIFIER "[" indices_list "]" { drv.createNode($1, $3); } +| IDENTIFIER { drv.createNode($1); } +; + + +indices_list: + %empty { $$ = {}; } +| indices_list COMMA index { $1.push_back($3); $$ = $1; } +| index { $$ = {$1}; } +; + +index: + %empty { $$ = {-1, -1, 1}; } +| INT COLON INT COLON INT { $$ = {$1, $3, $5}; } +| COLON INT COLON INT { $$ = {-1, $2, $4}; } +| INT COLON COLON INT { $$ = {$1, -1, $4}; } +| INT COLON INT COLON { $$ = {$1, $3, 1}; } +| INT COLON INT { $$ = {$1, $3, 1}; } +| COLON COLON INT { $$ = {-1, -1, $3}; } +| COLON INT COLON { $$ = {-1, $2, 1}; } +| COLON INT { $$ = {-1, $2, 1}; } +| INT COLON COLON { $$ = {$1, -1, 1}; } +| INT COLON { $$ = {$1, -1, 1}; } +| INT { $$ = {$1, $1, 1}; } +; + +list: + %empty { $$ = 0; } +| exp COMMA list { $$ = $3 + 1; } +| exp { $$ = 1; } +%% - Expression *dummy_root = new Expression(); - expr_stack.top()->to_expr(dummy_root); - return std::get<0>(dummy_root->sub_exprs[0]); +void +adios2::detail::parser::error (const location_type& l, const std::string& m) +{ + std::cerr << l << ": " << m << '\n'; } - -void yyerror(std::stack* expr_stack, const char *msg) { - printf("** Line %d: %s\n", yylloc.first_line, msg); -} \ No newline at end of file diff --git a/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp b/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp new file mode 100644 index 0000000000..598731e63c --- /dev/null +++ b/source/adios2/toolkit/derived/parser/pregen-source/lexer.cpp @@ -0,0 +1,1905 @@ +#line 1 "lexer.cpp" + +#line 3 "lexer.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +#define YY_NUM_RULES 15 +#define YY_END_OF_BUFFER 16 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[23] = + { 0, + 0, 0, 16, 14, 1, 2, 6, 7, 11, 4, + 10, 5, 3, 12, 8, 9, 1, 2, 10, 13, + 12, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, + 5, 6, 6, 7, 8, 9, 8, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 11, 1, 1, + 12, 1, 1, 1, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 14, 9, 15, 6, 16, 1, 13, 13, 13, 13, + + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[17] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, + 1, 1, 2, 1, 1, 2 + } ; + +static const flex_int16_t yy_base[25] = + { 0, + 0, 0, 29, 30, 26, 24, 30, 30, 30, 30, + 16, 30, 30, 9, 30, 30, 23, 21, 13, 0, + 11, 30, 20, 19 + } ; + +static const flex_int16_t yy_def[25] = + { 0, + 22, 1, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 23, 22, 22, 22, 22, 22, 24, + 23, 0, 22, 22 + } ; + +static const flex_int16_t yy_nxt[47] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 9, 4, 11, + 12, 13, 14, 15, 16, 4, 20, 20, 20, 20, + 20, 21, 19, 18, 17, 19, 18, 17, 22, 3, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22 + } ; + +static const flex_int16_t yy_chk[47] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 14, 14, 21, 21, + 24, 23, 19, 18, 17, 11, 6, 5, 3, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "../lexer.l" +#line 2 "../lexer.l" +#include +#include +#include +#include // strerror +#include +#include "ASTDriver.h" +#include "parser.h" +#if defined(_MSC_VER) +#include +#define YY_NO_UNISTD_H +#define strdup _strdup +#define isatty _isatty +#define fileno _fileno +#include +#include +#endif +#line 477 "lexer.cpp" +#line 21 "../lexer.l" +#if defined __clang__ +# define CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) +#endif + +// Clang and ICC like to pretend they are GCC. +#if defined __GNUC__ && !defined __clang__ && !defined __ICC +# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +#endif + +// Pacify warnings in yy_init_buffer (observed with Flex 2.6.4) +// and GCC 6.4.0, 7.3.0 with -O3. +#if defined GCC_VERSION && 600 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wnull-dereference" +#endif + +// This example uses Flex's C back end, yet compiles it as C++. +// So expect warnings about C style casts and NULL. +#if defined CLANG_VERSION && 500 <= CLANG_VERSION +# pragma clang diagnostic ignored "-Wold-style-cast" +# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#elif defined GCC_VERSION && 407 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wold-style-cast" +# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif + +#define FLEX_VERSION (YY_FLEX_MAJOR_VERSION * 100 + YY_FLEX_MINOR_VERSION) + +// Old versions of Flex (2.5.35) generate an incomplete documentation comment. +// +// In file included from src/scan-code-c.c:3: +// src/scan-code.c:2198:21: error: empty paragraph passed to '@param' command +// [-Werror,-Wdocumentation] +// * @param line_number +// ~~~~~~~~~~~~~~~~~^ +// 1 error generated. +#if FLEX_VERSION < 206 && defined CLANG_VERSION +# pragma clang diagnostic ignored "-Wdocumentation" +#endif + +// Old versions of Flex (2.5.35) use 'register'. Warnings introduced in +// GCC 7 and Clang 6. +#if FLEX_VERSION < 206 +# if defined CLANG_VERSION && 600 <= CLANG_VERSION +# pragma clang diagnostic ignored "-Wdeprecated-register" +# elif defined GCC_VERSION && 700 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wregister" +# endif +#endif + +#if FLEX_VERSION < 206 +# if defined CLANG_VERSION +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wdocumentation" +# pragma clang diagnostic ignored "-Wshorten-64-to-32" +# pragma clang diagnostic ignored "-Wsign-conversion" +# elif defined GCC_VERSION +# pragma GCC diagnostic ignored "-Wconversion" +# pragma GCC diagnostic ignored "-Wsign-conversion" +# endif +#endif + +// Flex 2.6.4, GCC 9 +// warning: useless cast to type 'int' [-Wuseless-cast] +// 1361 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); +// | ^ +#if defined GCC_VERSION && 900 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif +#line 547 "lexer.cpp" +#define YY_NO_INPUT 1 +#line 94 "../lexer.l" + // A number symbol corresponding to the value in S. + adios2::detail::parser::symbol_type + make_INT (const std::string &s, const adios2::detail::parser::location_type& loc); +#line 553 "lexer.cpp" +#line 106 "../lexer.l" + // Code run each time a pattern is matched. + # define YY_USER_ACTION loc.columns (yyleng); +#line 557 "lexer.cpp" +#line 558 "lexer.cpp" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals ( void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + yy_size_t yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +#line 109 "../lexer.l" + + +#line 112 "../lexer.l" + // A handy shortcut to the location held by the adios2::detail::ASTDriver. + adios2::detail::location& loc = drv.location; + // Code run each time yylex is called. + loc.step (); + +#line 782 "lexer.cpp" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 23 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 22 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 117 "../lexer.l" +loc.step (); + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 118 "../lexer.l" +loc.lines (yyleng); loc.step (); + YY_BREAK +case 3: +YY_RULE_SETUP +#line 120 "../lexer.l" +return adios2::detail::parser::make_ASSIGN (loc); + YY_BREAK +case 4: +YY_RULE_SETUP +#line 121 "../lexer.l" +return adios2::detail::parser::make_COMMA (loc); + YY_BREAK +case 5: +YY_RULE_SETUP +#line 122 "../lexer.l" +return adios2::detail::parser::make_COLON (loc); + YY_BREAK +case 6: +YY_RULE_SETUP +#line 123 "../lexer.l" +return adios2::detail::parser::make_L_PAREN (loc); + YY_BREAK +case 7: +YY_RULE_SETUP +#line 124 "../lexer.l" +return adios2::detail::parser::make_R_PAREN (loc); + YY_BREAK +case 8: +YY_RULE_SETUP +#line 125 "../lexer.l" +return adios2::detail::parser::make_L_BRACE (loc); + YY_BREAK +case 9: +YY_RULE_SETUP +#line 126 "../lexer.l" +return adios2::detail::parser::make_R_BRACE (loc); + YY_BREAK +case 10: +YY_RULE_SETUP +#line 128 "../lexer.l" +return make_INT (yytext, loc); + YY_BREAK +case 11: +YY_RULE_SETUP +#line 129 "../lexer.l" +return adios2::detail::parser::make_OPERATOR (yytext, loc); + YY_BREAK +case 12: +YY_RULE_SETUP +#line 130 "../lexer.l" +return adios2::detail::parser::make_IDENTIFIER (yytext, loc); + YY_BREAK +case 13: +YY_RULE_SETUP +#line 131 "../lexer.l" +return adios2::detail::parser::make_VARNAME (yytext, loc); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 132 "../lexer.l" +{ + throw adios2::detail::parser::syntax_error + (loc, "invalid character: " + std::string(yytext)); +} + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 136 "../lexer.l" +return adios2::detail::parser::make_YYEOF (loc); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 137 "../lexer.l" +ECHO; + YY_BREAK +#line 918 "lexer.cpp" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 23 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 23 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 22); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yy_size_t yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +yy_size_t yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 137 "../lexer.l" + + +adios2::detail::parser::symbol_type +make_INT (const std::string &s, const adios2::detail::parser::location_type& loc) +{ + errno = 0; + long n = strtol (s.c_str(), NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + throw adios2::detail::parser::syntax_error (loc, "integer is out of range: " + s); + return adios2::detail::parser::make_INT ((int) n, loc); +} + +void +adios2::detail::ASTDriver::parse (const std::string input) +{ + adios2::detail::parser parse (*this); + yy_scan_string(input.c_str()); + parse.set_debug_level (trace_parsing); + parse (); +} diff --git a/source/adios2/toolkit/derived/parser/lexer.h b/source/adios2/toolkit/derived/parser/pregen-source/lexer.h similarity index 71% rename from source/adios2/toolkit/derived/parser/lexer.h rename to source/adios2/toolkit/derived/parser/pregen-source/lexer.h index 75c3a14657..c83d2213a8 100644 --- a/source/adios2/toolkit/derived/parser/lexer.h +++ b/source/adios2/toolkit/derived/parser/pregen-source/lexer.h @@ -6,7 +6,7 @@ #line 7 "lexer.h" -#define YY_INT_ALIGNED short int +#define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ @@ -21,10 +21,10 @@ /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ -#include #include -#include #include +#include +#include /* end standard C headers. */ @@ -35,10 +35,10 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -56,41 +56,41 @@ typedef uint64_t flex_uint64_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN -#define INT8_MIN (-128) +#define INT8_MIN (-128) #endif #ifndef INT16_MIN -#define INT16_MIN (-32767 - 1) +#define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN -#define INT32_MIN (-2147483647 - 1) +#define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX -#define INT8_MAX (127) +#define INT8_MAX (127) #endif #ifndef INT16_MAX -#define INT16_MAX (32767) +#define INT16_MAX (32767) #endif #ifndef INT32_MAX -#define INT32_MAX (2147483647) +#define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX -#define UINT8_MAX (255U) +#define UINT8_MAX (255U) #endif #ifndef UINT16_MAX -#define UINT16_MAX (65535U) +#define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) +#define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) +#define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ @@ -138,72 +138,73 @@ extern FILE *yyin, *yyout; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state -{ - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; - int yy_buffer_status; -}; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void yyrestart(FILE *input_file); -void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer); -YY_BUFFER_STATE yy_create_buffer(FILE *file, int size); -void yy_delete_buffer(YY_BUFFER_STATE b); -void yy_flush_buffer(YY_BUFFER_STATE b); -void yypush_buffer_state(YY_BUFFER_STATE new_buffer); -void yypop_buffer_state(void); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size); -YY_BUFFER_STATE yy_scan_string(const char *yy_str); -YY_BUFFER_STATE yy_scan_bytes(const char *bytes, yy_size_t len); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len ); -void *yyalloc(yy_size_t); -void *yyrealloc(void *, yy_size_t); -void yyfree(void *); +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); /* Begin user sect3 */ -#define yywrap() (/*CONSTCOND*/ 1) +#define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP extern int yylineno; @@ -234,31 +235,31 @@ extern char *yytext; /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy(void); +int yylex_destroy ( void ); -int yyget_debug(void); +int yyget_debug ( void ); -void yyset_debug(int debug_flag); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE yyget_extra(void); +YY_EXTRA_TYPE yyget_extra ( void ); -void yyset_extra(YY_EXTRA_TYPE user_defined); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *yyget_in(void); +FILE *yyget_in ( void ); -void yyset_in(FILE *_in_str); +void yyset_in ( FILE * _in_str ); -FILE *yyget_out(void); +FILE *yyget_out ( void ); -void yyset_out(FILE *_out_str); +void yyset_out ( FILE * _out_str ); -yy_size_t yyget_leng(void); + yy_size_t yyget_leng ( void ); -char *yyget_text(void); +char *yyget_text ( void ); -int yyget_lineno(void); +int yyget_lineno ( void ); -void yyset_lineno(int _line_number); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -266,18 +267,18 @@ void yyset_lineno(int _line_number); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap(void); +extern "C" int yywrap ( void ); #else -extern int yywrap(void); +extern int yywrap ( void ); #endif #endif #ifndef yytext_ptr -static void yy_flex_strncpy(char *, const char *, int); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen(const char *); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT @@ -305,9 +306,9 @@ static int yy_flex_strlen(const char *); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex(void); +extern int yylex (void); -#define YY_DECL int yylex(void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* yy_get_previous_state - get the state just before the EOB char was reached */ @@ -469,7 +470,8 @@ extern int yylex(void); #undef yyTABLES_NAME #endif -#line 47 "lexer.l" +#line 137 "../lexer.l" + #line 476 "lexer.h" #undef yyIN_HEADER diff --git a/source/adios2/toolkit/derived/parser/pregen-source/location.hh b/source/adios2/toolkit/derived/parser/pregen-source/location.hh new file mode 100644 index 0000000000..923c49c812 --- /dev/null +++ b/source/adios2/toolkit/derived/parser/pregen-source/location.hh @@ -0,0 +1,306 @@ +// A Bison parser, made by GNU Bison 3.8.2. + +// Locations for Bison parsers in C++ + +// Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file location.hh + ** Define the adios2::detail::location class. + */ + +#ifndef YY_YY_LOCATION_HH_INCLUDED +# define YY_YY_LOCATION_HH_INCLUDED + +# include +# include + +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +#line 6 "../parser.y" +namespace adios2 { namespace detail { +#line 59 "location.hh" + + /// A point in a source file. + class position + { + public: + /// Type for file name. + typedef const std::string filename_type; + /// Type for line and column numbers. + typedef int counter_type; + + /// Construct a position. + explicit position (filename_type* f = YY_NULLPTR, + counter_type l = 1, + counter_type c = 1) + : filename (f) + , line (l) + , column (c) + {} + + + /// Initialization. + void initialize (filename_type* fn = YY_NULLPTR, + counter_type l = 1, + counter_type c = 1) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (counter_type count = 1) + { + if (count) + { + column = 1; + line = add_ (line, count, 1); + } + } + + /// (column related) Advance to the COUNT next columns. + void columns (counter_type count = 1) + { + column = add_ (column, count, 1); + } + /** \} */ + + /// File name to which this position refers. + filename_type* filename; + /// Current line number. + counter_type line; + /// Current column number. + counter_type column; + + private: + /// Compute max (min, lhs+rhs). + static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min) + { + return lhs + rhs < min ? min : lhs + rhs; + } + }; + + /// Add \a width columns, in place. + inline position& + operator+= (position& res, position::counter_type width) + { + res.columns (width); + return res; + } + + /// Add \a width columns. + inline position + operator+ (position res, position::counter_type width) + { + return res += width; + } + + /// Subtract \a width columns, in place. + inline position& + operator-= (position& res, position::counter_type width) + { + return res += -width; + } + + /// Subtract \a width columns. + inline position + operator- (position res, position::counter_type width) + { + return res -= width; + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + /// Two points in a source file. + class location + { + public: + /// Type for file name. + typedef position::filename_type filename_type; + /// Type for line and column numbers. + typedef position::counter_type counter_type; + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + {} + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + {} + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (filename_type* f, + counter_type l = 1, + counter_type c = 1) + : begin (f, l, c) + , end (f, l, c) + {} + + + /// Initialization. + void initialize (filename_type* f = YY_NULLPTR, + counter_type l = 1, + counter_type c = 1) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (counter_type count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (counter_type count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two locations, in place. + inline location& + operator+= (location& res, const location& end) + { + res.end = end.end; + return res; + } + + /// Join two locations. + inline location + operator+ (location res, const location& end) + { + return res += end; + } + + /// Add \a width columns to the end position, in place. + inline location& + operator+= (location& res, location::counter_type width) + { + res.columns (width); + return res; + } + + /// Add \a width columns to the end position. + inline location + operator+ (location res, location::counter_type width) + { + return res += width; + } + + /// Subtract \a width columns to the end position, in place. + inline location& + operator-= (location& res, location::counter_type width) + { + return res += -width; + } + + /// Subtract \a width columns to the end position. + inline location + operator- (location res, location::counter_type width) + { + return res -= width; + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + location::counter_type end_col + = 0 < loc.end.column ? loc.end.column - 1 : 0; + ostr << loc.begin; + if (loc.end.filename + && (!loc.begin.filename + || *loc.begin.filename != *loc.end.filename)) + ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; + else if (loc.begin.line < loc.end.line) + ostr << '-' << loc.end.line << '.' << end_col; + else if (loc.begin.column < end_col) + ostr << '-' << end_col; + return ostr; + } + +#line 6 "../parser.y" +} } // adios2::detail +#line 305 "location.hh" + +#endif // !YY_YY_LOCATION_HH_INCLUDED diff --git a/source/adios2/toolkit/derived/parser/pregen-source/parser.cpp b/source/adios2/toolkit/derived/parser/pregen-source/parser.cpp new file mode 100644 index 0000000000..e11401c54d --- /dev/null +++ b/source/adios2/toolkit/derived/parser/pregen-source/parser.cpp @@ -0,0 +1,1414 @@ +// A Bison parser, made by GNU Bison 3.8.2. + +// Skeleton implementation for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, +// especially those whose name start with YY_ or yy_. They are +// private implementation details that can be changed or removed. + + + + + +#include "parser.h" + + +// Unqualified %code blocks. +#line 33 "../parser.y" + +#include "ASTDriver.h" +#include "ASTNode.h" + +#line 51 "parser.cpp" + + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include // FIXME: INFRINGES ON USER NAME SPACE. +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + + +// Whether we are compiled with exception support. +#ifndef YY_EXCEPTIONS +# if defined __GNUC__ && !defined __EXCEPTIONS +# define YY_EXCEPTIONS 0 +# else +# define YY_EXCEPTIONS 1 +# endif +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +# ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (false) +# endif + + +// Enable debugging if requested. +#if YYDEBUG + +// A pseudo ostream that takes yydebug_ into account. +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Symbol) \ + do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_print_ (*yycdebug_, Symbol); \ + *yycdebug_ << '\n'; \ + } \ + } while (false) + +# define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ + } while (false) + +# define YY_STACK_PRINT() \ + do { \ + if (yydebug_) \ + yy_stack_print_ (); \ + } while (false) + +#else // !YYDEBUG + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol) +# define YY_REDUCE_PRINT(Rule) static_cast (0) +# define YY_STACK_PRINT() static_cast (0) + +#endif // !YYDEBUG + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yyla.clear ()) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + +#line 6 "../parser.y" +namespace adios2 { namespace detail { +#line 144 "parser.cpp" + + /// Build a parser object. + parser::parser (ASTDriver& drv_yyarg) +#if YYDEBUG + : yydebug_ (false), + yycdebug_ (&std::cerr), +#else + : +#endif + yy_lac_established_ (false), + drv (drv_yyarg) + {} + + parser::~parser () + {} + + parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW + {} + + /*---------. + | symbol. | + `---------*/ + + + + // by_state. + parser::by_state::by_state () YY_NOEXCEPT + : state (empty_state) + {} + + parser::by_state::by_state (const by_state& that) YY_NOEXCEPT + : state (that.state) + {} + + void + parser::by_state::clear () YY_NOEXCEPT + { + state = empty_state; + } + + void + parser::by_state::move (by_state& that) + { + state = that.state; + that.clear (); + } + + parser::by_state::by_state (state_type s) YY_NOEXCEPT + : state (s) + {} + + parser::symbol_kind_type + parser::by_state::kind () const YY_NOEXCEPT + { + if (state == empty_state) + return symbol_kind::S_YYEMPTY; + else + return YY_CAST (symbol_kind_type, yystos_[+state]); + } + + parser::stack_symbol_type::stack_symbol_type () + {} + + parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that) + : super_type (YY_MOVE (that.state), YY_MOVE (that.location)) + { + switch (that.kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.YY_MOVE_OR_COPY< int > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_index: // index + value.YY_MOVE_OR_COPY< std::tuple > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_indices_list: // indices_list + value.YY_MOVE_OR_COPY< std::vector> > (YY_MOVE (that.value)); + break; + + default: + break; + } + +#if 201103L <= YY_CPLUSPLUS + // that is emptied. + that.state = empty_state; +#endif + } + + parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that) + : super_type (s, YY_MOVE (that.location)) + { + switch (that.kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.move< int > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.move< std::string > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_index: // index + value.move< std::tuple > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_indices_list: // indices_list + value.move< std::vector> > (YY_MOVE (that.value)); + break; + + default: + break; + } + + // that is emptied. + that.kind_ = symbol_kind::S_YYEMPTY; + } + +#if YY_CPLUSPLUS < 201103L + parser::stack_symbol_type& + parser::stack_symbol_type::operator= (const stack_symbol_type& that) + { + state = that.state; + switch (that.kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.copy< int > (that.value); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.copy< std::string > (that.value); + break; + + case symbol_kind::S_index: // index + value.copy< std::tuple > (that.value); + break; + + case symbol_kind::S_indices_list: // indices_list + value.copy< std::vector> > (that.value); + break; + + default: + break; + } + + location = that.location; + return *this; + } + + parser::stack_symbol_type& + parser::stack_symbol_type::operator= (stack_symbol_type& that) + { + state = that.state; + switch (that.kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.move< int > (that.value); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.move< std::string > (that.value); + break; + + case symbol_kind::S_index: // index + value.move< std::tuple > (that.value); + break; + + case symbol_kind::S_indices_list: // indices_list + value.move< std::vector> > (that.value); + break; + + default: + break; + } + + location = that.location; + // that is emptied. + that.state = empty_state; + return *this; + } +#endif + + template + void + parser::yy_destroy_ (const char* yymsg, basic_symbol& yysym) const + { + if (yymsg) + YY_SYMBOL_PRINT (yymsg, yysym); + } + +#if YYDEBUG + template + void + parser::yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const + { + std::ostream& yyoutput = yyo; + YY_USE (yyoutput); + if (yysym.empty ()) + yyo << "empty symbol"; + else + { + symbol_kind_type yykind = yysym.kind (); + yyo << (yykind < YYNTOKENS ? "token" : "nterm") + << ' ' << yysym.name () << " (" + << yysym.location << ": "; + YY_USE (yykind); + yyo << ')'; + } + } +#endif + + void + parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym) + { + if (m) + YY_SYMBOL_PRINT (m, sym); + yystack_.push (YY_MOVE (sym)); + } + + void + parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym) + { +#if 201103L <= YY_CPLUSPLUS + yypush_ (m, stack_symbol_type (s, std::move (sym))); +#else + stack_symbol_type ss (s, sym); + yypush_ (m, ss); +#endif + } + + void + parser::yypop_ (int n) YY_NOEXCEPT + { + yystack_.pop (n); + } + +#if YYDEBUG + std::ostream& + parser::debug_stream () const + { + return *yycdebug_; + } + + void + parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + parser::debug_level_type + parser::debug_level () const + { + return yydebug_; + } + + void + parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif // YYDEBUG + + parser::state_type + parser::yy_lr_goto_state_ (state_type yystate, int yysym) + { + int yyr = yypgoto_[yysym - YYNTOKENS] + yystate; + if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + return yytable_[yyr]; + else + return yydefgoto_[yysym - YYNTOKENS]; + } + + bool + parser::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT + { + return yyvalue == yypact_ninf_; + } + + bool + parser::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT + { + return yyvalue == yytable_ninf_; + } + + int + parser::operator() () + { + return parse (); + } + + int + parser::parse () + { + int yyn; + /// Length of the RHS of the rule being reduced. + int yylen = 0; + + // Error handling. + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// The lookahead symbol. + symbol_type yyla; + + /// The locations where the error started and ended. + stack_symbol_type yyerror_range[3]; + + /// The return value of parse (). + int yyresult; + + // Discard the LAC context in case there still is one left from a + // previous invocation. + yy_lac_discard_ ("init"); + +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + YYCDEBUG << "Starting parse\n"; + + + /* Initialize the stack. The initial state will be set in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystack_.clear (); + yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla)); + + /*-----------------------------------------------. + | yynewstate -- push a new symbol on the stack. | + `-----------------------------------------------*/ + yynewstate: + YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n'; + YY_STACK_PRINT (); + + // Accept? + if (yystack_[0].state == yyfinal_) + YYACCEPT; + + goto yybackup; + + + /*-----------. + | yybackup. | + `-----------*/ + yybackup: + // Try to take a decision without lookahead. + yyn = yypact_[+yystack_[0].state]; + if (yy_pact_value_is_default_ (yyn)) + goto yydefault; + + // Read a lookahead token. + if (yyla.empty ()) + { + YYCDEBUG << "Reading a token\n"; +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + symbol_type yylookahead (yylex (drv)); + yyla.move (yylookahead); + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error (yyexc); + goto yyerrlab1; + } +#endif // YY_EXCEPTIONS + } + YY_SYMBOL_PRINT ("Next token is", yyla); + + if (yyla.kind () == symbol_kind::S_YYerror) + { + // The scanner already issued an error message, process directly + // to error recovery. But do not keep the error token as + // lookahead, it is too special and may lead us to an endless + // loop in error recovery. */ + yyla.kind_ = symbol_kind::S_YYUNDEF; + goto yyerrlab1; + } + + /* If the proper action on seeing token YYLA.TYPE is to reduce or + to detect an error, take that action. */ + yyn += yyla.kind (); + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ()) + { + if (!yy_lac_establish_ (yyla.kind ())) + goto yyerrlab; + goto yydefault; + } + + // Reduce or error. + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; + if (!yy_lac_establish_ (yyla.kind ())) + goto yyerrlab; + + yyn = -yyn; + goto yyreduce; + } + + // Count tokens shifted since error; after three, turn off error status. + if (yyerrstatus_) + --yyerrstatus_; + + // Shift the lookahead token. + yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla)); + yy_lac_discard_ ("shift"); + goto yynewstate; + + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[+yystack_[0].state]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + + /*-----------------------------. + | yyreduce -- do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + { + stack_symbol_type yylhs; + yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]); + /* Variants are always initialized to an empty instance of the + correct type. The default '$$ = $1' action is NOT applied + when using variants. */ + switch (yyr1_[yyn]) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + yylhs.value.emplace< int > (); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + yylhs.value.emplace< std::string > (); + break; + + case symbol_kind::S_index: // index + yylhs.value.emplace< std::tuple > (); + break; + + case symbol_kind::S_indices_list: // indices_list + yylhs.value.emplace< std::vector> > (); + break; + + default: + break; + } + + + // Default location. + { + stack_type::slice range (yystack_, yylen); + YYLLOC_DEFAULT (yylhs.location, range, yylen); + yyerror_range[1].location = yylhs.location; + } + + // Perform the reduction. + YY_REDUCE_PRINT (yyn); +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + switch (yyn) + { + case 2: // lines: assignment lines +#line 61 "../parser.y" + {} +#line 644 "parser.cpp" + break; + + case 3: // lines: exp +#line 62 "../parser.y" + {} +#line 650 "parser.cpp" + break; + + case 4: // assignment: "identifier" "=" VARNAME +#line 66 "../parser.y" + { drv.add_lookup_entry(yystack_[2].value.as < std::string > (), yystack_[0].value.as < std::string > ()); } +#line 656 "parser.cpp" + break; + + case 5: // assignment: "identifier" "=" "identifier" +#line 67 "../parser.y" + { drv.add_lookup_entry(yystack_[2].value.as < std::string > (), yystack_[0].value.as < std::string > ()); } +#line 662 "parser.cpp" + break; + + case 6: // assignment: "identifier" "=" VARNAME "[" indices_list "]" +#line 68 "../parser.y" + { drv.add_lookup_entry(yystack_[5].value.as < std::string > (), yystack_[3].value.as < std::string > (), yystack_[1].value.as < std::vector> > ()); } +#line 668 "parser.cpp" + break; + + case 7: // assignment: "identifier" "=" "identifier" "[" indices_list "]" +#line 69 "../parser.y" + { drv.add_lookup_entry(yystack_[5].value.as < std::string > (), yystack_[3].value.as < std::string > (), yystack_[1].value.as < std::vector> > ()); } +#line 674 "parser.cpp" + break; + + case 8: // exp: "number" +#line 73 "../parser.y" + { } +#line 680 "parser.cpp" + break; + + case 9: // exp: exp OPERATOR exp +#line 74 "../parser.y" + { drv.createNode(yystack_[1].value.as < std::string > (), 2); } +#line 686 "parser.cpp" + break; + + case 10: // exp: "(" exp ")" +#line 75 "../parser.y" + { } +#line 692 "parser.cpp" + break; + + case 11: // exp: "identifier" "(" list ")" +#line 76 "../parser.y" + { drv.createNode(yystack_[3].value.as < std::string > (), yystack_[1].value.as < int > ()); } +#line 698 "parser.cpp" + break; + + case 12: // exp: "identifier" "[" indices_list "]" +#line 77 "../parser.y" + { drv.createNode(yystack_[3].value.as < std::string > (), yystack_[1].value.as < std::vector> > ()); } +#line 704 "parser.cpp" + break; + + case 13: // exp: "identifier" +#line 78 "../parser.y" + { drv.createNode(yystack_[0].value.as < std::string > ()); } +#line 710 "parser.cpp" + break; + + case 14: // indices_list: %empty +#line 83 "../parser.y" + { yylhs.value.as < std::vector> > () = {}; } +#line 716 "parser.cpp" + break; + + case 15: // indices_list: indices_list "," index +#line 84 "../parser.y" + { yystack_[2].value.as < std::vector> > ().push_back(yystack_[0].value.as < std::tuple > ()); yylhs.value.as < std::vector> > () = yystack_[2].value.as < std::vector> > (); } +#line 722 "parser.cpp" + break; + + case 16: // indices_list: index +#line 85 "../parser.y" + { yylhs.value.as < std::vector> > () = {yystack_[0].value.as < std::tuple > ()}; } +#line 728 "parser.cpp" + break; + + case 17: // index: %empty +#line 89 "../parser.y" + { yylhs.value.as < std::tuple > () = {-1, -1, 1}; } +#line 734 "parser.cpp" + break; + + case 18: // index: "number" ":" "number" ":" "number" +#line 90 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[4].value.as < int > (), yystack_[2].value.as < int > (), yystack_[0].value.as < int > ()}; } +#line 740 "parser.cpp" + break; + + case 19: // index: ":" "number" ":" "number" +#line 91 "../parser.y" + { yylhs.value.as < std::tuple > () = {-1, yystack_[2].value.as < int > (), yystack_[0].value.as < int > ()}; } +#line 746 "parser.cpp" + break; + + case 20: // index: "number" ":" ":" "number" +#line 92 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[3].value.as < int > (), -1, yystack_[0].value.as < int > ()}; } +#line 752 "parser.cpp" + break; + + case 21: // index: "number" ":" "number" ":" +#line 93 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[3].value.as < int > (), yystack_[1].value.as < int > (), 1}; } +#line 758 "parser.cpp" + break; + + case 22: // index: "number" ":" "number" +#line 94 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[2].value.as < int > (), yystack_[0].value.as < int > (), 1}; } +#line 764 "parser.cpp" + break; + + case 23: // index: ":" ":" "number" +#line 95 "../parser.y" + { yylhs.value.as < std::tuple > () = {-1, -1, yystack_[0].value.as < int > ()}; } +#line 770 "parser.cpp" + break; + + case 24: // index: ":" "number" ":" +#line 96 "../parser.y" + { yylhs.value.as < std::tuple > () = {-1, yystack_[1].value.as < int > (), 1}; } +#line 776 "parser.cpp" + break; + + case 25: // index: ":" "number" +#line 97 "../parser.y" + { yylhs.value.as < std::tuple > () = {-1, yystack_[0].value.as < int > (), 1}; } +#line 782 "parser.cpp" + break; + + case 26: // index: "number" ":" ":" +#line 98 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[2].value.as < int > (), -1, 1}; } +#line 788 "parser.cpp" + break; + + case 27: // index: "number" ":" +#line 99 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[1].value.as < int > (), -1, 1}; } +#line 794 "parser.cpp" + break; + + case 28: // index: "number" +#line 100 "../parser.y" + { yylhs.value.as < std::tuple > () = {yystack_[0].value.as < int > (), yystack_[0].value.as < int > (), 1}; } +#line 800 "parser.cpp" + break; + + case 29: // list: %empty +#line 104 "../parser.y" + { yylhs.value.as < int > () = 0; } +#line 806 "parser.cpp" + break; + + case 30: // list: exp "," list +#line 105 "../parser.y" + { yylhs.value.as < int > () = yystack_[0].value.as < int > () + 1; } +#line 812 "parser.cpp" + break; + + case 31: // list: exp +#line 106 "../parser.y" + { yylhs.value.as < int > () = 1; } +#line 818 "parser.cpp" + break; + + +#line 822 "parser.cpp" + + default: + break; + } + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error (yyexc); + YYERROR; + } +#endif // YY_EXCEPTIONS + YY_SYMBOL_PRINT ("-> $$ =", yylhs); + yypop_ (yylen); + yylen = 0; + + // Shift the result of the reduction. + yypush_ (YY_NULLPTR, YY_MOVE (yylhs)); + } + goto yynewstate; + + + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ + yyerrlab: + // If not already recovering from an error, report this error. + if (!yyerrstatus_) + { + ++yynerrs_; + context yyctx (*this, yyla); + std::string msg = yysyntax_error_ (yyctx); + error (yyla.location, YY_MOVE (msg)); + } + + + yyerror_range[1].location = yyla.location; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + // Return failure if at end of input. + if (yyla.kind () == symbol_kind::S_YYEOF) + YYABORT; + else if (!yyla.empty ()) + { + yy_destroy_ ("Error: discarding", yyla); + yyla.clear (); + } + } + + // Else will try to reuse lookahead token after shifting the error token. + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and + the label yyerrorlab therefore never appears in user code. */ + if (false) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + goto yyerrlab1; + + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; // Each real token shifted decrements this. + // Pop stack until we find a state that shifts the error token. + for (;;) + { + yyn = yypact_[+yystack_[0].state]; + if (!yy_pact_value_is_default_ (yyn)) + { + yyn += symbol_kind::S_YYerror; + if (0 <= yyn && yyn <= yylast_ + && yycheck_[yyn] == symbol_kind::S_YYerror) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + // Pop the current state because it cannot handle the error token. + if (yystack_.size () == 1) + YYABORT; + + yyerror_range[1].location = yystack_[0].location; + yy_destroy_ ("Error: popping", yystack_[0]); + yypop_ (); + YY_STACK_PRINT (); + } + { + stack_symbol_type error_token; + + yyerror_range[2].location = yyla.location; + YYLLOC_DEFAULT (error_token.location, yyerror_range, 2); + + // Shift the error token. + yy_lac_discard_ ("error recovery"); + error_token.state = state_type (yyn); + yypush_ ("Shifting", YY_MOVE (error_token)); + } + goto yynewstate; + + + /*-------------------------------------. + | yyacceptlab -- YYACCEPT comes here. | + `-------------------------------------*/ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + + /*-----------------------------------. + | yyabortlab -- YYABORT comes here. | + `-----------------------------------*/ + yyabortlab: + yyresult = 1; + goto yyreturn; + + + /*-----------------------------------------------------. + | yyreturn -- parsing is finished, return the result. | + `-----------------------------------------------------*/ + yyreturn: + if (!yyla.empty ()) + yy_destroy_ ("Cleanup: discarding lookahead", yyla); + + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + YY_STACK_PRINT (); + while (1 < yystack_.size ()) + { + yy_destroy_ ("Cleanup: popping", yystack_[0]); + yypop_ (); + } + + return yyresult; + } +#if YY_EXCEPTIONS + catch (...) + { + YYCDEBUG << "Exception caught: cleaning lookahead and stack\n"; + // Do not try to display the values of the reclaimed symbols, + // as their printers might throw an exception. + if (!yyla.empty ()) + yy_destroy_ (YY_NULLPTR, yyla); + + while (1 < yystack_.size ()) + { + yy_destroy_ (YY_NULLPTR, yystack_[0]); + yypop_ (); + } + throw; + } +#endif // YY_EXCEPTIONS + } + + void + parser::error (const syntax_error& yyexc) + { + error (yyexc.location, yyexc.what ()); + } + + const char * + parser::symbol_name (symbol_kind_type yysymbol) + { + static const char *const yy_sname[] = + { + "end of file", "error", "invalid token", "=", ",", ":", "(", ")", "[", + "]", "OPERATOR", "identifier", "VARNAME", "number", "$accept", "lines", + "assignment", "exp", "indices_list", "index", "list", YY_NULLPTR + }; + return yy_sname[yysymbol]; + } + + + + // parser::context. + parser::context::context (const parser& yyparser, const symbol_type& yyla) + : yyparser_ (yyparser) + , yyla_ (yyla) + {} + + int + parser::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const + { + // Actual number of expected tokens + int yycount = 0; + +#if YYDEBUG + // Execute LAC once. We don't care if it is successful, we + // only do it for the sake of debugging output. + if (!yyparser_.yy_lac_established_) + yyparser_.yy_lac_check_ (yyla_.kind ()); +#endif + + for (int yyx = 0; yyx < YYNTOKENS; ++yyx) + { + symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx); + if (yysym != symbol_kind::S_YYerror + && yysym != symbol_kind::S_YYUNDEF + && yyparser_.yy_lac_check_ (yysym)) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = yysym; + } + } + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = symbol_kind::S_YYEMPTY; + return yycount; + } + + + + + bool + parser::yy_lac_check_ (symbol_kind_type yytoken) const + { + // Logically, the yylac_stack's lifetime is confined to this function. + // Clear it, to get rid of potential left-overs from previous call. + yylac_stack_.clear (); + // Reduce until we encounter a shift and thereby accept the token. +#if YYDEBUG + YYCDEBUG << "LAC: checking lookahead " << symbol_name (yytoken) << ':'; +#endif + std::ptrdiff_t lac_top = 0; + while (true) + { + state_type top_state = (yylac_stack_.empty () + ? yystack_[lac_top].state + : yylac_stack_.back ()); + int yyrule = yypact_[+top_state]; + if (yy_pact_value_is_default_ (yyrule) + || (yyrule += yytoken) < 0 || yylast_ < yyrule + || yycheck_[yyrule] != yytoken) + { + // Use the default action. + yyrule = yydefact_[+top_state]; + if (yyrule == 0) + { + YYCDEBUG << " Err\n"; + return false; + } + } + else + { + // Use the action from yytable. + yyrule = yytable_[yyrule]; + if (yy_table_value_is_error_ (yyrule)) + { + YYCDEBUG << " Err\n"; + return false; + } + if (0 < yyrule) + { + YYCDEBUG << " S" << yyrule << '\n'; + return true; + } + yyrule = -yyrule; + } + // By now we know we have to simulate a reduce. + YYCDEBUG << " R" << yyrule - 1; + // Pop the corresponding number of values from the stack. + { + std::ptrdiff_t yylen = yyr2_[yyrule]; + // First pop from the LAC stack as many tokens as possible. + std::ptrdiff_t lac_size = std::ptrdiff_t (yylac_stack_.size ()); + if (yylen < lac_size) + { + yylac_stack_.resize (std::size_t (lac_size - yylen)); + yylen = 0; + } + else if (lac_size) + { + yylac_stack_.clear (); + yylen -= lac_size; + } + // Only afterwards look at the main stack. + // We simulate popping elements by incrementing lac_top. + lac_top += yylen; + } + // Keep top_state in sync with the updated stack. + top_state = (yylac_stack_.empty () + ? yystack_[lac_top].state + : yylac_stack_.back ()); + // Push the resulting state of the reduction. + state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]); + YYCDEBUG << " G" << int (state); + yylac_stack_.push_back (state); + } + } + + // Establish the initial context if no initial context currently exists. + bool + parser::yy_lac_establish_ (symbol_kind_type yytoken) + { + /* Establish the initial context for the current lookahead if no initial + context is currently established. + + We define a context as a snapshot of the parser stacks. We define + the initial context for a lookahead as the context in which the + parser initially examines that lookahead in order to select a + syntactic action. Thus, if the lookahead eventually proves + syntactically unacceptable (possibly in a later context reached via a + series of reductions), the initial context can be used to determine + the exact set of tokens that would be syntactically acceptable in the + lookahead's place. Moreover, it is the context after which any + further semantic actions would be erroneous because they would be + determined by a syntactically unacceptable token. + + yy_lac_establish_ should be invoked when a reduction is about to be + performed in an inconsistent state (which, for the purposes of LAC, + includes consistent states that don't know they're consistent because + their default reductions have been disabled). + + For parse.lac=full, the implementation of yy_lac_establish_ is as + follows. If no initial context is currently established for the + current lookahead, then check if that lookahead can eventually be + shifted if syntactic actions continue from the current context. */ + if (yy_lac_established_) + return true; + else + { +#if YYDEBUG + YYCDEBUG << "LAC: initial context established for " + << symbol_name (yytoken) << '\n'; +#endif + yy_lac_established_ = true; + return yy_lac_check_ (yytoken); + } + } + + // Discard any previous initial lookahead context. + void + parser::yy_lac_discard_ (const char* event) + { + /* Discard any previous initial lookahead context because of Event, + which may be a lookahead change or an invalidation of the currently + established initial context for the current lookahead. + + The most common example of a lookahead change is a shift. An example + of both cases is syntax error recovery. That is, a syntax error + occurs when the lookahead is syntactically erroneous for the + currently established initial context, so error recovery manipulates + the parser stacks to try to find a new initial context in which the + current lookahead is syntactically acceptable. If it fails to find + such a context, it discards the lookahead. */ + if (yy_lac_established_) + { + YYCDEBUG << "LAC: initial context discarded due to " + << event << '\n'; + yy_lac_established_ = false; + } + } + + + int + parser::yy_syntax_error_arguments_ (const context& yyctx, + symbol_kind_type yyarg[], int yyargn) const + { + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yyla) is + if this state is a consistent state with a default action. + Thus, detecting the absence of a lookahead is sufficient to + determine that there is no unexpected or expected token to + report. In that case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is + a consistent state with a default action. There might have + been a previous inconsistent state, consistent state with a + non-default action, or user semantic action that manipulated + yyla. (However, yyla is currently not documented for users.) + In the first two cases, it might appear that the current syntax + error should have been detected in the previous state when + yy_lac_check was invoked. However, at that time, there might + have been a different syntax error that discarded a different + initial context during error recovery, leaving behind the + current lookahead. + */ + + if (!yyctx.lookahead ().empty ()) + { + if (yyarg) + yyarg[0] = yyctx.token (); + int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1); + return yyn + 1; + } + return 0; + } + + // Generate an error message. + std::string + parser::yysyntax_error_ (const context& yyctx) const + { + // Its maximum. + enum { YYARGS_MAX = 5 }; + // Arguments of yyformat. + symbol_kind_type yyarg[YYARGS_MAX]; + int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX); + + char const* yyformat = YY_NULLPTR; + switch (yycount) + { +#define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: // Avoid compiler warnings. + YYCASE_ (0, YY_("syntax error")); + YYCASE_ (1, YY_("syntax error, unexpected %s")); + YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +#undef YYCASE_ + } + + std::string yyres; + // Argument number. + std::ptrdiff_t yyi = 0; + for (char const* yyp = yyformat; *yyp; ++yyp) + if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) + { + yyres += symbol_name (yyarg[yyi++]); + ++yyp; + } + else + yyres += *yyp; + return yyres; + } + + + const signed char parser::yypact_ninf_ = -7; + + const signed char parser::yytable_ninf_ = -1; + + const signed char + parser::yypact_[] = + { + 6, 9, 22, -7, 5, 6, 13, 27, -6, -4, + 9, -3, -7, -7, 9, -7, 30, 31, 14, 24, + -2, 35, 12, -7, -7, -3, -3, 9, -7, 28, + 37, 1, -3, -7, 23, 25, -7, -7, 32, 33, + 38, -7, -7, -7, -7, -7, 34, -7 + }; + + const signed char + parser::yydefact_[] = + { + 0, 0, 13, 8, 0, 0, 3, 13, 0, 0, + 29, 14, 1, 2, 0, 10, 5, 4, 31, 0, + 0, 28, 0, 16, 9, 14, 14, 29, 11, 0, + 25, 27, 17, 12, 0, 0, 30, 23, 24, 26, + 22, 15, 7, 6, 19, 20, 21, 18 + }; + + const signed char + parser::yypgoto_[] = + { + -7, 39, -7, -1, 11, 16, 26 + }; + + const signed char + parser::yydefgoto_[] = + { + 0, 4, 5, 6, 22, 23, 19 + }; + + const signed char + parser::yytable_[] = + { + 8, 15, 20, 29, 14, 12, 39, 16, 17, 18, + 21, 30, 1, 24, 40, 1, 32, 2, 27, 3, + 7, 33, 3, 14, 14, 9, 18, 32, 10, 32, + 11, 28, 42, 10, 43, 11, 34, 35, 25, 26, + 31, 37, 38, 46, 13, 44, 45, 47, 41, 0, + 0, 0, 0, 36 + }; + + const signed char + parser::yycheck_[] = + { + 1, 7, 5, 5, 10, 0, 5, 11, 12, 10, + 13, 13, 6, 14, 13, 6, 4, 11, 4, 13, + 11, 9, 13, 10, 10, 3, 27, 4, 6, 4, + 8, 7, 9, 6, 9, 8, 25, 26, 8, 8, + 5, 13, 5, 5, 5, 13, 13, 13, 32, -1, + -1, -1, -1, 27 + }; + + const signed char + parser::yystos_[] = + { + 0, 6, 11, 13, 15, 16, 17, 11, 17, 3, + 6, 8, 0, 15, 10, 7, 11, 12, 17, 20, + 5, 13, 18, 19, 17, 8, 8, 4, 7, 5, + 13, 5, 4, 9, 18, 18, 20, 13, 5, 5, + 13, 19, 9, 9, 13, 13, 5, 13 + }; + + const signed char + parser::yyr1_[] = + { + 0, 14, 15, 15, 16, 16, 16, 16, 17, 17, + 17, 17, 17, 17, 18, 18, 18, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, + 20, 20 + }; + + const signed char + parser::yyr2_[] = + { + 0, 2, 2, 1, 3, 3, 6, 6, 1, 3, + 3, 4, 4, 1, 0, 3, 1, 0, 5, 4, + 4, 4, 3, 3, 3, 2, 3, 2, 1, 0, + 3, 1 + }; + + + + +#if YYDEBUG + const signed char + parser::yyrline_[] = + { + 0, 61, 61, 62, 66, 67, 68, 69, 73, 74, + 75, 76, 77, 78, 83, 84, 85, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 104, + 105, 106 + }; + + void + parser::yy_stack_print_ () const + { + *yycdebug_ << "Stack now"; + for (stack_type::const_iterator + i = yystack_.begin (), + i_end = yystack_.end (); + i != i_end; ++i) + *yycdebug_ << ' ' << int (i->state); + *yycdebug_ << '\n'; + } + + void + parser::yy_reduce_print_ (int yyrule) const + { + int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + // Print the symbols being reduced, and their result. + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):\n"; + // The symbols being reduced. + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yystack_[(yynrhs) - (yyi + 1)]); + } +#endif // YYDEBUG + + +#line 6 "../parser.y" +} } // adios2::detail +#line 1406 "parser.cpp" + +#line 107 "../parser.y" + + +void +adios2::detail::parser::error (const location_type& l, const std::string& m) +{ + std::cerr << l << ": " << m << '\n'; +} diff --git a/source/adios2/toolkit/derived/parser/pregen-source/parser.h b/source/adios2/toolkit/derived/parser/pregen-source/parser.h new file mode 100644 index 0000000000..819381e379 --- /dev/null +++ b/source/adios2/toolkit/derived/parser/pregen-source/parser.h @@ -0,0 +1,1609 @@ +// A Bison parser, made by GNU Bison 3.8.2. + +// Skeleton interface for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + + +/** + ** \file parser.h + ** Define the adios2::detail::parser class. + */ + +// C++ LALR(1) parser skeleton written by Akim Demaille. + +// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, +// especially those whose name start with YY_ or yy_. They are +// private implementation details that can be changed or removed. + +#ifndef YY_YY_PARSER_H_INCLUDED +# define YY_YY_PARSER_H_INCLUDED +// "%code requires" blocks. +#line 11 "../parser.y" + + #include + #include + #include + namespace adios2 + { + namespace detail + { + class ASTDriver; + } + } + +#line 62 "parser.h" + +# include +# include // std::abort +# include +# include +# include +# include + +#if defined __cplusplus +# define YY_CPLUSPLUS __cplusplus +#else +# define YY_CPLUSPLUS 199711L +#endif + +// Support move semantics when possible. +#if 201103L <= YY_CPLUSPLUS +# define YY_MOVE std::move +# define YY_MOVE_OR_COPY move +# define YY_MOVE_REF(Type) Type&& +# define YY_RVREF(Type) Type&& +# define YY_COPY(Type) Type +#else +# define YY_MOVE +# define YY_MOVE_OR_COPY copy +# define YY_MOVE_REF(Type) Type& +# define YY_RVREF(Type) const Type& +# define YY_COPY(Type) const Type& +#endif + +// Support noexcept when possible. +#if 201103L <= YY_CPLUSPLUS +# define YY_NOEXCEPT noexcept +# define YY_NOTHROW +#else +# define YY_NOEXCEPT +# define YY_NOTHROW throw () +#endif + +// Support constexpr when possible. +#if 201703 <= YY_CPLUSPLUS +# define YY_CONSTEXPR constexpr +#else +# define YY_CONSTEXPR +#endif +# include "location.hh" +#include +#ifndef YY_ASSERT +# include +# define YY_ASSERT assert +#endif + + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YY_USE(E) ((void) (E)) +#else +# define YY_USE(E) /* empty */ +#endif + +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +#line 6 "../parser.y" +namespace adios2 { namespace detail { +#line 203 "parser.h" + + + + + /// A Bison parser. + class parser + { + public: +#ifdef YYSTYPE +# ifdef __GNUC__ +# pragma GCC message "bison: do not #define YYSTYPE in C++, use %define api.value.type" +# endif + typedef YYSTYPE value_type; +#else + /// A buffer to store and retrieve objects. + /// + /// Sort of a variant, but does not keep track of the nature + /// of the stored data, since that knowledge is available + /// via the current parser state. + class value_type + { + public: + /// Type of *this. + typedef value_type self_type; + + /// Empty construction. + value_type () YY_NOEXCEPT + : yyraw_ () + , yytypeid_ (YY_NULLPTR) + {} + + /// Construct and fill. + template + value_type (YY_RVREF (T) t) + : yytypeid_ (&typeid (T)) + { + YY_ASSERT (sizeof (T) <= size); + new (yyas_ ()) T (YY_MOVE (t)); + } + +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + value_type (const self_type&) = delete; + /// Non copyable. + self_type& operator= (const self_type&) = delete; +#endif + + /// Destruction, allowed only if empty. + ~value_type () YY_NOEXCEPT + { + YY_ASSERT (!yytypeid_); + } + +# if 201103L <= YY_CPLUSPLUS + /// Instantiate a \a T in here from \a t. + template + T& + emplace (U&&... u) + { + YY_ASSERT (!yytypeid_); + YY_ASSERT (sizeof (T) <= size); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (std::forward (u)...); + } +# else + /// Instantiate an empty \a T in here. + template + T& + emplace () + { + YY_ASSERT (!yytypeid_); + YY_ASSERT (sizeof (T) <= size); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (); + } + + /// Instantiate a \a T in here from \a t. + template + T& + emplace (const T& t) + { + YY_ASSERT (!yytypeid_); + YY_ASSERT (sizeof (T) <= size); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (t); + } +# endif + + /// Instantiate an empty \a T in here. + /// Obsolete, use emplace. + template + T& + build () + { + return emplace (); + } + + /// Instantiate a \a T in here from \a t. + /// Obsolete, use emplace. + template + T& + build (const T& t) + { + return emplace (t); + } + + /// Accessor to a built \a T. + template + T& + as () YY_NOEXCEPT + { + YY_ASSERT (yytypeid_); + YY_ASSERT (*yytypeid_ == typeid (T)); + YY_ASSERT (sizeof (T) <= size); + return *yyas_ (); + } + + /// Const accessor to a built \a T (for %printer). + template + const T& + as () const YY_NOEXCEPT + { + YY_ASSERT (yytypeid_); + YY_ASSERT (*yytypeid_ == typeid (T)); + YY_ASSERT (sizeof (T) <= size); + return *yyas_ (); + } + + /// Swap the content with \a that, of same type. + /// + /// Both variants must be built beforehand, because swapping the actual + /// data requires reading it (with as()), and this is not possible on + /// unconstructed variants: it would require some dynamic testing, which + /// should not be the variant's responsibility. + /// Swapping between built and (possibly) non-built is done with + /// self_type::move (). + template + void + swap (self_type& that) YY_NOEXCEPT + { + YY_ASSERT (yytypeid_); + YY_ASSERT (*yytypeid_ == *that.yytypeid_); + std::swap (as (), that.as ()); + } + + /// Move the content of \a that to this. + /// + /// Destroys \a that. + template + void + move (self_type& that) + { +# if 201103L <= YY_CPLUSPLUS + emplace (std::move (that.as ())); +# else + emplace (); + swap (that); +# endif + that.destroy (); + } + +# if 201103L <= YY_CPLUSPLUS + /// Move the content of \a that to this. + template + void + move (self_type&& that) + { + emplace (std::move (that.as ())); + that.destroy (); + } +#endif + + /// Copy the content of \a that to this. + template + void + copy (const self_type& that) + { + emplace (that.as ()); + } + + /// Destroy the stored \a T. + template + void + destroy () + { + as ().~T (); + yytypeid_ = YY_NULLPTR; + } + + private: +#if YY_CPLUSPLUS < 201103L + /// Non copyable. + value_type (const self_type&); + /// Non copyable. + self_type& operator= (const self_type&); +#endif + + /// Accessor to raw memory as \a T. + template + T* + yyas_ () YY_NOEXCEPT + { + void *yyp = yyraw_; + return static_cast (yyp); + } + + /// Const accessor to raw memory as \a T. + template + const T* + yyas_ () const YY_NOEXCEPT + { + const void *yyp = yyraw_; + return static_cast (yyp); + } + + /// An auxiliary type to compute the largest semantic type. + union union_type + { + // "number" + // list + char dummy1[sizeof (int)]; + + // OPERATOR + // "identifier" + // VARNAME + char dummy2[sizeof (std::string)]; + + // index + char dummy3[sizeof (std::tuple)]; + + // indices_list + char dummy4[sizeof (std::vector>)]; + }; + + /// The size of the largest semantic type. + enum { size = sizeof (union_type) }; + + /// A buffer to store semantic values. + union + { + /// Strongest alignment constraints. + long double yyalign_me_; + /// A buffer large enough to store any of the semantic values. + char yyraw_[size]; + }; + + /// Whether the content is built: if defined, the name of the stored type. + const std::type_info *yytypeid_; + }; + +#endif + /// Backward compatibility (Bison 3.8). + typedef value_type semantic_type; + + /// Symbol locations. + typedef location location_type; + + /// Syntax errors thrown from user actions. + struct syntax_error : std::runtime_error + { + syntax_error (const location_type& l, const std::string& m) + : std::runtime_error (m) + , location (l) + {} + + syntax_error (const syntax_error& s) + : std::runtime_error (s.what ()) + , location (s.location) + {} + + ~syntax_error () YY_NOEXCEPT YY_NOTHROW; + + location_type location; + }; + + /// Token kinds. + struct token + { + enum token_kind_type + { + TOK_YYEMPTY = -2, + TOK_YYEOF = 0, // "end of file" + TOK_YYerror = 1, // error + TOK_YYUNDEF = 2, // "invalid token" + TOK_ASSIGN = 3, // "=" + TOK_COMMA = 4, // "," + TOK_COLON = 5, // ":" + TOK_L_PAREN = 6, // "(" + TOK_R_PAREN = 7, // ")" + TOK_L_BRACE = 8, // "[" + TOK_R_BRACE = 9, // "]" + TOK_OPERATOR = 10, // OPERATOR + TOK_IDENTIFIER = 11, // "identifier" + TOK_VARNAME = 12, // VARNAME + TOK_INT = 13 // "number" + }; + /// Backward compatibility alias (Bison 3.6). + typedef token_kind_type yytokentype; + }; + + /// Token kind, as returned by yylex. + typedef token::token_kind_type token_kind_type; + + /// Backward compatibility alias (Bison 3.6). + typedef token_kind_type token_type; + + /// Symbol kinds. + struct symbol_kind + { + enum symbol_kind_type + { + YYNTOKENS = 14, ///< Number of tokens. + S_YYEMPTY = -2, + S_YYEOF = 0, // "end of file" + S_YYerror = 1, // error + S_YYUNDEF = 2, // "invalid token" + S_ASSIGN = 3, // "=" + S_COMMA = 4, // "," + S_COLON = 5, // ":" + S_L_PAREN = 6, // "(" + S_R_PAREN = 7, // ")" + S_L_BRACE = 8, // "[" + S_R_BRACE = 9, // "]" + S_OPERATOR = 10, // OPERATOR + S_IDENTIFIER = 11, // "identifier" + S_VARNAME = 12, // VARNAME + S_INT = 13, // "number" + S_YYACCEPT = 14, // $accept + S_lines = 15, // lines + S_assignment = 16, // assignment + S_exp = 17, // exp + S_indices_list = 18, // indices_list + S_index = 19, // index + S_list = 20 // list + }; + }; + + /// (Internal) symbol kind. + typedef symbol_kind::symbol_kind_type symbol_kind_type; + + /// The number of tokens. + static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS; + + /// A complete symbol. + /// + /// Expects its Base type to provide access to the symbol kind + /// via kind (). + /// + /// Provide access to semantic value and location. + template + struct basic_symbol : Base + { + /// Alias to Base. + typedef Base super_type; + + /// Default constructor. + basic_symbol () YY_NOEXCEPT + : value () + , location () + {} + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + basic_symbol (basic_symbol&& that) + : Base (std::move (that)) + , value () + , location (std::move (that.location)) + { + switch (this->kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.move< int > (std::move (that.value)); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.move< std::string > (std::move (that.value)); + break; + + case symbol_kind::S_index: // index + value.move< std::tuple > (std::move (that.value)); + break; + + case symbol_kind::S_indices_list: // indices_list + value.move< std::vector> > (std::move (that.value)); + break; + + default: + break; + } + + } +#endif + + /// Copy constructor. + basic_symbol (const basic_symbol& that); + + /// Constructors for typed symbols. +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, location_type&& l) + : Base (t) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const location_type& l) + : Base (t) + , location (l) + {} +#endif + +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, int&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const int& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif + +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif + +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, std::tuple&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const std::tuple& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif + +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, std::vector>&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const std::vector>& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif + + /// Destroy the symbol. + ~basic_symbol () + { + clear (); + } + + + + /// Destroy contents, and record that is empty. + void clear () YY_NOEXCEPT + { + // User destructor. + symbol_kind_type yykind = this->kind (); + basic_symbol& yysym = *this; + (void) yysym; + switch (yykind) + { + default: + break; + } + + // Value type destructor. +switch (yykind) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.template destroy< int > (); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.template destroy< std::string > (); + break; + + case symbol_kind::S_index: // index + value.template destroy< std::tuple > (); + break; + + case symbol_kind::S_indices_list: // indices_list + value.template destroy< std::vector> > (); + break; + + default: + break; + } + + Base::clear (); + } + + /// The user-facing name of this symbol. + const char *name () const YY_NOEXCEPT + { + return parser::symbol_name (this->kind ()); + } + + /// Backward compatibility (Bison 3.6). + symbol_kind_type type_get () const YY_NOEXCEPT; + + /// Whether empty. + bool empty () const YY_NOEXCEPT; + + /// Destructive move, \a s is emptied into this. + void move (basic_symbol& s); + + /// The semantic value. + value_type value; + + /// The location. + location_type location; + + private: +#if YY_CPLUSPLUS < 201103L + /// Assignment operator. + basic_symbol& operator= (const basic_symbol& that); +#endif + }; + + /// Type access provider for token (enum) based symbols. + struct by_kind + { + /// The symbol kind as needed by the constructor. + typedef token_kind_type kind_type; + + /// Default constructor. + by_kind () YY_NOEXCEPT; + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + by_kind (by_kind&& that) YY_NOEXCEPT; +#endif + + /// Copy constructor. + by_kind (const by_kind& that) YY_NOEXCEPT; + + /// Constructor from (external) token numbers. + by_kind (kind_type t) YY_NOEXCEPT; + + + + /// Record that this symbol is empty. + void clear () YY_NOEXCEPT; + + /// Steal the symbol kind from \a that. + void move (by_kind& that); + + /// The (internal) type number (corresponding to \a type). + /// \a empty when empty. + symbol_kind_type kind () const YY_NOEXCEPT; + + /// Backward compatibility (Bison 3.6). + symbol_kind_type type_get () const YY_NOEXCEPT; + + /// The symbol kind. + /// \a S_YYEMPTY when empty. + symbol_kind_type kind_; + }; + + /// Backward compatibility for a private implementation detail (Bison 3.6). + typedef by_kind by_type; + + /// "External" symbols: returned by the scanner. + struct symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + + /// Empty symbol. + symbol_type () YY_NOEXCEPT {} + + /// Constructor for valueless symbols, and symbols from each type. +#if 201103L <= YY_CPLUSPLUS + symbol_type (int tok, location_type l) + : super_type (token_kind_type (tok), std::move (l)) +#else + symbol_type (int tok, const location_type& l) + : super_type (token_kind_type (tok), l) +#endif + { +#if !defined _MSC_VER || defined __clang__ + YY_ASSERT (tok == token::TOK_YYEOF + || (token::TOK_YYerror <= tok && tok <= token::TOK_R_BRACE)); +#endif + } +#if 201103L <= YY_CPLUSPLUS + symbol_type (int tok, int v, location_type l) + : super_type (token_kind_type (tok), std::move (v), std::move (l)) +#else + symbol_type (int tok, const int& v, const location_type& l) + : super_type (token_kind_type (tok), v, l) +#endif + { +#if !defined _MSC_VER || defined __clang__ + YY_ASSERT (tok == token::TOK_INT); +#endif + } +#if 201103L <= YY_CPLUSPLUS + symbol_type (int tok, std::string v, location_type l) + : super_type (token_kind_type (tok), std::move (v), std::move (l)) +#else + symbol_type (int tok, const std::string& v, const location_type& l) + : super_type (token_kind_type (tok), v, l) +#endif + { +#if !defined _MSC_VER || defined __clang__ + YY_ASSERT ((token::TOK_OPERATOR <= tok && tok <= token::TOK_VARNAME)); +#endif + } + }; + + /// Build a parser object. + parser (ASTDriver& drv_yyarg); + virtual ~parser (); + +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + parser (const parser&) = delete; + /// Non copyable. + parser& operator= (const parser&) = delete; +#endif + + /// Parse. An alias for parse (). + /// \returns 0 iff parsing succeeded. + int operator() (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const YY_ATTRIBUTE_PURE; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const YY_ATTRIBUTE_PURE; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Report a syntax error. + void error (const syntax_error& err); + + /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static const char *symbol_name (symbol_kind_type yysymbol); + + // Implementation of make_symbol for each token kind. +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_YYEOF (location_type l) + { + return symbol_type (token::TOK_YYEOF, std::move (l)); + } +#else + static + symbol_type + make_YYEOF (const location_type& l) + { + return symbol_type (token::TOK_YYEOF, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_YYerror (location_type l) + { + return symbol_type (token::TOK_YYerror, std::move (l)); + } +#else + static + symbol_type + make_YYerror (const location_type& l) + { + return symbol_type (token::TOK_YYerror, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_YYUNDEF (location_type l) + { + return symbol_type (token::TOK_YYUNDEF, std::move (l)); + } +#else + static + symbol_type + make_YYUNDEF (const location_type& l) + { + return symbol_type (token::TOK_YYUNDEF, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ASSIGN (location_type l) + { + return symbol_type (token::TOK_ASSIGN, std::move (l)); + } +#else + static + symbol_type + make_ASSIGN (const location_type& l) + { + return symbol_type (token::TOK_ASSIGN, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_COMMA (location_type l) + { + return symbol_type (token::TOK_COMMA, std::move (l)); + } +#else + static + symbol_type + make_COMMA (const location_type& l) + { + return symbol_type (token::TOK_COMMA, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_COLON (location_type l) + { + return symbol_type (token::TOK_COLON, std::move (l)); + } +#else + static + symbol_type + make_COLON (const location_type& l) + { + return symbol_type (token::TOK_COLON, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_L_PAREN (location_type l) + { + return symbol_type (token::TOK_L_PAREN, std::move (l)); + } +#else + static + symbol_type + make_L_PAREN (const location_type& l) + { + return symbol_type (token::TOK_L_PAREN, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_R_PAREN (location_type l) + { + return symbol_type (token::TOK_R_PAREN, std::move (l)); + } +#else + static + symbol_type + make_R_PAREN (const location_type& l) + { + return symbol_type (token::TOK_R_PAREN, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_L_BRACE (location_type l) + { + return symbol_type (token::TOK_L_BRACE, std::move (l)); + } +#else + static + symbol_type + make_L_BRACE (const location_type& l) + { + return symbol_type (token::TOK_L_BRACE, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_R_BRACE (location_type l) + { + return symbol_type (token::TOK_R_BRACE, std::move (l)); + } +#else + static + symbol_type + make_R_BRACE (const location_type& l) + { + return symbol_type (token::TOK_R_BRACE, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_OPERATOR (std::string v, location_type l) + { + return symbol_type (token::TOK_OPERATOR, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_OPERATOR (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_OPERATOR, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IDENTIFIER (std::string v, location_type l) + { + return symbol_type (token::TOK_IDENTIFIER, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IDENTIFIER (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IDENTIFIER, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_VARNAME (std::string v, location_type l) + { + return symbol_type (token::TOK_VARNAME, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_VARNAME (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_VARNAME, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_INT (int v, location_type l) + { + return symbol_type (token::TOK_INT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_INT (const int& v, const location_type& l) + { + return symbol_type (token::TOK_INT, v, l); + } +#endif + + + class context + { + public: + context (const parser& yyparser, const symbol_type& yyla); + const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; } + symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); } + const location_type& location () const YY_NOEXCEPT { return yyla_.location; } + + /// Put in YYARG at most YYARGN of the expected tokens, and return the + /// number of tokens stored in YYARG. If YYARG is null, return the + /// number of expected tokens (guaranteed to be less than YYNTOKENS). + int expected_tokens (symbol_kind_type yyarg[], int yyargn) const; + + private: + const parser& yyparser_; + const symbol_type& yyla_; + }; + + private: +#if YY_CPLUSPLUS < 201103L + /// Non copyable. + parser (const parser&); + /// Non copyable. + parser& operator= (const parser&); +#endif + + /// Check the lookahead yytoken. + /// \returns true iff the token will be eventually shifted. + bool yy_lac_check_ (symbol_kind_type yytoken) const; + /// Establish the initial context if no initial context currently exists. + /// \returns true iff the token will be eventually shifted. + bool yy_lac_establish_ (symbol_kind_type yytoken); + /// Discard any previous initial lookahead context because of event. + /// \param event the event which caused the lookahead to be discarded. + /// Only used for debbuging output. + void yy_lac_discard_ (const char* event); + + /// Stored state numbers (used for stacks). + typedef signed char state_type; + + /// The arguments of the error message. + int yy_syntax_error_arguments_ (const context& yyctx, + symbol_kind_type yyarg[], int yyargn) const; + + /// Generate an error message. + /// \param yyctx the context in which the error occurred. + virtual std::string yysyntax_error_ (const context& yyctx) const; + /// Compute post-reduction state. + /// \param yystate the current state + /// \param yysym the nonterminal to push on the stack + static state_type yy_lr_goto_state_ (state_type yystate, int yysym); + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT; + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT; + + static const signed char yypact_ninf_; + static const signed char yytable_ninf_; + + /// Convert a scanner token kind \a t to a symbol kind. + /// In theory \a t should be a token_kind_type, but character literals + /// are valid, yet not members of the token_kind_type enum. + static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT; + + + + // Tables. + // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + // STATE-NUM. + static const signed char yypact_[]; + + // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + // Performed when YYTABLE does not specify something else to do. Zero + // means the default is an error. + static const signed char yydefact_[]; + + // YYPGOTO[NTERM-NUM]. + static const signed char yypgoto_[]; + + // YYDEFGOTO[NTERM-NUM]. + static const signed char yydefgoto_[]; + + // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + // positive, shift that token. If negative, reduce the rule whose + // number is the opposite. If YYTABLE_NINF, syntax error. + static const signed char yytable_[]; + + static const signed char yycheck_[]; + + // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + // state STATE-NUM. + static const signed char yystos_[]; + + // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. + static const signed char yyr1_[]; + + // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. + static const signed char yyr2_[]; + + +#if YYDEBUG + // YYRLINE[YYN] -- Source line where rule number YYN was defined. + static const signed char yyrline_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r) const; + /// Print the state stack on the debug stream. + virtual void yy_stack_print_ () const; + + /// Debugging level. + int yydebug_; + /// Debug stream. + std::ostream* yycdebug_; + + /// \brief Display a symbol kind, value and location. + /// \param yyo The output stream. + /// \param yysym The symbol. + template + void yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const; +#endif + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yysym The symbol. + template + void yy_destroy_ (const char* yymsg, basic_symbol& yysym) const; + + private: + /// Type access provider for state based symbols. + struct by_state + { + /// Default constructor. + by_state () YY_NOEXCEPT; + + /// The symbol kind as needed by the constructor. + typedef state_type kind_type; + + /// Constructor. + by_state (kind_type s) YY_NOEXCEPT; + + /// Copy constructor. + by_state (const by_state& that) YY_NOEXCEPT; + + /// Record that this symbol is empty. + void clear () YY_NOEXCEPT; + + /// Steal the symbol kind from \a that. + void move (by_state& that); + + /// The symbol kind (corresponding to \a state). + /// \a symbol_kind::S_YYEMPTY when empty. + symbol_kind_type kind () const YY_NOEXCEPT; + + /// The state number used to denote an empty symbol. + /// We use the initial state, as it does not have a value. + enum { empty_state = 0 }; + + /// The state. + /// \a empty when empty. + state_type state; + }; + + /// "Internal" symbol: element of the stack. + struct stack_symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + /// Construct an empty symbol. + stack_symbol_type (); + /// Move or copy construction. + stack_symbol_type (YY_RVREF (stack_symbol_type) that); + /// Steal the contents from \a sym to build this. + stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym); +#if YY_CPLUSPLUS < 201103L + /// Assignment, needed by push_back by some old implementations. + /// Moves the contents of that. + stack_symbol_type& operator= (stack_symbol_type& that); + + /// Assignment, needed by push_back by other implementations. + /// Needed by some other old implementations. + stack_symbol_type& operator= (const stack_symbol_type& that); +#endif + }; + + /// A stack with random access from its top. + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::iterator iterator; + typedef typename S::const_iterator const_iterator; + typedef typename S::size_type size_type; + typedef typename std::ptrdiff_t index_type; + + stack (size_type n = 200) YY_NOEXCEPT + : seq_ (n) + {} + +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + stack (const stack&) = delete; + /// Non copyable. + stack& operator= (const stack&) = delete; +#endif + + /// Random access. + /// + /// Index 0 returns the topmost element. + const T& + operator[] (index_type i) const + { + return seq_[size_type (size () - 1 - i)]; + } + + /// Random access. + /// + /// Index 0 returns the topmost element. + T& + operator[] (index_type i) + { + return seq_[size_type (size () - 1 - i)]; + } + + /// Steal the contents of \a t. + /// + /// Close to move-semantics. + void + push (YY_MOVE_REF (T) t) + { + seq_.push_back (T ()); + operator[] (0).move (t); + } + + /// Pop elements from the stack. + void + pop (std::ptrdiff_t n = 1) YY_NOEXCEPT + { + for (; 0 < n; --n) + seq_.pop_back (); + } + + /// Pop all elements from the stack. + void + clear () YY_NOEXCEPT + { + seq_.clear (); + } + + /// Number of elements on the stack. + index_type + size () const YY_NOEXCEPT + { + return index_type (seq_.size ()); + } + + /// Iterator on top of the stack (going downwards). + const_iterator + begin () const YY_NOEXCEPT + { + return seq_.begin (); + } + + /// Bottom of the stack. + const_iterator + end () const YY_NOEXCEPT + { + return seq_.end (); + } + + /// Present a slice of the top of a stack. + class slice + { + public: + slice (const stack& stack, index_type range) YY_NOEXCEPT + : stack_ (stack) + , range_ (range) + {} + + const T& + operator[] (index_type i) const + { + return stack_[range_ - i]; + } + + private: + const stack& stack_; + index_type range_; + }; + + private: +#if YY_CPLUSPLUS < 201103L + /// Non copyable. + stack (const stack&); + /// Non copyable. + stack& operator= (const stack&); +#endif + /// The wrapped container. + S seq_; + }; + + + /// Stack type. + typedef stack stack_type; + + /// The stack. + stack_type yystack_; + /// The stack for LAC. + /// Logically, the yy_lac_stack's lifetime is confined to the function + /// yy_lac_check_. We just store it as a member of this class to hold + /// on to the memory and to avoid frequent reallocations. + /// Since yy_lac_check_ is const, this member must be mutable. + mutable std::vector yylac_stack_; + /// Whether an initial LAC context was established. + bool yy_lac_established_; + + + /// Push a new state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param sym the symbol + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym); + + /// Push a new look ahead token on the state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the state + /// \param sym the symbol (for its value and location). + /// \warning the contents of \a sym.value is stolen. + void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym); + + /// Pop \a n symbols from the stack. + void yypop_ (int n = 1) YY_NOEXCEPT; + + /// Constants. + enum + { + yylast_ = 53, ///< Last index in yytable_. + yynnts_ = 7, ///< Number of nonterminal symbols. + yyfinal_ = 12 ///< Termination state number. + }; + + + // User arguments. + ASTDriver& drv; + + }; + + inline + parser::symbol_kind_type + parser::yytranslate_ (int t) YY_NOEXCEPT + { + return static_cast (t); + } + + // basic_symbol. + template + parser::basic_symbol::basic_symbol (const basic_symbol& that) + : Base (that) + , value () + , location (that.location) + { + switch (this->kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.copy< int > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.copy< std::string > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_index: // index + value.copy< std::tuple > (YY_MOVE (that.value)); + break; + + case symbol_kind::S_indices_list: // indices_list + value.copy< std::vector> > (YY_MOVE (that.value)); + break; + + default: + break; + } + + } + + + + + template + parser::symbol_kind_type + parser::basic_symbol::type_get () const YY_NOEXCEPT + { + return this->kind (); + } + + + template + bool + parser::basic_symbol::empty () const YY_NOEXCEPT + { + return this->kind () == symbol_kind::S_YYEMPTY; + } + + template + void + parser::basic_symbol::move (basic_symbol& s) + { + super_type::move (s); + switch (this->kind ()) + { + case symbol_kind::S_INT: // "number" + case symbol_kind::S_list: // list + value.move< int > (YY_MOVE (s.value)); + break; + + case symbol_kind::S_OPERATOR: // OPERATOR + case symbol_kind::S_IDENTIFIER: // "identifier" + case symbol_kind::S_VARNAME: // VARNAME + value.move< std::string > (YY_MOVE (s.value)); + break; + + case symbol_kind::S_index: // index + value.move< std::tuple > (YY_MOVE (s.value)); + break; + + case symbol_kind::S_indices_list: // indices_list + value.move< std::vector> > (YY_MOVE (s.value)); + break; + + default: + break; + } + + location = YY_MOVE (s.location); + } + + // by_kind. + inline + parser::by_kind::by_kind () YY_NOEXCEPT + : kind_ (symbol_kind::S_YYEMPTY) + {} + +#if 201103L <= YY_CPLUSPLUS + inline + parser::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT + : kind_ (that.kind_) + { + that.clear (); + } +#endif + + inline + parser::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT + : kind_ (that.kind_) + {} + + inline + parser::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT + : kind_ (yytranslate_ (t)) + {} + + + + inline + void + parser::by_kind::clear () YY_NOEXCEPT + { + kind_ = symbol_kind::S_YYEMPTY; + } + + inline + void + parser::by_kind::move (by_kind& that) + { + kind_ = that.kind_; + that.clear (); + } + + inline + parser::symbol_kind_type + parser::by_kind::kind () const YY_NOEXCEPT + { + return kind_; + } + + + inline + parser::symbol_kind_type + parser::by_kind::type_get () const YY_NOEXCEPT + { + return this->kind (); + } + + +#line 6 "../parser.y" +} } // adios2::detail +#line 1605 "parser.h" + + + + +#endif // !YY_YY_PARSER_H_INCLUDED diff --git a/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp b/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp index 0e7574a17c..f78f554c9d 100644 --- a/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp +++ b/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp @@ -366,7 +366,7 @@ BP5Deserializer::ControlInfo *BP5Deserializer::BuildControl(FMFormat Format) size_t VarIndex = 0; while (FieldList[i].field_name) { - size_t HeaderSkip; + size_t HeaderSkip = 0; char *ExprStr = NULL; int Derived = 0; ret = (ControlInfo *)realloc(ret, sizeof(*ret) + ControlCount * sizeof(struct ControlInfo)); @@ -1994,6 +1994,8 @@ BP5Deserializer::~BP5Deserializer() m_Engine->m_IO.RemoveVariable(VarRec.second->VarName); free(VarRec.second->VarName); + if (VarRec.second->ExprStr) + free(VarRec.second->ExprStr); if (VarRec.second->Operator) free(VarRec.second->Operator); if (VarRec.second->Def) diff --git a/source/adios2/toolkit/format/dataman/DataManSerializer.h b/source/adios2/toolkit/format/dataman/DataManSerializer.h index 4e2c2ada6a..8e3247667f 100644 --- a/source/adios2/toolkit/format/dataman/DataManSerializer.h +++ b/source/adios2/toolkit/format/dataman/DataManSerializer.h @@ -110,8 +110,8 @@ class DataManSerializer // another wrapper for PutData which accepts adios2::core::Variable template void PutData(const core::Variable &variable, const std::string &doid, const size_t step, - const int rank, const std::string &address, VecPtr localBuffer = nullptr, - JsonPtr metadataJson = nullptr); + const int rank, const MemorySpace varMemSpace, const std::string &address, + VecPtr localBuffer = nullptr, JsonPtr metadataJson = nullptr); // attach attributes to local pack void AttachAttributesToLocalPack(); diff --git a/source/adios2/toolkit/format/dataman/DataManSerializer.tcc b/source/adios2/toolkit/format/dataman/DataManSerializer.tcc index e3fd9b29d3..4060b93681 100644 --- a/source/adios2/toolkit/format/dataman/DataManSerializer.tcc +++ b/source/adios2/toolkit/format/dataman/DataManSerializer.tcc @@ -76,13 +76,14 @@ void DataManSerializer::CalculateMinMax(const T *data, const Dims &count, template void DataManSerializer::PutData(const core::Variable &variable, const std::string &doid, - const size_t step, const int rank, const std::string &address, - VecPtr localBuffer, JsonPtr metadataJson) + const size_t step, const int rank, const MemorySpace memSpace, + const std::string &address, VecPtr localBuffer, + JsonPtr metadataJson) { PERFSTUBS_SCOPED_TIMER_FUNC(); PutData(variable.GetData(), variable.m_Name, variable.m_Shape, variable.m_Start, - variable.m_Count, variable.m_MemoryStart, variable.m_MemoryCount, variable.m_MemSpace, - doid, step, rank, address, variable.m_Operations, localBuffer, metadataJson); + variable.m_Count, variable.m_MemoryStart, variable.m_MemoryCount, memSpace, doid, step, + rank, address, variable.m_Operations, localBuffer, metadataJson); } template diff --git a/source/adios2/toolkit/remote/CMakeLists.txt b/source/adios2/toolkit/remote/CMakeLists.txt index 9b613d4b45..a739e1ad63 100644 --- a/source/adios2/toolkit/remote/CMakeLists.txt +++ b/source/adios2/toolkit/remote/CMakeLists.txt @@ -4,9 +4,9 @@ #------------------------------------------------------------------------------# if (NOT ADIOS2_USE_PIP) - add_executable(remote_server ./remote_server.cpp remote_common.cpp) + add_executable(adios2_remote_server ./remote_server.cpp remote_common.cpp) - target_link_libraries(remote_server PUBLIC EVPath::EVPath adios2_core adios2sys + target_link_libraries(adios2_remote_server PUBLIC EVPath::EVPath adios2_core adios2sys PRIVATE $<$:shlwapi>) get_property(pugixml_headers_path @@ -14,10 +14,10 @@ if (NOT ADIOS2_USE_PIP) PROPERTY INTERFACE_INCLUDE_DIRECTORIES ) - target_include_directories(remote_server PRIVATE ${PROJECT_BINARY_DIR} ${pugixml_headers_path}) + target_include_directories(adios2_remote_server PRIVATE ${PROJECT_BINARY_DIR} ${pugixml_headers_path}) - set_property(TARGET remote_server PROPERTY OUTPUT_NAME remote_server${ADIOS2_EXECUTABLE_SUFFIX}) - install(TARGETS remote_server EXPORT adios2 + set_property(TARGET adios2_remote_server PROPERTY OUTPUT_NAME adios2_remote_server${ADIOS2_EXECUTABLE_SUFFIX}) + install(TARGETS adios2_remote_server EXPORT adios2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_tools-runtime ) endif () diff --git a/source/adios2/toolkit/remote/remote_server.cpp b/source/adios2/toolkit/remote/remote_server.cpp index e46e06bca0..5108ed421e 100644 --- a/source/adios2/toolkit/remote/remote_server.cpp +++ b/source/adios2/toolkit/remote/remote_server.cpp @@ -543,8 +543,9 @@ int main(int argc, char **argv) else { fprintf(stderr, "Unknown argument \"%s\"\n", argv[i]); - fprintf(stderr, "Usage: remote_server [-background] [-kill_server] [-no_timeout] " - "[-status] [-v] [-q]\n"); + fprintf(stderr, + "Usage: adios2_remote_server [-background] [-kill_server] [-no_timeout] " + "[-status] [-v] [-q]\n"); exit(1); } } diff --git a/source/adios2/toolkit/sst/CMakeLists.txt b/source/adios2/toolkit/sst/CMakeLists.txt index 3c539b16a9..4a8252eeef 100644 --- a/source/adios2/toolkit/sst/CMakeLists.txt +++ b/source/adios2/toolkit/sst/CMakeLists.txt @@ -45,7 +45,7 @@ if(ADIOS2_HAVE_ZFP) target_link_libraries(sst PRIVATE zfp::zfp) endif() -if(ADIOS2_SST_HAVE_MPI) +if(ADIOS2_SST_BUILD_MPI_DP) target_sources(sst PRIVATE dp/mpi_dp.c) target_link_libraries(sst PRIVATE MPI::MPI_C) endif() diff --git a/source/adios2/toolkit/transport/file/FileHTTP.cpp b/source/adios2/toolkit/transport/file/FileHTTP.cpp index 7407cb6ff7..6e52cde493 100644 --- a/source/adios2/toolkit/transport/file/FileHTTP.cpp +++ b/source/adios2/toolkit/transport/file/FileHTTP.cpp @@ -8,6 +8,8 @@ * Author: Dmitry Ganyushin ganyushin@gmail.com */ #include "FileHTTP.h" +#include + #include #include #include diff --git a/source/h5vol/H5Vol_attr.c b/source/h5vol/H5Vol_attr.c index 17a89cb0d5..8a4dc84081 100644 --- a/source/h5vol/H5Vol_attr.c +++ b/source/h5vol/H5Vol_attr.c @@ -183,7 +183,7 @@ herr_t H5VL_adios2_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id *ret_val = strlen(attrDef->m_Name); if (buf) { - strncpy(buf, attrDef->m_Name, *ret_val); + memcpy(buf, attrDef->m_Name, *ret_val); } } else if (H5VL_OBJECT_BY_IDX == loc_params->type) diff --git a/source/utils/adios_campaign_manager/adios2_campaign_manager.py b/source/utils/adios_campaign_manager/adios2_campaign_manager.py index c752d95aac..be9eecfad3 100755 --- a/source/utils/adios_campaign_manager/adios2_campaign_manager.py +++ b/source/utils/adios_campaign_manager/adios2_campaign_manager.py @@ -4,63 +4,115 @@ import glob import sqlite3 import zlib +import yaml +from dataclasses import dataclass from datetime import datetime from os import chdir, getcwd, remove, stat -from os.path import exists, isdir +from os.path import exists, isdir, expanduser from re import sub from socket import getfqdn -from time import time +from time import time_ns # from adios2.adios2_campaign_manager import * -ADIOS_ACA_VERSION = "1.0" +ADIOS_ACA_VERSION = "0.1" + +@dataclass +class UserOption: + adios_campaign_store: str = None + hostname: str = None + verbose: int = 0 + + +def ReadUserConfig(): + path = expanduser("~/.config/adios2/adios2.yaml") + opts = UserOption() + try: + doc = {} + with open(path) as f: + doc = yaml.safe_load(f) + camp = doc.get("Campaign") + if isinstance(camp, dict): + for key, value in camp.items(): + if key == "campaignstorepath": + opts.adios_campaign_store = expanduser(value) + if key == "hostname": + opts.hostname = value + if key == "verbose": + opts.verbose = value + except FileNotFoundError: + None + return opts + def SetupArgs(): parser = argparse.ArgumentParser() parser.add_argument( - "command", help="Command: create/update/delete", - choices=['create', 'update', 'delete', 'info']) - parser.add_argument("--verbose", "-v", - help="More verbosity", action="count") - parser.add_argument("--project", "-p", - help="Project name", - required=True) - parser.add_argument("--app", "-a", - help="Application name", - required=True) - parser.add_argument("--shot", "-s", - help="Shot name", - required=True) - parser.add_argument("--campaign_store", "-c", - help="Path to local campaign store", - required=True) - parser.add_argument("--hostname", "-n", - help="Host name unique for hosts in a campaign", - required=False) + "command", + help="Command: create/update/delete/info/list", + choices=["create", "update", "delete", "info", "list"], + ) + parser.add_argument( + "campaign", help="Campaign name or path, with .aca or without", default=None, nargs="?" + ) + parser.add_argument("--verbose", "-v", help="More verbosity", action="count", default=0) + parser.add_argument( + "--campaign_store", "-s", help="Path to local campaign store", default=None + ) + parser.add_argument("--hostname", "-n", help="Host name unique for hosts in a campaign") + parser.add_argument("-f", "--files", nargs="+", help="Add ADIOS files manually") args = parser.parse_args() # default values - args.update = False - args.CampaignFileName = args.campaign_store + "/" + \ - args.project + "_" + args.app + "_" + args.shot + ".aca" - args.LocalCampaignDir = "adios-campaign/" - - # print("Verbosity = {0}".format(args.verbose)) - print(f"Campaign File Name = {args.CampaignFileName}") + args.user_options = ReadUserConfig() + + if args.verbose == 0: + args.verbose = args.user_options.verbose + + if args.campaign_store is None: + args.campaign_store = args.user_options.adios_campaign_store + + if args.campaign_store is not None: + while args.campaign_store[-1] == "/": + args.campaign_store = args.campaign_store[:-1] + + if args.hostname is None: + args.hostname = args.user_options.hostname + + args.CampaignFileName = args.campaign + if args.campaign is not None: + if not args.campaign.endswith(".aca"): + args.CampaignFileName += ".aca" + if (not exists(args.CampaignFileName) and + not args.CampaignFileName.startswith("/") and + args.campaign_store is not None): + args.CampaignFileName = args.campaign_store + "/" + args.CampaignFileName + + if args.files is None: + args.LocalCampaignDir = "adios-campaign/" + + if args.verbose > 0: + print(f"# Verbosity = {args.verbose}") + print(f"# Command = {args.command}") + print(f"# Campaign File Name = {args.CampaignFileName}") + print(f"# Campaign Store = {args.campaign_store}") return args def CheckCampaignStore(args): - if not isdir(args.campaign_store): - print("ERROR: Campaign directory " + args.campaign_store + - " does not exist", flush=True) + if args.campaign_store is not None and not isdir(args.campaign_store): + print("ERROR: Campaign directory " + args.campaign_store + " does not exist", flush=True) exit(1) def CheckLocalCampaignDir(args): if not isdir(args.LocalCampaignDir): - print("ERROR: Shot campaign data '" + args.LocalCampaignDir + - "' does not exist. Run this command where the code was executed.", flush=True) + print( + "ERROR: Shot campaign data '" + + args.LocalCampaignDir + + "' does not exist. Run this command where the code was executed.", + flush=True, + ) exit(1) @@ -102,7 +154,7 @@ def decompressBuffer(buf: bytearray): def AddFileToArchive(args: dict, filename: str, cur: sqlite3.Cursor, dsID: int): compressed = 1 try: - f = open(filename, 'rb') + f = open(filename, "rb") compressed_data, len_orig, len_compressed = compressFile(f) except IOError: @@ -110,186 +162,268 @@ def AddFileToArchive(args: dict, filename: str, cur: sqlite3.Cursor, dsID: int): return statres = stat(filename) - ct = statres.st_ctime - - cur.execute('insert into bpfile values (?, ?, ?, ?, ?, ?, ?)', - (dsID, filename, compressed, len_orig, len_compressed, ct, compressed_data)) - con.commit() - - # test - # if (filename == "dataAll.bp/md.0"): - # data = decompressBuffer(compressed_data) - # of = open("dataAll.bp-md.0", "wb") - # of.write(data) - # of.close() + ct = statres.st_ctime_ns - -def AddDatasetToArchive(args: dict, dataset: str, cur: sqlite3.Cursor, hostID: int, dirID: int): - if (IsADIOSDataset(dataset)): - print(f"Add dataset {dataset} to archive") - statres = stat(dataset) - ct = statres.st_ctime - curDS = cur.execute('insert into bpdataset values (?, ?, ?, ?)', - (hostID, dirID, dataset, ct)) - dsID = curDS.lastrowid - cwd = getcwd() - chdir(dataset) - mdFileList = glob.glob('*md.*') - profileList = glob.glob('profiling.json') - files = mdFileList + profileList - for f in files: - AddFileToArchive(args, f, cur, dsID) - chdir(cwd) + cur.execute( + "insert into bpfile " + "(bpdatasetid, name, compression, lenorig, lencompressed, ctime, data) " + "values (?, ?, ?, ?, ?, ?, ?) " + "on conflict (bpdatasetid, name) do update " + "set compression = ?, lenorig = ?, lencompressed = ?, ctime = ?, data = ?", + ( + dsID, + filename, + compressed, + len_orig, + len_compressed, + ct, + compressed_data, + compressed, + len_orig, + len_compressed, + ct, + compressed_data, + ), + ) + + +def AddDatasetToArchive(hostID: int, dirID: int, dataset: str, cur: sqlite3.Cursor) -> int: + statres = stat(dataset) + ct = statres.st_ctime_ns + select_cmd = ( + "select rowid from bpdataset " + f"where hostid = {hostID} and dirid = {dirID} and name = '{dataset}'" + ) + res = cur.execute(select_cmd) + row = res.fetchone() + if row is not None: + rowID = row[0] + print( + f"Found dataset {dataset} in database on host {hostID} " + f"in dir {dirID}, rowid = {rowID}" + ) else: - print(f"WARNING: Dataset {dataset} is not an ADIOS dataset. Skip") - - -def ProcessDBFile(args: dict, jsonlist: list, cur: sqlite3.Cursor, hostID: int, dirID: int): - for entry in jsonlist: - # print(f"Process entry {entry}:") - if isinstance(entry, dict): - if "name" in entry: - AddDatasetToArchive( - args, entry['name'], cur, hostID, dirID) + print(f"Add dataset {dataset} to archive") + curDS = cur.execute( + "insert into bpdataset (hostid, dirid, name, ctime) values (?, ?, ?, ?)", + (hostID, dirID, dataset, ct), + ) + rowID = curDS.lastrowid + # print( + # f"Inserted bpdataset {dataset} in database on host {hostID}" + # f" in dir {dirID}, rowid = {rowID}" + # ) + return rowID + + +def ProcessFiles(args: dict, cur: sqlite3.Cursor, hostID: int, dirID: int): + for entry in args.files: + print(f"Process entry {entry}:") + dsID = 0 + dataset = entry + if IsADIOSDataset(dataset): + dsID = AddDatasetToArchive(hostID, dirID, dataset, cur) + cwd = getcwd() + chdir(dataset) + mdFileList = glob.glob("*md.*") + profileList = glob.glob("profiling.json") + files = mdFileList + profileList + for f in files: + AddFileToArchive(args, f, cur, dsID) + chdir(cwd) else: - print(f"WARNING: your object is not a dictionary, skip : {entry}") + print(f"WARNING: Dataset {dataset} is not an ADIOS dataset. Skip") def GetHostName(): host = getfqdn() if host.startswith("login"): - host = sub('^login[0-9]*\\.', '', host) + host = sub("^login[0-9]*\\.", "", host) if host.startswith("batch"): - host = sub('^batch[0-9]*\\.', '', host) - shorthost = host.split('.')[0] + host = sub("^batch[0-9]*\\.", "", host) + if args.hostname is None: + shorthost = host.split(".")[0] + else: + shorthost = args.user_options.hostname return host, shorthost def AddHostName(longHostName, shortHostName): - res = cur.execute( - 'select rowid from host where hostname = "' + shortHostName + '"') + res = cur.execute('select rowid from host where hostname = "' + shortHostName + '"') row = res.fetchone() if row is not None: hostID = row[0] print(f"Found host {shortHostName} in database, rowid = {hostID}") else: - curHost = cur.execute('insert into host values (?, ?)', - (shortHostName, longHostName)) + curHost = cur.execute("insert into host values (?, ?)", (shortHostName, longHostName)) hostID = curHost.lastrowid print(f"Inserted host {shortHostName} into database, rowid = {hostID}") return hostID -def Info(args: dict, cur: sqlite3.Cursor): - res = cur.execute('select id, name, version, ctime from info') - info = res.fetchone() - t = datetime.fromtimestamp(float(info[3])) - print(f"{info[1]}, version {info[2]}, created on {t}") +def MergeDBFiles(dbfiles: list): + # read db files here + result = list() + for f1 in dbfiles: + try: + con = sqlite3.connect(f1) + except sqlite3.Error as e: + print(e) - res = cur.execute('select rowid, hostname, longhostname from host') - hosts = res.fetchall() - for host in hosts: - print(f"hostname = {host[1]} longhostname = {host[2]}") - res2 = cur.execute( - 'select rowid, name from directory where hostid = "' + str(host[0]) + '"') - dirs = res2.fetchall() - for dir in dirs: - print(f" dir = {dir[1]}") - res3 = cur.execute( - 'select rowid, name, ctime from bpdataset where hostid = "' + str(host[0]) + - '" and dirid = "' + str(dir[0]) + '"') - bpdatasets = res3.fetchall() - for bpdataset in bpdatasets: - t = datetime.fromtimestamp(float(bpdataset[2])) - print(f" dataset = {bpdataset[1]} created on {t}") + cur = con.cursor() + try: + cur.execute("select * from bpfiles") + except sqlite3.Error as e: + print(e) + record = cur.fetchall() + for item in record: + result.append(item[0]) + cur.close() + return result + + +def AddDirectory(hostID: int, path: str) -> int: + res = cur.execute( + "select rowid from directory where hostid = " + str(hostID) + ' and name = "' + path + '"' + ) + row = res.fetchone() + if row is not None: + dirID = row[0] + print(f"Found directory {path} with hostID {hostID} in database, rowid = {dirID}") + else: + curDirectory = cur.execute("insert into directory values (?, ?)", (hostID, path)) + dirID = curDirectory.lastrowid + print(f"Inserted directory {path} into database, rowid = {dirID}") + return dirID def Update(args: dict, cur: sqlite3.Cursor): longHostName, shortHostName = GetHostName() - if args.hostname is not None: - shortHostName = args.hostname hostID = AddHostName(longHostName, shortHostName) rootdir = getcwd() - # curHost = cur.execute('insert into host values (?, ?)', - # (shortHostName, longHostName)) - # hostID = curHost.lastrowid - - curDir = cur.execute('insert or replace into directory values (?, ?)', - (hostID, rootdir)) - dirID = curDir.lastrowid + dirID = AddDirectory(hostID, rootdir) con.commit() - db_list = MergeDBFiles(dbFileList) - - # print(f"Merged json = {jsonlist}") - ProcessDBFile(args, db_list, cur, hostID, dirID) + ProcessFiles(args, cur, hostID, dirID) con.commit() def Create(args: dict, cur: sqlite3.Cursor): - epoch = int(time()) + epoch = time_ns() + cur.execute("create table info(id TEXT, name TEXT, version TEXT, ctime INT)") + cur.execute( + "insert into info values (?, ?, ?, ?)", + ("ACA", "ADIOS Campaign Archive", ADIOS_ACA_VERSION, epoch), + ) + cur.execute("create table host" + "(hostname TEXT PRIMARY KEY, longhostname TEXT)") + cur.execute("create table directory" + "(hostid INT, name TEXT, PRIMARY KEY (hostid, name))") cur.execute( - "create table info(id TEXT, name TEXT, version TEXT, ctime INT)") - cur.execute('insert into info values (?, ?, ?, ?)', - ("ACA", "ADIOS Campaign Archive", ADIOS_ACA_VERSION, epoch)) - cur.execute("create table host" + - "(hostname TEXT PRIMARY KEY, longhostname TEXT)") - cur.execute("create table directory" + - "(hostid INT, name TEXT, PRIMARY KEY (hostid, name))") - cur.execute("create table bpdataset" + - "(hostid INT, dirid INT, name TEXT, ctime INT" + - ", PRIMARY KEY (hostid, dirid, name))") - cur.execute("create table bpfile" + - "(bpdatasetid INT, name TEXT, compression INT, lenorig INT" + - ", lencompressed INT, ctime INT, data BLOB" + - ", PRIMARY KEY (bpdatasetid, name))") + "create table bpdataset" + + "(hostid INT, dirid INT, name TEXT, ctime INT" + + ", PRIMARY KEY (hostid, dirid, name))" + ) + cur.execute( + "create table bpfile" + + "(bpdatasetid INT, name TEXT, compression INT, lenorig INT" + + ", lencompressed INT, ctime INT, data BLOB" + + ", PRIMARY KEY (bpdatasetid, name))" + ) Update(args, cur) -def MergeDBFiles(dbfiles: list): - # read db files here - result = list() - for f1 in dbfiles: - try: - con = sqlite3.connect(f1) - except sqlite3.Error as e: - print(e) +def timestamp_to_datetime(timestamp: int) -> datetime: + digits = len(str(int(timestamp))) + t = float(timestamp) + if digits > 18: + t = t / 1000000000 + elif digits > 15: + t = t / 1000000 + elif digits > 12: + t = t / 1000 + return datetime.fromtimestamp(t) - cur = con.cursor() - try: - cur.execute("select * from bpfiles") - except sqlite3.Error as e: - print(e) - record = cur.fetchall() - for item in record: - result.append({"name": item[0]}) - cur.close() - return result +def Info(args: dict, cur: sqlite3.Cursor): + res = cur.execute("select id, name, version, ctime from info") + info = res.fetchone() + t = timestamp_to_datetime(info[3]) + print(f"{info[1]}, version {info[2]}, created on {t}") + + res = cur.execute("select rowid, hostname, longhostname from host") + hosts = res.fetchall() + for host in hosts: + print(f"hostname = {host[1]} longhostname = {host[2]}") + res2 = cur.execute( + 'select rowid, name from directory where hostid = "' + str(host[0]) + '"' + ) + dirs = res2.fetchall() + for dir in dirs: + print(f" dir = {dir[1]}") + res3 = cur.execute( + 'select rowid, name, ctime from bpdataset where hostid = "' + + str(host[0]) + + '" and dirid = "' + + str(dir[0]) + + '"' + ) + bpdatasets = res3.fetchall() + for bpdataset in bpdatasets: + t = timestamp_to_datetime(bpdataset[2]) + print(f" dataset = {bpdataset[1]} created on {t}") -if __name__ == "__main__": +def List(): + path = args.campaign + if path is None: + if args.campaign_store is None: + print("ERROR: Set --campaign_store for this command") + return 1 + path = args.campaign_store + else: + while path[-1] == "/": + path = path[:-1] + + # List the local campaign store + acaList = glob.glob(path + "/**/*.aca", recursive=True) + if len(acaList) == 0: + print("There are no campaign archives in " + path) + return 2 + else: + startCharPos = len(path) + 1 + for f in acaList: + print(f[startCharPos:]) + return 0 + + +def Delete(): + if exists(args.CampaignFileName): + print(f"Delete archive {args.CampaignFileName}") + remove(args.CampaignFileName) + return 0 + else: + print(f"ERROR: archive {args.CampaignFileName} does not exist") + return 1 + + +if __name__ == "__main__": args = SetupArgs() CheckCampaignStore(args) - if (args.command == "delete"): - if exists(args.CampaignFileName): - print(f"Delete archive {args.CampaignFileName}") - remove(args.CampaignFileName) - exit(0) - else: - print(f"ERROR: archive {args.CampaignFileName} does not exist") - exit(1) + if args.command == "list": + exit(List()) + + if args.command == "delete": + exit(Delete()) - if (args.command == "create"): + if args.command == "create": print("Create archive") if exists(args.CampaignFileName): print(f"ERROR: archive {args.CampaignFileName} already exist") exit(1) - elif (args.command == "update" or args.command == 'info'): + elif args.command == "update" or args.command == "info": print(f"{args.command} archive") if not exists(args.CampaignFileName): print(f"ERROR: archive {args.CampaignFileName} does not exist") @@ -298,19 +432,21 @@ def MergeDBFiles(dbfiles: list): con = sqlite3.connect(args.CampaignFileName) cur = con.cursor() - if (args.command == "info"): + if args.command == "info": Info(args, cur) else: - CheckLocalCampaignDir(args) - # List the local campaign directory - dbFileList = glob.glob(args.LocalCampaignDir + '/*.db') - if len(dbFileList) == 0: - print("There are no campaign data files in " + args.LocalCampaignDir) - exit(2) - - if (args.command == "create"): + if args.files is None: + CheckLocalCampaignDir(args) + # List the local campaign directory + dbFileList = glob.glob(args.LocalCampaignDir + "/*.db") + if len(dbFileList) == 0: + print("There are no campaign data files in " + args.LocalCampaignDir) + exit(2) + args.files = MergeDBFiles(dbFileList) + + if args.command == "create": Create(args, cur) - elif (args.command == "update"): + elif args.command == "update": Update(args, cur) cur.close() diff --git a/source/utils/bpls/bpls.cpp b/source/utils/bpls/bpls.cpp index 0d3ce8e73c..94dd7805cf 100644 --- a/source/utils/bpls/bpls.cpp +++ b/source/utils/bpls/bpls.cpp @@ -1555,13 +1555,25 @@ std::vector getEnginesList(const std::string path) return list; } -int doList(const char *path) +int doList(std::string path) { char init_params[128]; int adios_verbose = 2; if (verbose > 1) - printf("\nADIOS Open: read header info from %s\n", path); + printf("\nADIOS Open: read header info from %s\n", path.c_str()); + + // initialize BP reader + if (verbose > 1) + adios_verbose = 3; // print info lines + if (verbose > 2) + adios_verbose = 4; // print debug lines + snprintf(init_params, sizeof(init_params), "verbose=%d", adios_verbose); + if (hidden_attrs) + strcat(init_params, ";show_hidden_attrs"); + + core::ADIOS adios("C++"); + const adios2::UserOptions userOptions = adios.GetUserOptions(); std::string tpl = helper::LowerCase(transport_params); bool remoteFile = @@ -1579,23 +1591,34 @@ int doList(const char *path) } else { - if (!adios2sys::SystemTools::FileExists(path)) + bool exists = adios2sys::SystemTools::FileExists(path); + if (!exists && !userOptions.campaign.campaignstorepath.empty() && path[0] != PathSeparator) { - fprintf(stderr, "\nError: input path %s does not exist\n", path); + std::string path2 = userOptions.campaign.campaignstorepath + PathSeparator + path; + exists = adios2sys::SystemTools::FileExists(path2); + if (exists) + { + ; // path = path2.c_str(); + } + else + { + std::string path3 = + userOptions.campaign.campaignstorepath + PathSeparator + path + ".aca"; + exists = adios2sys::SystemTools::FileExists(path3); + if (exists) + { + path += ".aca"; // path = path3.c_str(); + } + } + } + + if (!exists) + { + fprintf(stderr, "\nError: input path %s does not exist\n", path.c_str()); return 4; } } - // initialize BP reader - if (verbose > 1) - adios_verbose = 3; // print info lines - if (verbose > 2) - adios_verbose = 4; // print debug lines - snprintf(init_params, sizeof(init_params), "verbose=%d", adios_verbose); - if (hidden_attrs) - strcat(init_params, ";show_hidden_attrs"); - - core::ADIOS adios("C++"); core::IO &io = adios.DeclareIO("bpls"); if (timestep) { diff --git a/source/utils/bpls/bpls.h b/source/utils/bpls/bpls.h index 683c582b4d..8d5c9be035 100644 --- a/source/utils/bpls/bpls.h +++ b/source/utils/bpls/bpls.h @@ -17,6 +17,7 @@ #include "adios2/core/Info.h" #include +#include namespace adios2 { @@ -60,7 +61,7 @@ void parseDimSpec(const std::string &str, int64_t *dims); int parseAccuracy(); int compile_regexp_masks(void); void printSettings(void); -int doList(const char *path); +int doList(std::string path); void mergeLists(int nV, char **listV, int nA, char **listA, char **mlist, bool *isVar); template diff --git a/testing/adios2/bindings/C/TestBPAvailableVariablesAttribites.cpp b/testing/adios2/bindings/C/TestBPAvailableVariablesAttribites.cpp index c4ad9f62bd..8399de3c50 100644 --- a/testing/adios2/bindings/C/TestBPAvailableVariablesAttribites.cpp +++ b/testing/adios2/bindings/C/TestBPAvailableVariablesAttribites.cpp @@ -99,8 +99,11 @@ TEST_F(BPAvailableVariablesAttributes, AvailableVariablesAttributes) adios2_variable *varR64 = adios2_define_variable( ioH, "varR64", adios2_type_double, 1, shape, start, count, adios2_constant_dims_false); +#if ADIOS2_USE_MPI + adios2_engine *engineH = adios2_open(ioH, "available_MPI.bp", adios2_mode_write); +#else adios2_engine *engineH = adios2_open(ioH, "available.bp", adios2_mode_write); - +#endif for (size_t i = 0; i < steps; ++i) { adios2_begin_step(engineH, adios2_step_mode_append, -1., &status); @@ -177,8 +180,11 @@ TEST_F(BPAvailableVariablesAttributes, AvailableVariablesAttributes) std::vector inR64(data_Nx / 2); adios2_io *ioH = adios2_declare_io(adiosH, "Reader"); +#if ADIOS2_USE_MPI + adios2_engine *engineH = adios2_open(ioH, "available_MPI.bp", adios2_mode_read); +#else adios2_engine *engineH = adios2_open(ioH, "available.bp", adios2_mode_read); - +#endif size_t nsteps; adios2_steps(&nsteps, engineH); EXPECT_EQ(nsteps, steps); diff --git a/testing/adios2/bindings/C/TestBPMemorySpace.cpp b/testing/adios2/bindings/C/TestBPMemorySpace.cpp index 65c2381969..d947ccad2d 100644 --- a/testing/adios2/bindings/C/TestBPMemorySpace.cpp +++ b/testing/adios2/bindings/C/TestBPMemorySpace.cpp @@ -52,7 +52,11 @@ TEST_F(ADIOS2_C_API, ADIOS2BPMemorySpaceGPU) TEST_F(ADIOS2_C_API, ADIOS2BPMemorySpaceShape) { +#if ADIOS2_USE_MPI + const char fname[] = "ADIOS2_C_API.ADIOS2BPMemorySpace_MPI.bp"; +#else const char fname[] = "ADIOS2_C_API.ADIOS2BPMemorySpace.bp"; +#endif // write { adios2_io *ioH = adios2_declare_io(adiosH, "CMemSpace"); diff --git a/testing/adios2/bindings/C/TestBPWriteAggregateReadLocal.cpp b/testing/adios2/bindings/C/TestBPWriteAggregateReadLocal.cpp index 941d70e5cb..e8d616405e 100644 --- a/testing/adios2/bindings/C/TestBPWriteAggregateReadLocal.cpp +++ b/testing/adios2/bindings/C/TestBPWriteAggregateReadLocal.cpp @@ -23,8 +23,11 @@ void LocalAggregate1D(const std::string substreams) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array +#if ADIOS2_USE_MPI + const std::string fname("LocalAggregate1D_" + substreams + "_MPI.bp"); +#else const std::string fname("LocalAggregate1D_" + substreams + ".bp"); - +#endif int mpiRank = 0, mpiSize = 1; // Number of steps constexpr size_t NSteps = 5; @@ -151,8 +154,11 @@ void LocalAggregate1DBlock0(const std::string substreams) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array +#if ADIOS2_USE_MPI + const std::string fname("LocalAggregate1DSubFile_" + substreams + "_MPI.bp"); +#else const std::string fname("LocalAggregate1DSubFile_" + substreams + ".bp"); - +#endif int mpiRank = 0, mpiSize = 1; // Number of steps constexpr size_t NSteps = 5; diff --git a/testing/adios2/bindings/C/TestBPWriteReadMultiblock.cpp b/testing/adios2/bindings/C/TestBPWriteReadMultiblock.cpp index 439790103b..4f34f971f2 100644 --- a/testing/adios2/bindings/C/TestBPWriteReadMultiblock.cpp +++ b/testing/adios2/bindings/C/TestBPWriteReadMultiblock.cpp @@ -94,7 +94,11 @@ TEST_F(BPWriteReadMultiblockCC, ZeroSizeBlocks) adios2_variable *varR64 = adios2_define_variable( ioH, "varR64", adios2_type_double, 1, shape, start, count, adios2_constant_dims_false); +#if ADIOS2_USE_MPI + adios2_engine *engineH = adios2_open(ioH, "cmblocks_MPI.bp", adios2_mode_write); +#else adios2_engine *engineH = adios2_open(ioH, "cmblocks.bp", adios2_mode_write); +#endif for (size_t i = 0; i < steps; ++i) { @@ -172,8 +176,11 @@ TEST_F(BPWriteReadMultiblockCC, ZeroSizeBlocks) std::vector inR64(data_Nx / 2); adios2_io *ioH = adios2_declare_io(adiosH, "Reader"); +#if ADIOS2_USE_MPI + adios2_engine *engineH = adios2_open(ioH, "cmblocks_MPI.bp", adios2_mode_read); +#else adios2_engine *engineH = adios2_open(ioH, "cmblocks.bp", adios2_mode_read); - +#endif size_t nsteps; adios2_steps(&nsteps, engineH); EXPECT_EQ(nsteps, steps); diff --git a/testing/adios2/bindings/C/TestBPWriteTypes.cpp b/testing/adios2/bindings/C/TestBPWriteTypes.cpp index 94b1214b51..c3b6e4b872 100644 --- a/testing/adios2/bindings/C/TestBPWriteTypes.cpp +++ b/testing/adios2/bindings/C/TestBPWriteTypes.cpp @@ -45,7 +45,11 @@ class ADIOS2_C_API : public ::testing::Test TEST_F(ADIOS2_C_API, ADIOS2BPWriteTypes) { +#if ADIOS2_USE_MPI + const char fname[] = "ADIOS2_C_API.ADIOS2BPWriteTypes_MPI.bp"; +#else const char fname[] = "ADIOS2_C_API.ADIOS2BPWriteTypes.bp"; +#endif // write { // IO @@ -408,7 +412,11 @@ std::string adios2_engine_name_as_string(adios2_engine *engineH) TEST_F(ADIOS2_C_API_IO, Engine) { +#if ADIOS2_USE_MPI + const char fname[] = "ADIOS2_C_API_IO.engine_MPI.bp"; +#else const char fname[] = "ADIOS2_C_API_IO.engine.bp"; +#endif int ierr; ierr = adios2_set_engine(ioH, "bpfile"); diff --git a/testing/adios2/bindings/C/TestNullWriteRead.cpp b/testing/adios2/bindings/C/TestNullWriteRead.cpp index 3ea6322da1..dcf9d0708e 100644 --- a/testing/adios2/bindings/C/TestNullWriteRead.cpp +++ b/testing/adios2/bindings/C/TestNullWriteRead.cpp @@ -27,7 +27,6 @@ TEST_F(NullWriteReadTests_C_API, NullWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("NullWriteRead1D8_c.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -45,8 +44,10 @@ TEST_F(NullWriteReadTests_C_API, NullWriteRead1D8) #if ADIOS2_USE_MPI adios2_adios *adios = adios2_init_mpi(MPI_COMM_WORLD); + const std::string fname("NullWriteRead1D8_c_MPI.bp"); #else adios2_adios *adios = adios2_init_serial(); + const std::string fname("NullWriteRead1D8_c.bp"); #endif { adios2_io *io = adios2_declare_io(adios, "WriteNull"); diff --git a/testing/adios2/bindings/fortran/CMakeLists.txt b/testing/adios2/bindings/fortran/CMakeLists.txt index c026628343..f1664f3d1f 100644 --- a/testing/adios2/bindings/fortran/CMakeLists.txt +++ b/testing/adios2/bindings/fortran/CMakeLists.txt @@ -15,6 +15,9 @@ macro(fortran_add_test_helper testname mpi) add_executable(${tgt} Test${testname}.F90) set_target_properties(${tgt} PROPERTIES LINKER_LANGUAGE Fortran) target_link_libraries(${tgt} adios2::fortran) + if (ADIOS2_HAVE_Derived_Variable) + target_compile_definitions(${tgt} PRIVATE -DADIOS2_HAVE_Derived_Variable=1) + endif() add_test( NAME ${pfx}${testname}.Serial COMMAND ${tgt} @@ -26,6 +29,9 @@ macro(fortran_add_test_helper testname mpi) add_executable(${tgt} Test${testname}.F90) set_target_properties(${tgt} PROPERTIES LINKER_LANGUAGE Fortran) target_link_libraries(${tgt} adios2::fortran_mpi MPI::MPI_Fortran) + if (ADIOS2_HAVE_Derived_Variable) + target_compile_definitions(${tgt} PRIVATE -DADIOS2_HAVE_Derived_Variable=1) + endif() add_test( NAME ${pfx}${testname}.MPI COMMAND ${MPIEXEC_COMMAND} $ diff --git a/testing/adios2/bindings/fortran/TestAdios2BindingsFortranIO.F90 b/testing/adios2/bindings/fortran/TestAdios2BindingsFortranIO.F90 index 24c648d10f..7bb5ffb3a6 100644 --- a/testing/adios2/bindings/fortran/TestAdios2BindingsFortranIO.F90 +++ b/testing/adios2/bindings/fortran/TestAdios2BindingsFortranIO.F90 @@ -60,7 +60,10 @@ subroutine testing_adios_io_finalize() ! FIXME, shouldn't we be able to do this by handle? call adios2_remove_io(result, adios, "TestIo", ierr) - if ((ierr /= 0) .or. (result .neqv. .true.)) stop "FAIL: adios2_remove_io" + if ((ierr /= 0) .or. (result .neqv. .true.)) then + write(*,*) "FAIL: adios2_remove_io" + stop 1 + end if call testing_adios_finalize() end subroutine testing_adios_io_finalize @@ -88,18 +91,27 @@ subroutine testing_adios_io_engine() call adios2_set_engine(io, "file", ierr) call adios2_io_engine_type(engine_type, io, ierr) - if (engine_type /= "file") stop "FAIL adios2_io_engine_type" + if (engine_type /= "file") then + write(*,*) "FAIL adios2_io_engine_type" + stop 1 + end if deallocate(engine_type) call adios2_open(engine, io, "ftypes.bp", adios2_mode_write, ierr) - if (engine%type /= "BP5Writer") stop "FAIL engine%type" + if (engine%type /= "BP5Writer") then + write(*,*) "FAIL engine%type" + stop 1 + end if ! // FIXME, I'd like to check that the engine type itself is correct, but ! // there's no (function-style) API to get it ! // FIXME, I'd like to check the engine's name, but there's no API to get it call adios2_io_engine_type(engine_type, io, ierr) - if (engine_type /= "file") stop "FAIL adios2_io_engine_type" + if (engine_type /= "file") then + write(*,*) "FAIL adios2_io_engine_type" + stop 1 + end if deallocate(engine_type) call testing_adios_io_finalize() @@ -123,18 +135,27 @@ subroutine testing_adios_io_engine_default() call adios2_set_engine(io, "", ierr) call adios2_io_engine_type(engine_type, io, ierr) - if (engine_type /= "") stop "FAIL adios2_io_engine_type" + if (engine_type /= "") then + write(*,*) "FAIL adios2_io_engine_type" + stop 1 + end if deallocate(engine_type) call adios2_open(engine, io, "ftypes.bp", adios2_mode_write, ierr) - if (engine%type /= "BP5Writer") stop "FAIL engine%type" + if (engine%type /= "BP5Writer") then + write(*,*) "FAIL engine%type" + stop 1 + end if ! // FIXME, I'd like to check that the engine type itself is correct, but ! // there's no (function-style) API to get it ! // FIXME, I'd like to check the engine's name, but there's no API to get it call adios2_io_engine_type(engine_type, io, ierr) - if (engine_type /= "") stop "FAIL adios2_io_engine_type" + if (engine_type /= "") then + write(*,*) "FAIL adios2_io_engine_type" + stop 1 + end if deallocate(engine_type) call testing_adios_io_finalize diff --git a/testing/adios2/bindings/fortran/TestBPMemorySpace.F90 b/testing/adios2/bindings/fortran/TestBPMemorySpace.F90 index e22cb67438..fbec8267c4 100644 --- a/testing/adios2/bindings/fortran/TestBPMemorySpace.F90 +++ b/testing/adios2/bindings/fortran/TestBPMemorySpace.F90 @@ -13,14 +13,26 @@ program TestBPMemorySpace start_dims(1) = 0 count_dims(1) = 10 - if( adios%valid .eqv. .true. ) stop 'Invalid adios default' - if( variable%valid .eqv. .true. ) stop 'Invalid variables default' + if( adios%valid .eqv. .true. ) then + write(*,*) 'Invalid adios default' + stop 1 + end if + if( variable%valid .eqv. .true. ) then + write(*,*) 'Invalid variables default' + stop 1 + end if call adios2_init(adios, ierr) - if( adios%valid .eqv. .false. ) stop 'Invalid adios2_init' + if( adios%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_init' + stop 1 + end if call adios2_declare_io(ioWrite, adios, "ioWrite", ierr) - if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_declare_io' + if( ioWrite%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_declare_io' + stop 1 + end if call adios2_set_engine(ioWrite, 'File', ierr) @@ -31,11 +43,17 @@ program TestBPMemorySpace ! check that the default execution space is Detect call adios2_get_memory_space(mem, variable, ierr) - if (mem /= adios2_memory_space_detect) stop 'Invalid adios2_memory_space' + if (mem /= adios2_memory_space_detect) then + write(*,*) 'Invalid default adios2_memory_space' + stop 1 + end if ! check that the execution space is updated to Host call adios2_set_memory_space(variable, adios2_memory_space_host, ierr) call adios2_get_memory_space(mem, variable, ierr) - if (mem /= adios2_memory_space_host) stop 'Invalid adios2_memory_space' + if (mem /= adios2_memory_space_host) then + write(*,*) 'Invalid set adios2_memory_space' + stop 1 + end if end program TestBPMemorySpace diff --git a/testing/adios2/bindings/fortran/TestBPMemorySpaceGPU.F90 b/testing/adios2/bindings/fortran/TestBPMemorySpaceGPU.F90 index 64fb26755f..bffc935753 100644 --- a/testing/adios2/bindings/fortran/TestBPMemorySpaceGPU.F90 +++ b/testing/adios2/bindings/fortran/TestBPMemorySpaceGPU.F90 @@ -13,14 +13,26 @@ program TestBPMemorySpace start_dims(1) = 0 count_dims(1) = 10 - if( adios%valid .eqv. .true. ) stop 'Invalid adios default' - if( variable%valid .eqv. .true. ) stop 'Invalid variables default' + if( adios%valid .eqv. .true. ) then + write(*,*) 'Invalid adios default' + stop 1 + end if + if( variable%valid .eqv. .true. ) then + write(*,*) 'Invalid variables default' + stop 1 + end if call adios2_init(adios, ierr) - if( adios%valid .eqv. .false. ) stop 'Invalid adios2_init' + if( adios%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_init' + stop 1 + end if call adios2_declare_io(ioWrite, adios, "ioWrite", ierr) - if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_declare_io' + if( ioWrite%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_declare_io' + stop 1 + end if call adios2_set_engine(ioWrite, 'File', ierr) @@ -31,11 +43,17 @@ program TestBPMemorySpace ! check that the default execution space is Detect call adios2_get_memory_space(mem, variable, ierr) - if (mem /= adios2_memory_space_detect) stop 'Invalid adios2_memory_space' + if (mem /= adios2_memory_space_detect) then + write(*,*) 'Invalid default adios2_memory_space' + stop 1 + end if ! check that the execution space is updated to GPU call adios2_set_memory_space(variable, adios2_memory_space_gpu, ierr) call adios2_get_memory_space(mem, variable, ierr) - if (mem /= adios2_memory_space_gpu) stop 'Invalid adios2_memory_space' + if (mem /= adios2_memory_space_gpu) then + write(*,*) 'Invalid set adios2_memory_space' + stop 1 + end if end program TestBPMemorySpace diff --git a/testing/adios2/bindings/fortran/TestBPReadGlobalsByName.F90 b/testing/adios2/bindings/fortran/TestBPReadGlobalsByName.F90 index 6c71157c77..d2fba7b634 100644 --- a/testing/adios2/bindings/fortran/TestBPReadGlobalsByName.F90 +++ b/testing/adios2/bindings/fortran/TestBPReadGlobalsByName.F90 @@ -38,7 +38,10 @@ program TestBPReadGlobalsByName call adios2_put(writer, "sml_outpsi", 0.295477_8, ierr) call adios2_close(writer, ierr) - if(ierr /= 0) stop 'Problems writing' + if(ierr /= 0) then + write(*,*) 'Problems writing' + stop 1 + end if call MPI_Barrier(MPI_COMM_WORLD, ierr) ! reader @@ -60,11 +63,13 @@ program TestBPReadGlobalsByName print *, irank, 'sml_outpsi', sml_outpsi if( diag_1d_nsp /= 1 ) then - stop 'diag_1d_nsp is not 1' + write(*,*) 'diag_1d_nsp is not 1' + stop 1 end if if( sml_outpsi /= 0.295477_8 ) then - stop 'sml_outpsi is not 0.295477' + write(*,*) 'sml_outpsi is not 0.295477' + stop 1 end if call MPI_Finalize(ierr) diff --git a/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead2D.F90 b/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead2D.F90 index fe56398890..6e37bc44b7 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead2D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead2D.F90 @@ -156,64 +156,172 @@ program TestBPWriteMemorySelectionRead2D expected_max = current_step call adios2_inquire_variable(vars_in(1), ioGet, 'var_i1', ierr) - if( vars_in(1)%valid .eqv. .false. ) stop 'i1 invalid error' - if( vars_in(1)%name /= 'var_i1' ) stop 'i1 name error' - if( vars_in(1)%type /= adios2_type_integer1 ) stop 'i1 type error' - if( vars_in(1)%ndims /= 2 ) stop 'i1 dims error' + if( vars_in(1)%valid .eqv. .false. ) then + write(*,*) 'i1 invalid error' + stop 1 + end if + if( vars_in(1)%name /= 'var_i1' ) then + write(*,*) 'i1 name error' + stop 1 + end if + if( vars_in(1)%type /= adios2_type_integer1 ) then + write(*,*) 'i1 type error' + stop 1 + end if + if( vars_in(1)%ndims /= 2 ) then + write(*,*) 'i1 dims error' + stop 1 + end if call adios2_variable_min(min_i1, vars_in(1), ierr) - if(min_i1 /= expected_min ) stop 'i1 min error' + if(min_i1 /= expected_min ) then + write(*,*) 'i1 min error' + stop 1 + end if call adios2_variable_max(max_i1, vars_in(1), ierr) - if(max_i1 /= expected_max ) stop 'i1 max error' + if(max_i1 /= expected_max ) then + write(*,*) 'i1 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(2), ioGet, 'var_i2', ierr) - if( vars_in(2)%valid .eqv. .false. ) stop 'i2 invalid error' - if( vars_in(2)%name /= 'var_i2' ) stop 'i2 name error' - if( vars_in(2)%type /= adios2_type_integer2 ) stop 'i2 type error' - if( vars_in(2)%ndims /= 2 ) stop 'i2 dims error' + if( vars_in(2)%valid .eqv. .false. ) then + write(*,*) 'i2 invalid error' + stop 1 + end if + if( vars_in(2)%name /= 'var_i2' ) then + write(*,*) 'i2 name error' + stop 1 + end if + if( vars_in(2)%type /= adios2_type_integer2 ) then + write(*,*) 'i2 type error' + stop 1 + end if + if( vars_in(2)%ndims /= 2 ) then + write(*,*) 'i2 dims error' + stop 1 + end if call adios2_variable_min(min_i2, vars_in(2), ierr) - if(min_i2 /= expected_min ) stop 'i2 min error' + if(min_i2 /= expected_min ) then + write(*,*) 'i2 min error' + stop 1 + end if call adios2_variable_max(max_i2, vars_in(2), ierr) - if(max_i2 /= expected_max ) stop 'i2 max error' + if(max_i2 /= expected_max ) then + write(*,*) 'i2 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(3), ioGet, 'var_i4', ierr) - if( vars_in(3)%valid .eqv. .false. ) stop 'i4 invalid error' - if( vars_in(3)%name /= 'var_i4' ) stop 'i4 name error' - if( vars_in(3)%type /= adios2_type_integer4 ) stop 'i4 type error' - if( vars_in(3)%ndims /= 2 ) stop 'i4 dims error' + if( vars_in(3)%valid .eqv. .false. ) then + write(*,*) 'i4 invalid error' + stop 1 + end if + if( vars_in(3)%name /= 'var_i4' ) then + write(*,*) 'i4 name error' + stop 1 + end if + if( vars_in(3)%type /= adios2_type_integer4 ) then + write(*,*) 'i4 type error' + stop 1 + end if + if( vars_in(3)%ndims /= 2 ) then + write(*,*) 'i4 dims error' + stop 1 + end if call adios2_variable_min(min_i4, vars_in(3), ierr) - if(min_i4 /= expected_min ) stop 'i4 min error' + if(min_i4 /= expected_min ) then + write(*,*) 'i4 min error' + stop 1 + end if call adios2_variable_max(max_i4, vars_in(3), ierr) - if(max_i4 /= expected_max ) stop 'i4 max error' + if(max_i4 /= expected_max ) then + write(*,*) 'i4 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(4), ioGet, 'var_i8', ierr) - if( vars_in(4)%valid .eqv. .false. ) stop 'i8 invalid error' - if( vars_in(4)%name /= 'var_i8' ) stop 'i8 name error' - if( vars_in(4)%type /= adios2_type_integer8 ) stop 'i8 type error' - if( vars_in(4)%ndims /= 2 ) stop 'i8 dims error' + if( vars_in(4)%valid .eqv. .false. ) then + write(*,*) 'i8 invalid error' + stop 1 + end if + if( vars_in(4)%name /= 'var_i8' ) then + write(*,*) 'i8 name error' + stop 1 + end if + if( vars_in(4)%type /= adios2_type_integer8 ) then + write(*,*) 'i8 type error' + stop 1 + end if + if( vars_in(4)%ndims /= 2 ) then + write(*,*) 'i8 dims error' + stop 1 + end if call adios2_variable_min(min_i8, vars_in(4), ierr) - if(min_i8 /= expected_min ) stop 'i8 min error' + if(min_i8 /= expected_min ) then + write(*,*) 'i8 min error' + stop 1 + end if call adios2_variable_max(max_i8, vars_in(4), ierr) - if(max_i8 /= expected_max ) stop 'i8 max error' + if(max_i8 /= expected_max ) then + write(*,*) 'i8 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(5), ioGet, 'var_r4', ierr) - if( vars_in(5)%valid .eqv. .false. ) stop 'r4 invalid error' - if( vars_in(5)%name /= 'var_r4' ) stop 'r4 name error' - if( vars_in(5)%type /= adios2_type_real ) stop 'r4 type error' - if( vars_in(5)%ndims /= 2 ) stop 'r4 dims error' + if( vars_in(5)%valid .eqv. .false. ) then + write(*,*) 'r4 invalid error' + stop 1 + end if + if( vars_in(5)%name /= 'var_r4' ) then + write(*,*) 'r4 name error' + stop 1 + end if + if( vars_in(5)%type /= adios2_type_real ) then + write(*,*) 'r4 type error' + stop 1 + end if + if( vars_in(5)%ndims /= 2 ) then + write(*,*) 'r4 dims error' + stop 1 + end if call adios2_variable_min(min_r4, vars_in(5), ierr) - if(min_r4 /= float(expected_min) ) stop 'r4 min error' + if(min_r4 /= float(expected_min) ) then + write(*,*) 'r4 min error' + stop 1 + end if call adios2_variable_max(max_r4, vars_in(5), ierr) - if(max_r4 /= float(expected_max) ) stop 'r4 max error' + if(max_r4 /= float(expected_max) ) then + write(*,*) 'r4 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(6), ioGet, 'var_r8', ierr) - if( vars_in(6)%valid .eqv. .false. ) stop 'r8 invalid error' - if( vars_in(6)%name /= 'var_r8' ) stop 'r8 name error' - if( vars_in(6)%type /= adios2_type_dp ) stop 'r8 type error' - if( vars_in(6)%ndims /= 2 ) stop 'r8 dims error' + if( vars_in(6)%valid .eqv. .false. ) then + write(*,*) 'r8 invalid error' + stop 1 + end if + if( vars_in(6)%name /= 'var_r8' ) then + write(*,*) 'r8 name error' + stop 1 + end if + if( vars_in(6)%type /= adios2_type_dp ) then + write(*,*) 'r8 type error' + stop 1 + end if + if( vars_in(6)%ndims /= 2 ) then + write(*,*) 'r8 dims error' + stop 1 + end if call adios2_variable_min(min_r8, vars_in(6), ierr) - if(min_r8 /= float(expected_min) ) stop 'r8 min error' + if(min_r8 /= float(expected_min) ) then + write(*,*) 'r8 min error' + stop 1 + end if call adios2_variable_max(max_r8, vars_in(6), ierr) - if(max_r8 /= float(expected_max) ) stop 'r8 max error' + if(max_r8 /= float(expected_max) ) then + write(*,*) 'r8 max error' + stop 1 + end if call adios2_get(bpReader, 'var_i1', in_data_i1, ierr) call adios2_get(bpReader, 'var_i2', in_data_i2, ierr) @@ -225,12 +333,30 @@ program TestBPWriteMemorySelectionRead2D do j=1,isize*ny do i=1,nx - if(in_data_i1(i,j) /= current_step) stop 'i1 read error' - if(in_data_i2(i,j) /= current_step) stop 'i2 read error' - if(in_data_i4(i,j) /= current_step) stop 'i4 read error' - if(in_data_i8(i,j) /= current_step) stop 'i8 read rerror' - if(in_data_r4(i,j) /= REAL(current_step, 4)) stop 'r4 read error' - if(in_data_r8(i,j) /= current_step) stop 'r8 read rerror' + if(in_data_i1(i,j) /= current_step) then + write(*,*) 'i1 read error' + stop 1 + end if + if(in_data_i2(i,j) /= current_step) then + write(*,*) 'i2 read error' + stop 1 + end if + if(in_data_i4(i,j) /= current_step) then + write(*,*) 'i4 read error' + stop 1 + end if + if(in_data_i8(i,j) /= current_step) then + write(*,*) 'i8 read rerror' + stop 1 + end if + if(in_data_r4(i,j) /= REAL(current_step, 4)) then + write(*,*) 'r4 read error' + stop 1 + end if + if(in_data_r8(i,j) /= current_step) then + write(*,*) 'r8 read rerror' + stop 1 + end if end do end do diff --git a/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead3D.F90 b/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead3D.F90 index 498c815f0e..a4721bf7dc 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead3D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteMemorySelectionRead3D.F90 @@ -156,64 +156,172 @@ program TestBPWriteMemorySelectionRead3D expected_max = current_step call adios2_inquire_variable(vars_in(1), ioGet, 'var_i1', ierr) - if( vars_in(1)%valid .eqv. .false. ) stop 'i1 invalid error' - if( vars_in(1)%name /= 'var_i1' ) stop 'i1 name error' - if( vars_in(1)%type /= adios2_type_integer1 ) stop 'i1 type error' - if( vars_in(1)%ndims /= 3 ) stop 'i1 dims error' + if( vars_in(1)%valid .eqv. .false. ) then + write(*,*) 'i1 invalid error' + stop 1 + end if + if( vars_in(1)%name /= 'var_i1' ) then + write(*,*) 'i1 name error' + stop 1 + end if + if( vars_in(1)%type /= adios2_type_integer1 ) then + write(*,*) 'i1 type error' + stop 1 + end if + if( vars_in(1)%ndims /= 3 ) then + write(*,*) 'i1 dims error' + stop 1 + end if call adios2_variable_min(min_i1, vars_in(1), ierr) - if(min_i1 /= expected_min ) stop 'i1 min error' + if(min_i1 /= expected_min ) then + write(*,*) 'i1 min error' + stop 1 + end if call adios2_variable_max(max_i1, vars_in(1), ierr) - if(max_i1 /= expected_max ) stop 'i1 max error' + if(max_i1 /= expected_max ) then + write(*,*) 'i1 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(2), ioGet, 'var_i2', ierr) - if( vars_in(2)%valid .eqv. .false. ) stop 'i2 invalid error' - if( vars_in(2)%name /= 'var_i2' ) stop 'i2 name error' - if( vars_in(2)%type /= adios2_type_integer2 ) stop 'i2 type error' - if( vars_in(2)%ndims /= 3 ) stop 'i2 dims error' + if( vars_in(2)%valid .eqv. .false. ) then + write(*,*) 'i2 invalid error' + stop 1 + end if + if( vars_in(2)%name /= 'var_i2' ) then + write(*,*) 'i2 name error' + stop 1 + end if + if( vars_in(2)%type /= adios2_type_integer2 ) then + write(*,*) 'i2 type error' + stop 1 + end if + if( vars_in(2)%ndims /= 3 ) then + write(*,*) 'i2 dims error' + stop 1 + end if call adios2_variable_min(min_i2, vars_in(2), ierr) - if(min_i2 /= expected_min ) stop 'i2 min error' + if(min_i2 /= expected_min ) then + write(*,*) 'i2 min error' + stop 1 + end if call adios2_variable_max(max_i2, vars_in(2), ierr) - if(max_i2 /= expected_max ) stop 'i2 max error' + if(max_i2 /= expected_max ) then + write(*,*) 'i2 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(3), ioGet, 'var_i4', ierr) - if( vars_in(3)%valid .eqv. .false. ) stop 'i4 invalid error' - if( vars_in(3)%name /= 'var_i4' ) stop 'i4 name error' - if( vars_in(3)%type /= adios2_type_integer4 ) stop 'i4 type error' - if( vars_in(3)%ndims /= 3 ) stop 'i4 dims error' + if( vars_in(3)%valid .eqv. .false. ) then + write(*,*) 'i4 invalid error' + stop 1 + end if + if( vars_in(3)%name /= 'var_i4' ) then + write(*,*) 'i4 name error' + stop 1 + end if + if( vars_in(3)%type /= adios2_type_integer4 ) then + write(*,*) 'i4 type error' + stop 1 + end if + if( vars_in(3)%ndims /= 3 ) then + write(*,*) 'i4 dims error' + stop 1 + end if call adios2_variable_min(min_i4, vars_in(3), ierr) - if(min_i4 /= expected_min ) stop 'i4 min error' + if(min_i4 /= expected_min ) then + write(*,*) 'i4 min error' + stop 1 + end if call adios2_variable_max(max_i4, vars_in(3), ierr) - if(max_i4 /= expected_max ) stop 'i4 max error' + if(max_i4 /= expected_max ) then + write(*,*) 'i4 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(4), ioGet, 'var_i8', ierr) - if( vars_in(4)%valid .eqv. .false. ) stop 'i8 invalid error' - if( vars_in(4)%name /= 'var_i8' ) stop 'i8 name error' - if( vars_in(4)%type /= adios2_type_integer8 ) stop 'i8 type error' - if( vars_in(4)%ndims /= 3 ) stop 'i8 dims error' + if( vars_in(4)%valid .eqv. .false. ) then + write(*,*) 'i8 invalid error' + stop 1 + end if + if( vars_in(4)%name /= 'var_i8' ) then + write(*,*) 'i8 name error' + stop 1 + end if + if( vars_in(4)%type /= adios2_type_integer8 ) then + write(*,*) 'i8 type error' + stop 1 + end if + if( vars_in(4)%ndims /= 3 ) then + write(*,*) 'i8 dims error' + stop 1 + end if call adios2_variable_min(min_i8, vars_in(4), ierr) - if(min_i8 /= expected_min ) stop 'i8 min error' + if(min_i8 /= expected_min ) then + write(*,*) 'i8 min error' + stop 1 + end if call adios2_variable_max(max_i8, vars_in(4), ierr) - if(max_i8 /= expected_max ) stop 'i8 max error' + if(max_i8 /= expected_max ) then + write(*,*) 'i8 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(5), ioGet, 'var_r4', ierr) - if( vars_in(5)%valid .eqv. .false. ) stop 'r4 invalid error' - if( vars_in(5)%name /= 'var_r4' ) stop 'r4 name error' - if( vars_in(5)%type /= adios2_type_real ) stop 'r4 type error' - if( vars_in(5)%ndims /= 3 ) stop 'r4 dims error' + if( vars_in(5)%valid .eqv. .false. ) then + write(*,*) 'r4 invalid error' + stop 1 + end if + if( vars_in(5)%name /= 'var_r4' ) then + write(*,*) 'r4 name error' + stop 1 + end if + if( vars_in(5)%type /= adios2_type_real ) then + write(*,*) 'r4 type error' + stop 1 + end if + if( vars_in(5)%ndims /= 3 ) then + write(*,*) 'r4 dims error' + stop 1 + end if call adios2_variable_min(min_r4, vars_in(5), ierr) - if(min_r4 /= float(expected_min) ) stop 'r4 min error' + if(min_r4 /= float(expected_min) ) then + write(*,*) 'r4 min error' + stop 1 + end if call adios2_variable_max(max_r4, vars_in(5), ierr) - if(max_r4 /= float(expected_max) ) stop 'r4 max error' + if(max_r4 /= float(expected_max) ) then + write(*,*) 'r4 max error' + stop 1 + end if call adios2_inquire_variable(vars_in(6), ioGet, 'var_r8', ierr) - if( vars_in(6)%valid .eqv. .false. ) stop 'r8 invalid error' - if( vars_in(6)%name /= 'var_r8' ) stop 'r8 name error' - if( vars_in(6)%type /= adios2_type_dp ) stop 'r8 type error' - if( vars_in(6)%ndims /= 3 ) stop 'r8 dims error' + if( vars_in(6)%valid .eqv. .false. ) then + write(*,*) 'r8 invalid error' + stop 1 + end if + if( vars_in(6)%name /= 'var_r8' ) then + write(*,*) 'r8 name error' + stop 1 + end if + if( vars_in(6)%type /= adios2_type_dp ) then + write(*,*) 'r8 type error' + stop 1 + end if + if( vars_in(6)%ndims /= 3 ) then + write(*,*) 'r8 dims error' + stop 1 + end if call adios2_variable_min(min_r8, vars_in(6), ierr) - if(min_r8 /= float(expected_min) ) stop 'r8 min error' + if(min_r8 /= float(expected_min) ) then + write(*,*) 'r8 min error' + stop 1 + end if call adios2_variable_max(max_r8, vars_in(6), ierr) - if(max_r8 /= float(expected_max) ) stop 'r8 max error' + if(max_r8 /= float(expected_max) ) then + write(*,*) 'r8 max error' + stop 1 + end if call adios2_get(bpReader, 'var_i1', in_data_i1, ierr) call adios2_get(bpReader, 'var_i2', in_data_i2, ierr) @@ -226,12 +334,30 @@ program TestBPWriteMemorySelectionRead3D do k=1,isize*nz do j=1,ny do i=1,nx - if(in_data_i1(i,j,k) /= current_step) stop 'i1 read error' - if(in_data_i2(i,j,k) /= current_step) stop 'i2 read error' - if(in_data_i4(i,j,k) /= current_step) stop 'i4 read error' - if(in_data_i8(i,j,k) /= current_step) stop 'i8 read error' - if(in_data_r4(i,j,k) /= REAL(current_step, 4)) stop 'r4 read error' - if(in_data_r8(i,j,k) /= current_step) stop 'r8 read error' + if(in_data_i1(i,j,k) /= current_step) then + write(*,*) 'i1 read error' + stop 1 + end if + if(in_data_i2(i,j,k) /= current_step) then + write(*,*) 'i2 read error' + stop 1 + end if + if(in_data_i4(i,j,k) /= current_step) then + write(*,*) 'i4 read error' + stop 1 + end if + if(in_data_i8(i,j,k) /= current_step) then + write(*,*) 'i8 read error' + stop 1 + end if + if(in_data_r4(i,j,k) /= REAL(current_step, 4)) then + write(*,*) 'r4 read error' + stop 1 + end if + if(in_data_r8(i,j,k) /= current_step) then + write(*,*) 'r8 read error' + stop 1 + end if end do end do end do diff --git a/testing/adios2/bindings/fortran/TestBPWriteReadAttributes.F90 b/testing/adios2/bindings/fortran/TestBPWriteReadAttributes.F90 index d08ac47a5a..583aa83b77 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteReadAttributes.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteReadAttributes.F90 @@ -45,7 +45,10 @@ program TestBPWriteAttributes call adios2_declare_io(ioWrite, adios, "ioWrite", ierr) do i=1,14 - if( attributes(i)%valid .eqv. .true. ) stop 'Invalid attribute default' + if( attributes(i)%valid .eqv. .true. ) then + write(*,*) 'Invalid attribute default' + stop 1 + end if end do ! single value @@ -93,12 +96,18 @@ program TestBPWriteAttributes data_R64, 3, ierr) do i=1,14 - if( attributes(i)%valid .eqv. .false. ) stop 'Invalid adios2_define_attribute' + if( attributes(i)%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_define_attribute' + stop 1 + end if end do ! Testing adios2_attribute_name for just one case call adios2_attribute_name(attrName, attributes(1), ierr) - if (attrName /= 'att_String') stop 'Invalid adios2_attribute_name' + if (attrName /= 'att_String') then + write(*,*) 'Invalid adios2_attribute_name' + stop 1 + end if deallocate(attrName) call adios2_open(bpWriter, ioWrite, "fattr_types.bp", adios2_mode_write, & @@ -116,23 +125,41 @@ program TestBPWriteAttributes ! Test getting list of attribute names call adios2_available_attributes(ioRead, namestruct, ierr) - if (ierr /= 0) stop 'adios2_available_attributes returned with error' - if (.not.namestruct%valid) stop 'adios2_available_attributes returned invalid struct' + if (ierr /= 0) then + write(*,*) 'adios2_available_attributes returned with error' + stop 1 + end if + if (.not.namestruct%valid) then + write(*,*) 'adios2_available_attributes returned invalid struct' + stop 1 + end if write(*,*) 'Number of attributes = ', namestruct%count write(*,*) 'Max name length = ', namestruct%max_name_len - if (namestruct%count /= 14) stop 'adios2_available_attributes returned not the expected 14' + if (namestruct%count /= 14) then + write(*,*) 'adios2_available_attributes returned not the expected 14' + stop 1 + end if allocate(attrnamelist(namestruct%count)) call adios2_retrieve_names(namestruct, attrnamelist, ierr) - if (ierr /= 0) stop 'adios2_retrieve_names returned with error' + if (ierr /= 0) then + write(*,*) 'adios2_retrieve_names returned with error' + stop 1 + end if do i=1,namestruct%count write(*,'("Attr[",i2,"] = ",a20)') i, attrnamelist(i) end do deallocate(attrnamelist) - if (namestruct%f2c /= 0_8) stop 'namestruct f2c pointer is not null after adios2_retrieve_names()' - if (namestruct%valid) stop 'namestruct is not invalidated after adios2_retrieve_names()' + if (namestruct%f2c /= 0_8) then + write(*,*) 'namestruct f2c pointer is not null after adios2_retrieve_names()' + stop 1 + end if + if (namestruct%valid) then + write(*,*) 'namestruct is not invalidated after adios2_retrieve_names()' + stop 1 + end if call adios2_inquire_attribute(attributes_in(1), ioRead, 'att_String', ierr) @@ -143,54 +170,159 @@ program TestBPWriteAttributes call adios2_inquire_attribute(attributes_in(6), ioRead, 'att_r32', ierr) call adios2_inquire_attribute(attributes_in(7), ioRead, 'att_r64', ierr) - if(attributes_in(1)%valid .eqv. .false.) stop 'attribute iString not found' - if(attributes_in(1)%type /= adios2_type_string) stop 'attribute iString wrong type' - if(attributes_in(1)%length /= 1) stop 'attribute iString length is not 1' - if(attributes_in(1)%is_value .eqv. .false.) stop 'attribute iString must be value' + if(attributes_in(1)%valid .eqv. .false.) then + write(*,*) 'attribute iString not found' + stop 1 + end if + if(attributes_in(1)%type /= adios2_type_string) then + write(*,*) 'attribute iString wrong type' + stop 1 + end if + if(attributes_in(1)%length /= 1) then + write(*,*) 'attribute iString length is not 1' + stop 1 + end if + if(attributes_in(1)%is_value .eqv. .false.) then + write(*,*) 'attribute iString must be value' + stop 1 + end if call adios2_attribute_data( iString_value, attributes_in(1), ierr) - if( iString_value /= 'ADIOS2 String attribute' ) stop 'attribute iString data error' - - if(attributes_in(2)%valid .eqv. .false.) stop 'attribute i8 not found' - if(attributes_in(2)%type /= adios2_type_integer1) stop 'attribute i8 wrong type' - if(attributes_in(2)%length /= 1) stop 'attribute i8 length is not 1' - if(attributes_in(2)%is_value .eqv. .false.) stop 'attribute i8 must be value' + if( iString_value /= 'ADIOS2 String attribute' ) then + write(*,*) 'attribute iString data error' + stop 1 + end if + + if(attributes_in(2)%valid .eqv. .false.) then + write(*,*) 'attribute i8 not found' + stop 1 + end if + if(attributes_in(2)%type /= adios2_type_integer1) then + write(*,*) 'attribute i8 wrong type' + stop 1 + end if + if(attributes_in(2)%length /= 1) then + write(*,*) 'attribute i8 length is not 1' + stop 1 + end if + if(attributes_in(2)%is_value .eqv. .false.) then + write(*,*) 'attribute i8 must be value' + stop 1 + end if call adios2_attribute_data( i8_value, attributes_in(2), ierr) - if( i8_value /= data_I8(1) ) stop 'attribute i8 data error' - - if(attributes_in(3)%valid .eqv. .false.) stop 'attribute i16 not found' - if(attributes_in(3)%type /= adios2_type_integer2) stop 'attribute i16 wrong type' - if(attributes_in(3)%length /= 1) stop 'attribute i16 length is not 1' - if(attributes_in(3)%is_value .eqv. .false.) stop 'attribute i16 must be value' + if( i8_value /= data_I8(1) ) then + write(*,*) 'attribute i8 data error' + stop 1 + end if + + if(attributes_in(3)%valid .eqv. .false.) then + write(*,*) 'attribute i16 not found' + stop 1 + end if + if(attributes_in(3)%type /= adios2_type_integer2) then + write(*,*) 'attribute i16 wrong type' + stop 1 + end if + if(attributes_in(3)%length /= 1) then + write(*,*) 'attribute i16 length is not 1' + stop 1 + end if + if(attributes_in(3)%is_value .eqv. .false.) then + write(*,*) 'attribute i16 must be value' + stop 1 + end if call adios2_attribute_data( i16_value, attributes_in(3), ierr) - if( i16_value /= data_I16(1) ) stop 'attribute i16 data error' - - if(attributes_in(4)%valid .eqv. .false.) stop 'attribute i32 not found' - if(attributes_in(4)%type /= adios2_type_integer4) stop 'attribute i32 wrong type' - if(attributes_in(4)%length /= 1) stop 'attribute i32 length is not 1' - if(attributes_in(4)%is_value .eqv. .false.) stop 'attribute i32 must be value' + if( i16_value /= data_I16(1) ) then + write(*,*) 'attribute i16 data error' + stop 1 + end if + + if(attributes_in(4)%valid .eqv. .false.) then + write(*,*) 'attribute i32 not found' + stop 1 + end if + if(attributes_in(4)%type /= adios2_type_integer4) then + write(*,*) 'attribute i32 wrong type' + stop 1 + end if + if(attributes_in(4)%length /= 1) then + write(*,*) 'attribute i32 length is not 1' + stop 1 + end if + if(attributes_in(4)%is_value .eqv. .false.) then + write(*,*) 'attribute i32 must be value' + stop 1 + end if call adios2_attribute_data( i32_value, attributes_in(4), ierr) - if( i32_value /= data_I32(1) ) stop 'attribute i32 data error' - - if(attributes_in(5)%valid .eqv. .false.) stop 'attribute i64 not found' - if(attributes_in(5)%type /= adios2_type_integer8) stop 'attribute i64 wrong type' - if(attributes_in(5)%length /= 1) stop 'attribute i64 length is not 1' - if(attributes_in(5)%is_value .eqv. .false.) stop 'attribute i64 must be value' + if( i32_value /= data_I32(1) ) then + write(*,*) 'attribute i32 data error' + stop 1 + end if + + if(attributes_in(5)%valid .eqv. .false.) then + write(*,*) 'attribute i64 not found' + stop 1 + end if + if(attributes_in(5)%type /= adios2_type_integer8) then + write(*,*) 'attribute i64 wrong type' + stop 1 + end if + if(attributes_in(5)%length /= 1) then + write(*,*) 'attribute i64 length is not 1' + stop 1 + end if + if(attributes_in(5)%is_value .eqv. .false.) then + write(*,*) 'attribute i64 must be value' + stop 1 + end if call adios2_attribute_data( i64_value, attributes_in(5), ierr) - if( i64_value /= data_I64(1) ) stop 'attribute i64 data error' - - if(attributes_in(6)%valid .eqv. .false.) stop 'attribute r32 not found' - if(attributes_in(6)%type /= adios2_type_real) stop 'attribute r32 wrong type' - if(attributes_in(6)%length /= 1) stop 'attribute r32 length is not 1' - if(attributes_in(6)%is_value .eqv. .false.) stop 'attribute r32 must be value' + if( i64_value /= data_I64(1) ) then + write(*,*) 'attribute i64 data error' + stop 1 + end if + + if(attributes_in(6)%valid .eqv. .false.) then + write(*,*) 'attribute r32 not found' + stop 1 + end if + if(attributes_in(6)%type /= adios2_type_real) then + write(*,*) 'attribute r32 wrong type' + stop 1 + end if + if(attributes_in(6)%length /= 1) then + write(*,*) 'attribute r32 length is not 1' + stop 1 + end if + if(attributes_in(6)%is_value .eqv. .false.) then + write(*,*) 'attribute r32 must be value' + stop 1 + end if call adios2_attribute_data( r32_value, attributes_in(6), ierr) - if( r32_value /= data_R32(1) ) stop 'attribute r32 data error' - - if(attributes_in(7)%valid .eqv. .false.) stop 'attribute r64 not found' - if(attributes_in(7)%type /= adios2_type_dp) stop 'attribute r64 wrong type' - if(attributes_in(7)%length /= 1) stop 'attribute r64 length is not 1' - if(attributes_in(7)%is_value .eqv. .false.) stop 'attribute r64 must be value' + if( r32_value /= data_R32(1) ) then + write(*,*) 'attribute r32 data error' + stop 1 + end if + + if(attributes_in(7)%valid .eqv. .false.) then + write(*,*) 'attribute r64 not found' + stop 1 + end if + if(attributes_in(7)%type /= adios2_type_dp) then + write(*,*) 'attribute r64 wrong type' + stop 1 + end if + if(attributes_in(7)%length /= 1) then + write(*,*) 'attribute r64 length is not 1' + stop 1 + end if + if(attributes_in(7)%is_value .eqv. .false.) then + write(*,*) 'attribute r64 must be value' + stop 1 + end if call adios2_attribute_data( r64_value, attributes_in(7), ierr) - if( r64_value /= data_R64(1) ) stop 'attribute r64 data error' + if( r64_value /= data_R64(1) ) then + write(*,*) 'attribute r64 data error' + stop 1 + end if ! Array call adios2_inquire_attribute(attributes_in(8), ioRead, 'att_Strings_array', ierr) @@ -201,67 +333,172 @@ program TestBPWriteAttributes call adios2_inquire_attribute(attributes_in(13), ioRead, 'att_r32_array', ierr) call adios2_inquire_attribute(attributes_in(14), ioRead, 'att_r64_array', ierr) - if(attributes_in(8)%valid .eqv. .false.) stop 'attribute string array not found' - if(attributes_in(8)%type /= adios2_type_string) stop 'attribute string array wrong type' - if(attributes_in(8)%length /= 3) stop 'attribute string array length is not 3' - if(attributes_in(8)%is_value .eqv. .true.) stop 'attribute string array must be array' + if(attributes_in(8)%valid .eqv. .false.) then + write(*,*) 'attribute string array not found' + stop 1 + end if + if(attributes_in(8)%type /= adios2_type_string) then + write(*,*) 'attribute string array wrong type' + stop 1 + end if + if(attributes_in(8)%length /= 3) then + write(*,*) 'attribute string array length is not 3' + stop 1 + end if + if(attributes_in(8)%is_value .eqv. .true.) then + write(*,*) 'attribute string array must be array' + stop 1 + end if call adios2_attribute_data( iString_array, attributes_in(8), ierr) do i=1,3 - if( iString_array(i) /= data_Strings(i) ) stop 'attribute string array data error' + if( iString_array(i) /= data_Strings(i) ) then + write(*,*) 'attribute string array data error' + stop 1 + end if end do - if(attributes_in(9)%valid .eqv. .false.) stop 'attribute i8 array not found' - if(attributes_in(9)%type /= adios2_type_integer1) stop 'attribute i8 array wrong type' - if(attributes_in(9)%length /= 3) stop 'attribute i8 array length is not 3' - if(attributes_in(9)%is_value .eqv. .true.) stop 'attribute i8 array must be array' + if(attributes_in(9)%valid .eqv. .false.) then + write(*,*) 'attribute i8 array not found' + stop 1 + end if + if(attributes_in(9)%type /= adios2_type_integer1) then + write(*,*) 'attribute i8 array wrong type' + stop 1 + end if + if(attributes_in(9)%length /= 3) then + write(*,*) 'attribute i8 array length is not 3' + stop 1 + end if + if(attributes_in(9)%is_value .eqv. .true.) then + write(*,*) 'attribute i8 array must be array' + stop 1 + end if call adios2_attribute_data( i8_array, attributes_in(9), ierr) do i=1,3 - if( i8_array(i) /= data_I8(i) ) stop 'attribute i8 array data error' + if( i8_array(i) /= data_I8(i) ) then + write(*,*) 'attribute i8 array data error' + stop 1 + end if end do - if(attributes_in(10)%valid .eqv. .false.) stop 'attribute i16 array not found' - if(attributes_in(10)%type /= adios2_type_integer2) stop 'attribute i16 array wrong type' - if(attributes_in(10)%length /= 3) stop 'attribute i16 array length is not 3' - if(attributes_in(10)%is_value .eqv. .true.) stop 'attribute i16 array must be array' + if(attributes_in(10)%valid .eqv. .false.) then + write(*,*) 'attribute i16 array not found' + stop 1 + end if + if(attributes_in(10)%type /= adios2_type_integer2) then + write(*,*) 'attribute i16 array wrong type' + stop 1 + end if + if(attributes_in(10)%length /= 3) then + write(*,*) 'attribute i16 array length is not 3' + stop 1 + end if + if(attributes_in(10)%is_value .eqv. .true.) then + write(*,*) 'attribute i16 array must be array' + stop 1 + end if call adios2_attribute_data( i16_array, attributes_in(10), ierr) do i=1,3 - if( i16_array(i) /= data_I16(i) ) stop 'attribute i16 array data error' + if( i16_array(i) /= data_I16(i) ) then + write(*,*) 'attribute i16 array data error' + stop 1 + end if end do - if(attributes_in(11)%valid .eqv. .false.) stop 'attribute i32 array not found' - if(attributes_in(11)%type /= adios2_type_integer4) stop 'attribute i32 array wrong type' - if(attributes_in(11)%length /= 3) stop 'attribute i32 array length is not 3' - if(attributes_in(11)%is_value .eqv. .true.) stop 'attribute i32 array must be array' + if(attributes_in(11)%valid .eqv. .false.) then + write(*,*) 'attribute i32 array not found' + stop 1 + end if + if(attributes_in(11)%type /= adios2_type_integer4) then + write(*,*) 'attribute i32 array wrong type' + stop 1 + end if + if(attributes_in(11)%length /= 3) then + write(*,*) 'attribute i32 array length is not 3' + stop 1 + end if + if(attributes_in(11)%is_value .eqv. .true.) then + write(*,*) 'attribute i32 array must be array' + stop 1 + end if call adios2_attribute_data( i32_array, attributes_in(11), ierr) do i=1,3 - if( i32_array(i) /= data_I32(i) ) stop 'attribute i32 array data error' + if( i32_array(i) /= data_I32(i) ) then + write(*,*) 'attribute i32 array data error' + stop 1 + end if end do - if(attributes_in(12)%valid .eqv. .false.) stop 'attribute i64 array not found' - if(attributes_in(12)%type /= adios2_type_integer8) stop 'attribute i64 array wrong type' - if(attributes_in(12)%length /= 3) stop 'attribute i64 array length is not 3' - if(attributes_in(12)%is_value .eqv. .true.) stop 'attribute i64 array must be array' + if(attributes_in(12)%valid .eqv. .false.) then + write(*,*) 'attribute i64 array not found' + stop 1 + end if + if(attributes_in(12)%type /= adios2_type_integer8) then + write(*,*) 'attribute i64 array wrong type' + stop 1 + end if + if(attributes_in(12)%length /= 3) then + write(*,*) 'attribute i64 array length is not 3' + stop 1 + end if + if(attributes_in(12)%is_value .eqv. .true.) then + write(*,*) 'attribute i64 array must be array' + stop 1 + end if call adios2_attribute_data( i64_array, attributes_in(12), ierr) do i=1,3 - if( i64_array(i) /= data_I64(i) ) stop 'attribute i64 array data error' + if( i64_array(i) /= data_I64(i) ) then + write(*,*) 'attribute i64 array data error' + stop 1 + end if end do - if(attributes_in(13)%valid .eqv. .false.) stop 'attribute r32 array not found' - if(attributes_in(13)%type /= adios2_type_real) stop 'attribute r32 array wrong type' - if(attributes_in(13)%length /= 3) stop 'attribute r32 array length is not 3' - if(attributes_in(13)%is_value .eqv. .true.) stop 'attribute r32 array must be array' + if(attributes_in(13)%valid .eqv. .false.) then + write(*,*) 'attribute r32 array not found' + stop 1 + end if + if(attributes_in(13)%type /= adios2_type_real) then + write(*,*) 'attribute r32 array wrong type' + stop 1 + end if + if(attributes_in(13)%length /= 3) then + write(*,*) 'attribute r32 array length is not 3' + stop 1 + end if + if(attributes_in(13)%is_value .eqv. .true.) then + write(*,*) 'attribute r32 array must be array' + stop 1 + end if call adios2_attribute_data( r32_array, attributes_in(13), ierr) do i=1,3 - if( r32_array(i) /= data_R32(i) ) stop 'attribute r32 array data error' + if( r32_array(i) /= data_R32(i) ) then + write(*,*) 'attribute r32 array data error' + stop 1 + end if end do - if(attributes_in(14)%valid .eqv. .false.) stop 'attribute r64 array not found' - if(attributes_in(14)%type /= adios2_type_dp) stop 'attribute r64 array wrong type' - if(attributes_in(14)%length /= 3) stop 'attribute r64 array length is not 3' - if(attributes_in(14)%is_value .eqv. .true.) stop 'attribute r64 array must be array' + if(attributes_in(14)%valid .eqv. .false.) then + write(*,*) 'attribute r64 array not found' + stop 1 + end if + if(attributes_in(14)%type /= adios2_type_dp) then + write(*,*) 'attribute r64 array wrong type' + stop 1 + end if + if(attributes_in(14)%length /= 3) then + write(*,*) 'attribute r64 array length is not 3' + stop 1 + end if + if(attributes_in(14)%is_value .eqv. .true.) then + write(*,*) 'attribute r64 array must be array' + stop 1 + end if call adios2_attribute_data( r64_array, attributes_in(14), ierr) do i=1,3 - if( r64_array(i) /= data_R64(i) ) stop 'attribute r64 array data error' + if( r64_array(i) /= data_R64(i) ) then + write(*,*) 'attribute r64 array data error' + stop 1 + end if end do call adios2_close(bpReader, ierr) diff --git a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap2D.F90 b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap2D.F90 index 510a7d07e2..c18fe044bf 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap2D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap2D.F90 @@ -187,12 +187,30 @@ program TestBPWriteReadHeatMap2D end do end do - if (sum_i1 /= 50*isize) stop 'Test failed integer*1' - if (sum_i2 /= 50*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 50*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 50*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 50*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 50*isize) stop 'Test failed real*8' + if (sum_i1 /= 50*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 50*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 50*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 50*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 50*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 50*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap3D.F90 b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap3D.F90 index 06b7954b0c..55df80789f 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap3D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap3D.F90 @@ -190,12 +190,30 @@ program TestBPWriteReadHeatMap3D end do end do - if (sum_i1 /= 500*isize) stop 'Test failed integer*1' - if (sum_i2 /= 500*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 500*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 500*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 500*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 500*isize) stop 'Test failed real*8' + if (sum_i1 /= 500*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 500*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 500*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 500*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 500*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 500*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap4D.F90 b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap4D.F90 index 3111567d62..ce2711ad7c 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap4D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap4D.F90 @@ -194,12 +194,30 @@ program TestBPWriteReadHeatMap4D end do end do - if (sum_i1 /= 10000*isize) stop 'Test failed integer*1' - if (sum_i2 /= 10000*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 10000*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 10000*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 10000*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 10000*isize) stop 'Test failed real*8' + if (sum_i1 /= 10000*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 10000*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 10000*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 10000*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 10000*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 10000*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap5D.F90 b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap5D.F90 index 20eed9cee1..bc6b970217 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap5D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap5D.F90 @@ -203,12 +203,30 @@ program TestBPWriteReadHeatMap5D end do end do - if (sum_i1 /= 100000*isize) stop 'Test failed integer*1' - if (sum_i2 /= 100000*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 100000*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 100000*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 100000*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 100000*isize) stop 'Test failed real*8' + if (sum_i1 /= 100000*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 100000*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 100000*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 100000*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 100000*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 100000*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap6D.F90 b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap6D.F90 index f749102237..ac9f035156 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap6D.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteReadHeatMap6D.F90 @@ -207,12 +207,30 @@ program TestBPWriteReadHeatMap6D end do end do - if (sum_i1 /= 1000000*isize) stop 'Test failed integer*1' - if (sum_i2 /= 1000000*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 1000000*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 1000000*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 1000000*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 1000000*isize) stop 'Test failed real*8' + if (sum_i1 /= 1000000*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 1000000*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 1000000*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 1000000*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 1000000*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 1000000*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/TestBPWriteTypes.F90 b/testing/adios2/bindings/fortran/TestBPWriteTypes.F90 index 7a8f685181..d5086631ff 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteTypes.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteTypes.F90 @@ -1,325 +1,508 @@ program TestBPWriteTypes - use small_test_data + use small_test_data #if ADIOS2_USE_MPI - use mpi + use mpi #endif - use adios2 - implicit none + use adios2 + implicit none - integer(kind=8), dimension(1) :: shape_dims, start_dims, count_dims - integer(kind=4) :: inx, irank, isize, ierr, i, step_status - integer(kind=8) :: nsteps + integer(kind=8), dimension(1) :: shape_dims, start_dims, count_dims + integer(kind=4) :: inx, irank, isize, ierr, i, step_status + integer(kind=8) :: nsteps - type(adios2_adios) :: adios - type(adios2_io) :: ioWrite, ioRead - type(adios2_variable), dimension(14) :: variables - type(adios2_engine) :: bpWriter, bpReader - character(len=15) :: inString - character(len=:), allocatable :: varName, param_value - character(len=:), allocatable :: engineType - logical :: result + type(adios2_adios) :: adios + type(adios2_io) :: ioWrite, ioRead + type(adios2_variable), dimension(14) :: variables + type(adios2_derived_variable) :: derived_variable + type(adios2_engine) :: bpWriter, bpReader + character(len=15) :: inString + character(len=:), allocatable :: varName, param_value + character(len=:), allocatable :: engineType + logical :: result - ! read local value as global array - integer(kind=4), dimension(:), allocatable :: inRanks + ! read local value as global array + integer(kind=4), dimension(:), allocatable :: inRanks - ! read handlers - integer(kind=4) :: ndims - integer(kind=8), dimension(:), allocatable :: shape_in + ! read handlers + integer(kind=4) :: ndims + integer(kind=8), dimension(:), allocatable :: shape_in - character(len=4096), dimension(:), allocatable :: varnamelist - type(adios2_namestruct) :: namestruct + character(len=4096), dimension(:), allocatable :: varnamelist + type(adios2_namestruct) :: namestruct #if ADIOS2_USE_MPI - ! Launch MPI - INTEGER provided + ! Launch MPI + INTEGER provided - ! MPI_THREAD_MULTIPLE is only required if you enable the SST MPI_DP - call MPI_Init_thread(MPI_THREAD_MULTIPLE, provided, ierr) - call MPI_Comm_rank(MPI_COMM_WORLD, irank, ierr) - call MPI_Comm_size(MPI_COMM_WORLD, isize, ierr) + ! MPI_THREAD_MULTIPLE is only required if you enable the SST MPI_DP + call MPI_Init_thread(MPI_THREAD_MULTIPLE, provided, ierr) + call MPI_Comm_rank(MPI_COMM_WORLD, irank, ierr) + call MPI_Comm_size(MPI_COMM_WORLD, isize, ierr) #else - irank = 0 - isize = 1 + irank = 0 + isize = 1 #endif - ! Application variables - inx = 10 - - ! Variable dimensions - shape_dims(1) = isize*inx - start_dims(1) = irank*inx - count_dims(1) = inx - - if( adios%valid .eqv. .true. ) stop 'Invalid adios default' - if( ioWrite%valid .eqv. .true. ) stop 'Invalid io default' - - do i=1,12 - if( variables(i)%valid .eqv. .true. ) stop 'Invalid variables default' - end do - - if( bpWriter%valid .eqv. .true. ) stop 'Invalid engine default' - - - ! Create adios handler passing the communicator and error flag + ! Application variables + inx = 10 + + ! Variable dimensions + shape_dims(1) = isize*inx + start_dims(1) = irank*inx + count_dims(1) = inx + + if( adios%valid .eqv. .true. ) then + write(*,*) 'Invalid adios default' + stop 1 + end if + if( ioWrite%valid .eqv. .true. ) then + write(*,*) 'Invalid io default' + stop 1 + end if + + do i=1,12 + if( variables(i)%valid .eqv. .true. ) then + write(*,*) 'Invalid variables default' + stop 1 + end if + end do + + if( bpWriter%valid .eqv. .true. ) then + write(*,*) 'Invalid engine default' + stop 1 + end if + + + ! Create adios handler passing the communicator and error flag #if ADIOS2_USE_MPI - call adios2_init(adios, MPI_COMM_WORLD, ierr) + call adios2_init(adios, MPI_COMM_WORLD, ierr) #else - call adios2_init(adios, ierr) + call adios2_init(adios, ierr) #endif - if( adios%valid .eqv. .false. ) stop 'Invalid adios2_init' - - !!!!!!!!!!!!!!!!!!!!!!!! WRITER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! Declare an IO process configuration inside adios - call adios2_declare_io(ioWrite, adios, "ioWrite", ierr) - if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_declare_io' - - call adios2_at_io(ioWrite, adios, "ioWrite", ierr) - if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_at_io' - - call adios2_in_config_file(result, ioWrite, ierr) - if( result .eqv. .true. ) stop 'Invalid ioWrite adios2_in_config_file' - - call adios2_set_engine(ioWrite, 'File', ierr) - - call adios2_set_parameter(ioWrite, 'ProfileUnits', 'Microseconds', ierr) - - call adios2_get_parameter(param_value, ioWrite, 'ProfileUnits', ierr) - if( param_value /= "Microseconds") stop 'Failed adios2_get_parameter ProfileUnits' - - call adios2_set_parameters(ioWrite, 'Threads=2, CollectiveMetadata = OFF', ierr) - - call adios2_get_parameter(param_value, ioWrite, 'Threads', ierr) - if( param_value /= "2") stop 'Failed adios2_get_parameter Threads' - - call adios2_get_parameter(param_value, ioWrite, 'CollectiveMetadata', ierr) - if( param_value /= "OFF") stop 'Failed adios2_get_parameter CollectiveMetadata' - - ! set back the default to make sure writing/reading test works - call adios2_clear_parameters(ioWrite, ierr) - call adios2_get_parameter(param_value, ioWrite, 'CollectiveMetadata', ierr) - if( param_value /= "") stop 'Still Could retrieve parameter CollectiveMetadata after clearing all parameters' - - deallocate(param_value) - - - ! Defines a variable to be written in bp format - call adios2_define_variable(variables(1), ioWrite, "var_I8", & - adios2_type_integer1, 1, & - shape_dims, start_dims, count_dims, & - adios2_constant_dims, ierr) - - call adios2_define_variable(variables(2), ioWrite, "var_I16", & - adios2_type_integer2, 1, & - shape_dims, start_dims, count_dims, & - adios2_constant_dims, ierr) - - call adios2_define_variable(variables(3), ioWrite, "var_I32", & - adios2_type_integer4, 1, & - shape_dims, start_dims, count_dims, & - adios2_constant_dims, ierr) - - call adios2_define_variable(variables(4), ioWrite, "var_I64", & - adios2_type_integer8, 1, & - shape_dims, start_dims, count_dims, & - adios2_constant_dims, ierr) - - call adios2_define_variable(variables(5), ioWrite, "var_R32", & - adios2_type_real, 1, & - shape_dims, start_dims, count_dims, & - adios2_constant_dims, ierr) - - call adios2_define_variable(variables(6), ioWrite, "var_R64", & - adios2_type_dp, 1, & - shape_dims, start_dims, count_dims, & - adios2_constant_dims, ierr) - - ! Global variables - call adios2_define_variable(variables(7), ioWrite, "gvar_I8", & - adios2_type_integer1, ierr) - - call adios2_define_variable(variables(8), ioWrite, "gvar_I16", & - adios2_type_integer2, ierr) - - call adios2_define_variable(variables(9), ioWrite, "gvar_I32", & - adios2_type_integer4, ierr) - - call adios2_define_variable(variables(10), ioWrite, "gvar_I64", & - adios2_type_integer8, ierr) - - call adios2_define_variable(variables(11), ioWrite, "gvar_R32", & - adios2_type_real, ierr) - - call adios2_define_variable(variables(12), ioWrite, "gvar_R64", & - adios2_type_dp, ierr) - - call adios2_define_variable(variables(13), ioWrite, "gvar_Str", & - adios2_type_string, ierr) - - ! local value - call adios2_define_variable(variables(14), ioWrite, "lvar_i32", & - adios2_type_integer4, & - 1, (/ adios2_local_value_dim /), & - adios2_null_dims, & - adios2_null_dims, & - adios2_constant_dims, ierr) - - do i=1,13 - if( variables(i)%valid .eqv. .false. ) stop 'Invalid adios2_define_variable' - end do - - ! Testing adios2_variable_name for just two cases - call adios2_variable_name(varName, variables(1), ierr) - if (varName /= 'var_I8') stop 'Invalid adios2_variable_name' - - call adios2_variable_name(varName, variables(2), ierr) - if (varName /= 'var_I16') stop 'Invalid adios2_variable_name' - - deallocate(varName) + if( adios%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_init' + stop 1 + end if + + !!!!!!!!!!!!!!!!!!!!!!!! WRITER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Declare an IO process configuration inside adios + call adios2_declare_io(ioWrite, adios, "ioWrite", ierr) + if( ioWrite%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_declare_io' + stop 1 + end if + + call adios2_at_io(ioWrite, adios, "ioWrite", ierr) + if( ioWrite%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_at_io' + stop 1 + end if + + call adios2_in_config_file(result, ioWrite, ierr) + if( result .eqv. .true. ) then + write(*,*) 'Invalid ioWrite adios2_in_config_file' + stop 1 + end if + + call adios2_set_engine(ioWrite, 'File', ierr) + + call adios2_set_parameter(ioWrite, 'ProfileUnits', 'Microseconds', ierr) + + call adios2_get_parameter(param_value, ioWrite, 'ProfileUnits', ierr) + if( param_value /= "Microseconds") then + write(*,*) 'Failed adios2_get_parameter ProfileUnits' + stop 1 + end if + + call adios2_set_parameters(ioWrite, 'Threads=2, CollectiveMetadata = OFF', ierr) + + call adios2_get_parameter(param_value, ioWrite, 'Threads', ierr) + if( param_value /= "2") then + write(*,*) 'Failed adios2_get_parameter Threads' + stop 1 + end if + + call adios2_get_parameter(param_value, ioWrite, 'CollectiveMetadata', ierr) + if( param_value /= "OFF") then + write(*,*) 'Failed adios2_get_parameter CollectiveMetadata' + stop 1 + end if + + ! set back the default to make sure writing/reading test works + call adios2_clear_parameters(ioWrite, ierr) + call adios2_get_parameter(param_value, ioWrite, 'CollectiveMetadata', ierr) + if( param_value /= "") then + write(*,*) 'Still Could retrieve parameter CollectiveMetadata after clearing all parameters' + stop 1 + end if + + deallocate(param_value) + + + ! Defines a variable to be written in bp format + call adios2_define_variable(variables(1), ioWrite, "var_I8", & + adios2_type_integer1, 1, & + shape_dims, start_dims, count_dims, & + adios2_constant_dims, ierr) + + call adios2_define_variable(variables(2), ioWrite, "var_I16", & + adios2_type_integer2, 1, & + shape_dims, start_dims, count_dims, & + adios2_constant_dims, ierr) + + call adios2_define_variable(variables(3), ioWrite, "var_I32", & + adios2_type_integer4, 1, & + shape_dims, start_dims, count_dims, & + adios2_constant_dims, ierr) + + call adios2_define_variable(variables(4), ioWrite, "var_I64", & + adios2_type_integer8, 1, & + shape_dims, start_dims, count_dims, & + adios2_constant_dims, ierr) + + call adios2_define_variable(variables(5), ioWrite, "var_R32", & + adios2_type_real, 1, & + shape_dims, start_dims, count_dims, & + adios2_constant_dims, ierr) + + call adios2_define_variable(variables(6), ioWrite, "var_R64", & + adios2_type_dp, 1, & + shape_dims, start_dims, count_dims, & + adios2_constant_dims, ierr) + + ! Global variables + call adios2_define_variable(variables(7), ioWrite, "gvar_I8", & + adios2_type_integer1, ierr) + + call adios2_define_variable(variables(8), ioWrite, "gvar_I16", & + adios2_type_integer2, ierr) + + call adios2_define_variable(variables(9), ioWrite, "gvar_I32", & + adios2_type_integer4, ierr) + + call adios2_define_variable(variables(10), ioWrite, "gvar_I64", & + adios2_type_integer8, ierr) + + call adios2_define_variable(variables(11), ioWrite, "gvar_R32", & + adios2_type_real, ierr) + + call adios2_define_variable(variables(12), ioWrite, "gvar_R64", & + adios2_type_dp, ierr) + + call adios2_define_variable(variables(13), ioWrite, "gvar_Str", & + adios2_type_string, ierr) + + ! local value + call adios2_define_variable(variables(14), ioWrite, "lvar_i32", & + adios2_type_integer4, & + 1, (/ adios2_local_value_dim /), & + adios2_null_dims, & + adios2_null_dims, & + adios2_constant_dims, ierr) + + ! derived variable + call adios2_define_derived_variable(derived_variable, ioWrite, "derived/magnitude_of_var_R64", & + "x=var_R64 y=var_R64 z=var_R64 magnitude(x,y,z)", adios2_derived_var_type_metadata_only, ierr) +#if ADIOS2_HAVE_Derived_Variable +#define TOTAL_VAR_COUNT 15 +#else +#define TOTAL_VAR_COUNT 14 +#endif + do i=1,13 + if( variables(i)%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_define_variable' + stop 1 + end if + end do + + ! Testing adios2_variable_name for just two cases + call adios2_variable_name(varName, variables(1), ierr) + if (varName /= 'var_I8') then + write(*,*) 'Invalid adios2_variable_name' + stop 1 + end if + + call adios2_variable_name(varName, variables(2), ierr) + if (varName /= 'var_I16') then + write(*,*) 'Invalid adios2_variable_name' + stop 1 + end if + + deallocate(varName) + + ! Open myVector_f.bp in write mode, this launches an engine + if( ioWrite%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_io' + stop 1 + end if + if( bpWriter%valid .eqv. .true. ) then + write(*,*) 'Invalid adios2_engine pre-open' + stop 1 + end if - ! Open myVector_f.bp in write mode, this launches an engine - if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_io' - if( bpWriter%valid .eqv. .true. ) stop 'Invalid adios2_engine pre-open' - - call adios2_open(bpWriter, ioWrite, "ftypes.bp", adios2_mode_write, ierr) - - if( bpWriter%valid .eqv. .false. ) stop 'Invalid adios2_engine post-open' - if( TRIM(bpWriter%name) /= "ftypes.bp") stop 'Invalid adios2_engine name' - - if( TRIM(bpWriter%type) /= 'BP5Writer') then - write(*,*) 'Engine Type ', TRIM(bpWriter%type) - stop 'Invalid adios2_engine type' - end if - call adios2_io_engine_type(engineType, ioWrite, ierr) - if( engineType /= 'File') then ! FIXME, different from the above! - write(*,*) 'Engine Type ', engineType - stop 'Invalid type from adios2_engine_type' - end if - - if( bpWriter%mode /= adios2_mode_write) stop 'Invalid adios2_engine mode' - - ! Put array contents to bp buffer, based on var1 metadata - do i = 1, 3 - call adios2_begin_step(bpWriter, adios2_step_mode_append, -1.0, & - step_status, ierr) - - if (irank == 0 .and. i == 1) then - call adios2_put(bpWriter, variables(7), data_I8(1), ierr) - call adios2_put(bpWriter, variables(8), data_I16(1), ierr) - call adios2_put(bpWriter, variables(9), data_I32(1), ierr) - call adios2_put(bpWriter, variables(10), data_I64(1), ierr) - call adios2_put(bpWriter, variables(11), data_R32(1), ierr) - call adios2_put(bpWriter, variables(12), data_R64(1), ierr) - call adios2_put(bpWriter, variables(13), data_Strings(1), ierr) - end if - - call adios2_put(bpWriter, variables(1), data_I8, ierr) - call adios2_put(bpWriter, variables(2), data_I16, ierr) - call adios2_put(bpWriter, variables(3), data_I32, ierr) - call adios2_put(bpWriter, variables(4), data_I64, ierr) - call adios2_put(bpWriter, variables(5), data_R32, ierr) - call adios2_put(bpWriter, variables(6), data_R64, ierr) - - call adios2_put(bpWriter, variables(14), irank, ierr) - - call adios2_end_step(bpWriter, ierr) - end do - - ! Closes engine1 and deallocates it, becomes unreachable - call adios2_close(bpWriter, ierr) - - if( bpWriter%valid .eqv. .true. ) stop 'Invalid adios2_close' - - !!!!!!!!!!!!!!!!!!!!!!!! READER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! Declare io reader - call adios2_declare_io(ioRead, adios, "ioRead", ierr) - ! Open bpReader engine - call adios2_open(bpReader, ioRead, "ftypes.bp", adios2_mode_readRandomAccess, ierr) - - call adios2_steps(nsteps, bpReader, ierr) - if(nsteps /= 3) stop 'ftypes.bp must have 3 steps' - - call adios2_available_variables(ioRead, namestruct, ierr) - if (ierr /= 0) stop 'adios2_available_variables returned with error' - if (.not.namestruct%valid) stop 'adios2_available_variables returned invalid struct' - write(*,*) 'Number of variables = ', namestruct%count - write(*,*) 'Max name length = ', namestruct%max_name_len - if (namestruct%count /= 14) stop 'adios2_available_variables returned not the expected 14' - - allocate(varnamelist(namestruct%count)) - - call adios2_retrieve_names(namestruct, varnamelist, ierr) - if (ierr /= 0) stop 'adios2_retrieve_names returned with error' - do i=1,namestruct%count - write(*,'("Var[",i2,"] = ",a12)') i, varnamelist(i) - end do - deallocate(varnamelist) - - if (namestruct%f2c /= 0_8) stop 'namestruct f2c pointer is not null after adios2_retrieve_names()' - if (namestruct%valid) stop 'namestruct is not invalidated after adios2_retrieve_names()' - - - call adios2_inquire_variable(variables(1), ioRead, "var_I8", ierr) - if (variables(1)%name /= 'var_I8') stop 'var_I8 not recognized' - if (variables(1)%type /= adios2_type_integer1) stop 'var_I8 type not recognized' - call adios2_variable_shape(shape_in, ndims, variables(1), ierr) - if (ndims /= 1) stop 'var_I8 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I8 shape_in read failed' - - call adios2_inquire_variable(variables(2), ioRead, "var_I16", ierr) - if (variables(2)%name /= 'var_I16') stop 'var_I16 not recognized' - if (variables(2)%type /= adios2_type_integer2) stop 'var_I16 type not recognized' - call adios2_variable_shape(shape_in, ndims, variables(2), ierr) - if (ndims /= 1) stop 'var_I16 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I16 shape_in read failed' - - call adios2_inquire_variable(variables(3), ioRead, "var_I32", ierr) - if (variables(3)%name /= 'var_I32') stop 'var_I32 not recognized' - if (variables(3)%type /= adios2_type_integer4) stop 'var_I32 type not recognized' - call adios2_variable_shape(shape_in, ndims, variables(3), ierr) - if (ndims /= 1) stop 'var_I32 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I32 shape_in read failed' - - call adios2_inquire_variable(variables(4), ioRead, "var_I64", ierr) - if (variables(4)%name /= 'var_I64') stop 'var_I64 not recognized' - if (variables(4)%type /= adios2_type_integer8) stop 'var_I64 type not recognized' - call adios2_variable_shape(shape_in, ndims, variables(4), ierr) - if (ndims /= 1) stop 'var_I64 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I64 shape_in read failed' - - call adios2_inquire_variable(variables(5), ioRead, "var_R32", ierr) - if (variables(5)%name /= 'var_R32') stop 'var_R32 not recognized' - if (variables(5)%type /= adios2_type_real) stop 'var_R32 type not recognized' - call adios2_variable_shape(shape_in, ndims, variables(5), ierr) - if (ndims /= 1) stop 'var_R32 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_R32 shape_in read failed' - - call adios2_inquire_variable(variables(6), ioRead, "var_R64", ierr) - if (variables(6)%name /= 'var_R64') stop 'var_R64 not recognized' - if (variables(6)%type /= adios2_type_dp) stop 'var_R64 type not recognized' - call adios2_variable_shape(shape_in, ndims, variables(6), ierr) - if (ndims /= 1) stop 'var_R64 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_R64 shape_in read failed' - - call adios2_inquire_variable(variables(13), ioRead, "gvar_Str", ierr) - call adios2_get(bpReader, variables(13), inString, ierr) - call adios2_perform_gets(bpReader, ierr) - if( inString /= data_Strings(1) ) stop 'gvar_Str read failed' - - call adios2_inquire_variable(variables(14), ioRead, "lvar_i32", ierr) - allocate(inRanks(isize)) - call adios2_get(bpReader, variables(14), inRanks, ierr) - call adios2_perform_gets(bpReader, ierr) - if( inRanks(irank+1) /= irank ) stop 'lvar_i32 read failed' - deallocate(inRanks) - - call adios2_close(bpReader, ierr) - - ! Deallocates adios and calls its destructor - call adios2_finalize(adios, ierr) - if( adios%valid .eqv. .true. ) stop 'Invalid adios2_finalize' +#if ADIOS2_USE_MPI + call adios2_open(bpWriter, ioWrite, "ftypes_mpi.bp", adios2_mode_write, ierr) +#else + call adios2_open(bpWriter, ioWrite, "ftypes.bp", adios2_mode_write, ierr) +#endif + if( bpWriter%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_engine post-open' + stop 1 + end if +#if ADIOS2_USE_MPI + if( TRIM(bpWriter%name) /= "ftypes_mpi.bp") then +#else + if( TRIM(bpWriter%name) /= "ftypes.bp") then +#endif + write(*,*) 'Invalid adios2_engine name' + stop 1 + end if + + if( TRIM(bpWriter%type) /= 'BP5Writer') then + write(*,*) 'Engine Type ', TRIM(bpWriter%type) + write(*,*) 'Invalid adios2_engine type' + stop 1 + end if + call adios2_io_engine_type(engineType, ioWrite, ierr) + if( engineType /= 'File') then ! FIXME, different from the above! + write(*,*) 'Engine Type ', engineType + write(*,*) 'Invalid type from adios2_engine_type' + stop 1 + end if + + if( bpWriter%mode /= adios2_mode_write) then + write(*,*) 'Invalid adios2_engine mode' + stop 1 + end if + + ! Put array contents to bp buffer, based on var1 metadata + do i = 1, 3 + call adios2_begin_step(bpWriter, adios2_step_mode_append, -1.0, & + step_status, ierr) + + if (irank == 0 .and. i == 1) then + call adios2_put(bpWriter, variables(7), data_I8(1), ierr) + call adios2_put(bpWriter, variables(8), data_I16(1), ierr) + call adios2_put(bpWriter, variables(9), data_I32(1), ierr) + call adios2_put(bpWriter, variables(10), data_I64(1), ierr) + call adios2_put(bpWriter, variables(11), data_R32(1), ierr) + call adios2_put(bpWriter, variables(12), data_R64(1), ierr) + call adios2_put(bpWriter, variables(13), data_Strings(1), ierr) + end if + + call adios2_put(bpWriter, variables(1), data_I8, ierr) + call adios2_put(bpWriter, variables(2), data_I16, ierr) + call adios2_put(bpWriter, variables(3), data_I32, ierr) + call adios2_put(bpWriter, variables(4), data_I64, ierr) + call adios2_put(bpWriter, variables(5), data_R32, ierr) + call adios2_put(bpWriter, variables(6), data_R64, ierr) + + call adios2_put(bpWriter, variables(14), irank, ierr) + + call adios2_end_step(bpWriter, ierr) + end do + + ! Closes engine1 and deallocates it, becomes unreachable + call adios2_close(bpWriter, ierr) + + if( bpWriter%valid .eqv. .true. ) then + write(*,*) 'Invalid adios2_close' + stop 1 + end if + + !!!!!!!!!!!!!!!!!!!!!!!! READER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Declare io reader + call adios2_declare_io(ioRead, adios, "ioRead", ierr) + ! Open bpReader engine +#if ADIOS2_USE_MPI + call adios2_open(bpReader, ioRead, "ftypes_mpi.bp", adios2_mode_readRandomAccess, ierr) +#else + call adios2_open(bpReader, ioRead, "ftypes.bp", adios2_mode_readRandomAccess, ierr) +#endif + call adios2_steps(nsteps, bpReader, ierr) + if(nsteps /= 3) then + write(*,*) 'ftypes.bp must have 3 steps' + stop 1 + end if + + call adios2_available_variables(ioRead, namestruct, ierr) + if (ierr /= 0) then + write(*,*) 'adios2_available_variables returned with error' + stop 1 + end if + if (.not.namestruct%valid) then + write(*,*) 'adios2_available_variables returned invalid struct' + stop 1 + end if + write(*,*) 'Number of variables = ', namestruct%count + write(*,*) 'Max name length = ', namestruct%max_name_len + if (namestruct%count /= TOTAL_VAR_COUNT) then + write(*,*) 'adios2_available_variables returned not the expected 14' + stop 1 + end if + + allocate(varnamelist(namestruct%count)) + + call adios2_retrieve_names(namestruct, varnamelist, ierr) + if (ierr /= 0) then + write(*,*) 'adios2_retrieve_names returned with error' + stop 1 + end if + do i=1,namestruct%count + write(*,'("Var[",i2,"] = ",a12)') i, varnamelist(i) + end do + deallocate(varnamelist) + + if (namestruct%f2c /= 0_8) then + write(*,*) 'namestruct f2c pointer is not null after adios2_retrieve_names()' + stop 1 + end if + if (namestruct%valid) then + write(*,*) 'namestruct is not invalidated after adios2_retrieve_names()' + stop 1 + end if + + + call adios2_inquire_variable(variables(1), ioRead, "var_I8", ierr) + if (variables(1)%name /= 'var_I8') then + write(*,*) 'var_I8 not recognized' + stop 1 + end if + if (variables(1)%type /= adios2_type_integer1) then + write(*,*) 'var_I8 type not recognized' + stop 1 + end if + call adios2_variable_shape(shape_in, ndims, variables(1), ierr) + if (ndims /= 1) then + write(*,*) 'var_I8 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I8 shape_in read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(2), ioRead, "var_I16", ierr) + if (variables(2)%name /= 'var_I16') then + write(*,*) 'var_I16 not recognized' + stop 1 + end if + if (variables(2)%type /= adios2_type_integer2) then + write(*,*) 'var_I16 type not recognized' + stop 1 + end if + call adios2_variable_shape(shape_in, ndims, variables(2), ierr) + if (ndims /= 1) then + write(*,*) 'var_I16 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I16 shape_in read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(3), ioRead, "var_I32", ierr) + if (variables(3)%name /= 'var_I32') then + write(*,*) 'var_I32 not recognized' + stop 1 + end if + if (variables(3)%type /= adios2_type_integer4) then + write(*,*) 'var_I32 type not recognized' + stop 1 + end if + call adios2_variable_shape(shape_in, ndims, variables(3), ierr) + if (ndims /= 1) then + write(*,*) 'var_I32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I32 shape_in read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(4), ioRead, "var_I64", ierr) + if (variables(4)%name /= 'var_I64') then + write(*,*) 'var_I64 not recognized' + stop 1 + end if + if (variables(4)%type /= adios2_type_integer8) then + write(*,*) 'var_I64 type not recognized' + stop 1 + end if + call adios2_variable_shape(shape_in, ndims, variables(4), ierr) + if (ndims /= 1) then + write(*,*) 'var_I64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I64 shape_in read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(5), ioRead, "var_R32", ierr) + if (variables(5)%name /= 'var_R32') then + write(*,*) 'var_R32 not recognized' + stop 1 + end if + if (variables(5)%type /= adios2_type_real) then + write(*,*) 'var_R32 type not recognized' + stop 1 + end if + call adios2_variable_shape(shape_in, ndims, variables(5), ierr) + if (ndims /= 1) then + write(*,*) 'var_R32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_R32 shape_in read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(6), ioRead, "var_R64", ierr) + if (variables(6)%name /= 'var_R64') then + write(*,*) 'var_R64 not recognized' + stop 1 + end if + if (variables(6)%type /= adios2_type_dp) then + write(*,*) 'var_R64 type not recognized' + stop 1 + end if + call adios2_variable_shape(shape_in, ndims, variables(6), ierr) + if (ndims /= 1) then + write(*,*) 'var_R64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_R64 shape_in read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(13), ioRead, "gvar_Str", ierr) + call adios2_get(bpReader, variables(13), inString, ierr) + call adios2_perform_gets(bpReader, ierr) + if( inString /= data_Strings(1) ) then + write(*,*) 'gvar_Str read failed' + stop 1 + end if + + call adios2_inquire_variable(variables(14), ioRead, "lvar_i32", ierr) + allocate(inRanks(isize)) + call adios2_get(bpReader, variables(14), inRanks, ierr) + call adios2_perform_gets(bpReader, ierr) + if( inRanks(irank+1) /= irank ) then + write(*,*) 'lvar_i32 read failed' + stop 1 + end if + deallocate(inRanks) + + call adios2_close(bpReader, ierr) + + ! Deallocates adios and calls its destructor + call adios2_finalize(adios, ierr) + if( adios%valid .eqv. .true. ) stop 'Invalid adios2_finalize' #if ADIOS2_USE_MPI - call MPI_Finalize(ierr) + call MPI_Finalize(ierr) #endif end program TestBPWriteTypes diff --git a/testing/adios2/bindings/fortran/TestBPWriteTypesByName.F90 b/testing/adios2/bindings/fortran/TestBPWriteTypesByName.F90 index 13d1bf047d..0c7c74afdc 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteTypesByName.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteTypesByName.F90 @@ -127,46 +127,118 @@ program TestBPWriteTypes step_status, ierr) call adios2_inquire_variable(variables(1), ioRead, "var_I8", ierr) - if (variables(1)%name /= 'var_I8') stop 'var_I8 not recognized' - if (variables(1)%type /= adios2_type_integer1) stop 'var_I8 type not recognized' + if (variables(1)%name /= 'var_I8') then + write(*,*) 'var_I8 not recognized' + stop 1 + end if + if (variables(1)%type /= adios2_type_integer1) then + write(*,*) 'var_I8 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(1), ierr) - if (ndims /= 1) stop 'var_I8 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I8 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'var_I8 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I8 shape_in read failed' + stop 1 + end if call adios2_inquire_variable(variables(2), ioRead, "var_I16", ierr) - if (variables(2)%name /= 'var_I16') stop 'var_I16 not recognized' - if (variables(2)%type /= adios2_type_integer2) stop 'var_I16 type not recognized' + if (variables(2)%name /= 'var_I16') then + write(*,*) 'var_I16 not recognized' + stop 1 + end if + if (variables(2)%type /= adios2_type_integer2) then + write(*,*) 'var_I16 type not recognized' + stop 1 + end if call adios2_variable_shape( shape_in, ndims,variables(2),ierr) - if (ndims /= 1) stop 'var_I16 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I16 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'var_I16 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I16 shape_in read failed' + stop 1 + end if call adios2_inquire_variable(variables(3), ioRead, "var_I32", ierr) - if (variables(3)%name /= 'var_I32') stop 'var_I32 not recognized' - if (variables(3)%type /= adios2_type_integer4) stop 'var_I32 type not recognized' + if (variables(3)%name /= 'var_I32') then + write(*,*) 'var_I32 not recognized' + stop 1 + end if + if (variables(3)%type /= adios2_type_integer4) then + write(*,*) 'var_I32 type not recognized' + stop 1 + end if call adios2_variable_shape( shape_in, ndims, variables(3),ierr) - if (ndims /= 1) stop 'var_I32 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I32 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'var_I32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I32 shape_in read failed' + stop 1 + end if call adios2_inquire_variable(variables(4), ioRead, "var_I64", ierr) - if (variables(4)%name /= 'var_I64') stop 'var_I64 not recognized' - if (variables(4)%type /= adios2_type_integer8) stop 'var_I64 type not recognized' + if (variables(4)%name /= 'var_I64') then + write(*,*) 'var_I64 not recognized' + stop 1 + end if + if (variables(4)%type /= adios2_type_integer8) then + write(*,*) 'var_I64 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(4),ierr) - if (ndims /= 1) stop 'var_I64 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_I64 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'var_I64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_I64 shape_in read failed' + stop 1 + end if call adios2_inquire_variable(variables(5), ioRead, "var_R32", ierr) - if (variables(5)%name /= 'var_R32') stop 'var_R32 not recognized' - if (variables(5)%type /= adios2_type_real) stop 'var_R32 type not recognized' + if (variables(5)%name /= 'var_R32') then + write(*,*) 'var_R32 not recognized' + stop 1 + end if + if (variables(5)%type /= adios2_type_real) then + write(*,*) 'var_R32 type not recognized' + stop 1 + end if call adios2_variable_shape( shape_in, ndims, variables(5), ierr) - if (ndims /= 1) stop 'var_R32 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_R32 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'var_R32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_R32 shape_in read failed' + stop 1 + end if call adios2_inquire_variable(variables(6), ioRead, "var_R64", ierr) - if (variables(6)%name /= 'var_R64') stop 'var_R64 not recognized' - if (variables(6)%type /= adios2_type_dp) stop 'var_R64 type not recognized' + if (variables(6)%name /= 'var_R64') then + write(*,*) 'var_R64 not recognized' + stop 1 + end if + if (variables(6)%type /= adios2_type_dp) then + write(*,*) 'var_R64 type not recognized' + stop 1 + end if call adios2_variable_shape( shape_in, ndims, variables(6), ierr) - if (ndims /= 1) stop 'var_R64 ndims is not 1' - if (shape_in(1) /= isize*inx) stop 'var_R64 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'var_R64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= isize*inx) then + write(*,*) 'var_R64 shape_in read failed' + stop 1 + end if call adios2_end_step(bpReader, ierr) diff --git a/testing/adios2/bindings/fortran/TestBPWriteTypesLocal.F90 b/testing/adios2/bindings/fortran/TestBPWriteTypesLocal.F90 index 41081593e9..6c8ef24210 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteTypesLocal.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteTypesLocal.F90 @@ -104,15 +104,24 @@ program TestBPWriteTypes adios2_variable_dims, ierr) write (*, *) "Engine type: ", ioWrite%engine_type - if (TRIM(ioWrite%engine_type) /= 'File') stop 'Wrong engine_type' + if (TRIM(ioWrite%engine_type) /= 'File') then + write(*,*) 'Wrong engine_type' + stop 1 + end if call adios2_set_engine(ioWrite, "SST", ierr) write (*, *) "Engine type: ", ioWrite%engine_type - if (TRIM(ioWrite%engine_type) /= 'SST') stop 'Wrong engine_type' + if (TRIM(ioWrite%engine_type) /= 'SST') then + write(*,*) 'Wrong engine_type' + stop 1 + end if call adios2_at_io(ioDummy, adios, "ioWrite", ierr) write (*, *) "Engine type: ", ioDummy%engine_type - if (TRIM(ioDummy%engine_type) /= 'SST') stop 'Wrong engine_type' + if (TRIM(ioDummy%engine_type) /= 'SST') then + write(*,*) 'Wrong engine_type' + stop 1 + end if call adios2_set_engine(ioWrite, "BPFile", ierr) @@ -124,7 +133,10 @@ program TestBPWriteTypes call adios2_begin_step(bpWriter, ierr) call adios2_current_step(current_step, bpWriter, ierr) - if (current_step /= s - 1) stop 'wrong current step' + if (current_step /= s - 1) then + write(*,*) 'wrong current step' + stop 1 + end if if (irank == 0 .and. s == 1) then call adios2_put(bpWriter, variables(7), data_I8(1), ierr) @@ -181,57 +193,135 @@ program TestBPWriteTypes if (current_step == 0) then call adios2_inquire_variable(variables(7), ioRead, "gvar_I8", ierr) - if (variables(7)%name /= 'gvar_I8') stop 'gvar_I8 name not recognized' - if (variables(7)%type /= adios2_type_integer1) stop 'gvar_I8 type not recognized' + if (variables(7)%name /= 'gvar_I8') then + write(*,*) 'gvar_I8 name not recognized' + stop 1 + end if + if (variables(7)%type /= adios2_type_integer1) then + write(*,*) 'gvar_I8 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(8), ioRead, "gvar_I16", ierr) - if (variables(8)%name /= 'gvar_I16') stop 'gvar_I16 name not recognized' - if (variables(8)%type /= adios2_type_integer2) stop 'gvar_I16 type not recognized' + if (variables(8)%name /= 'gvar_I16') then + write(*,*) 'gvar_I16 name not recognized' + stop 1 + end if + if (variables(8)%type /= adios2_type_integer2) then + write(*,*) 'gvar_I16 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(9), ioRead, "gvar_I32", ierr) - if (variables(9)%name /= 'gvar_I32') stop 'gvar_I32 name not recognized' - if (variables(9)%type /= adios2_type_integer4) stop 'gvar_I32 type not recognized' + if (variables(9)%name /= 'gvar_I32') then + write(*,*) 'gvar_I32 name not recognized' + stop 1 + end if + if (variables(9)%type /= adios2_type_integer4) then + write(*,*) 'gvar_I32 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(10), ioRead, "gvar_I64", ierr) - if (variables(10)%name /= 'gvar_I64') stop 'gvar_I64 name not recognized' - if (variables(10)%type /= adios2_type_integer8) stop 'gvar_I64 type not recognized' + if (variables(10)%name /= 'gvar_I64') then + write(*,*) 'gvar_I64 name not recognized' + stop 1 + end if + if (variables(10)%type /= adios2_type_integer8) then + write(*,*) 'gvar_I64 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(11), ioRead, "gvar_R32", ierr) - if (variables(11)%name /= 'gvar_R32') stop 'gvar_R32 name not recognized' - if (variables(11)%type /= adios2_type_real) stop 'gvar_I64 type not recognized' + if (variables(11)%name /= 'gvar_R32') then + write(*,*) 'gvar_R32 name not recognized' + stop 1 + end if + if (variables(11)%type /= adios2_type_real) then + write(*,*) 'gvar_I64 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(12), ioRead, "gvar_R64", ierr) - if (variables(12)%name /= 'gvar_R64') stop 'gvar_R64 name not recognized' - if (variables(12)%type /= adios2_type_dp) stop 'gvar_I64 type not recognized' + if (variables(12)%name /= 'gvar_R64') then + write(*,*) 'gvar_R64 name not recognized' + stop 1 + end if + if (variables(12)%type /= adios2_type_dp) then + write(*,*) 'gvar_I64 type not recognized' + stop 1 + end if end if call adios2_inquire_variable(variables(1), ioRead, "var_I8", ierr) - if (variables(1)%name /= 'var_I8') stop 'var_I8 not recognized' - if (variables(1)%type /= adios2_type_integer1) stop 'var_I8 type not recognized' + if (variables(1)%name /= 'var_I8') then + write(*,*) 'var_I8 not recognized' + stop 1 + end if + if (variables(1)%type /= adios2_type_integer1) then + write(*,*) 'var_I8 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(2), ioRead, "var_I16", ierr) - if (variables(2)%name /= 'var_I16') stop 'var_I16 not recognized' - if (variables(2)%type /= adios2_type_integer2) stop 'var_I16 type not recognized' + if (variables(2)%name /= 'var_I16') then + write(*,*) 'var_I16 not recognized' + stop 1 + end if + if (variables(2)%type /= adios2_type_integer2) then + write(*,*) 'var_I16 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(3), ioRead, "var_I32", ierr) - if (variables(3)%name /= 'var_I32') stop 'var_I32 not recognized' - if (variables(3)%type /= adios2_type_integer4) stop 'var_I32 type not recognized' + if (variables(3)%name /= 'var_I32') then + write(*,*) 'var_I32 not recognized' + stop 1 + end if + if (variables(3)%type /= adios2_type_integer4) then + write(*,*) 'var_I32 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(4), ioRead, "var_I64", ierr) - if (variables(4)%name /= 'var_I64') stop 'var_I64 not recognized' - if (variables(4)%type /= adios2_type_integer8) stop 'var_I64 type not recognized' + if (variables(4)%name /= 'var_I64') then + write(*,*) 'var_I64 not recognized' + stop 1 + end if + if (variables(4)%type /= adios2_type_integer8) then + write(*,*) 'var_I64 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(5), ioRead, "var_R32", ierr) - if (variables(5)%name /= 'var_R32') stop 'var_R32 not recognized' - if (variables(5)%type /= adios2_type_real) stop 'var_R32 type not recognized' + if (variables(5)%name /= 'var_R32') then + write(*,*) 'var_R32 not recognized' + stop 1 + end if + if (variables(5)%type /= adios2_type_real) then + write(*,*) 'var_R32 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(6), ioRead, "var_R64", ierr) - if (variables(6)%name /= 'var_R64') stop 'var_R64 not recognized' - if (variables(6)%type /= adios2_type_dp) stop 'var_R64 type not recognized' + if (variables(6)%name /= 'var_R64') then + write(*,*) 'var_R64 not recognized' + stop 1 + end if + if (variables(6)%type /= adios2_type_dp) then + write(*,*) 'var_R64 type not recognized' + stop 1 + end if call adios2_inquire_variable(variables(13), ioRead, "var_changingR64", ierr) - if (variables(13)%name /= 'var_changingR64') stop 'var_changingR64 not recognized' - if (variables(13)%type /= adios2_type_dp) stop 'var_R64 type not recognized' + if (variables(13)%name /= 'var_changingR64') then + write(*,*) 'var_changingR64 not recognized' + stop 1 + end if + if (variables(13)%type /= adios2_type_dp) then + write(*,*) 'var_R64 type not recognized' + stop 1 + end if do block_id = 0, isize - 1 @@ -262,15 +352,36 @@ program TestBPWriteTypes end do do i = 1, inx - if (I8(i) /= inI8(i)) stop 'Error reading var_I8' - if (I16(i) /= inI16(i)) stop 'Error reading var_I16' - if (I32(i) /= inI32(i)) stop 'Error reading var_I32' - if (I64(i) /= inI64(i)) stop 'Error reading var_I64' - if (R32(i) /= inR32(i)) stop 'Error reading var_R32' - if (R64(i) /= inR64(i)) stop 'Error reading var_R64' + if (I8(i) /= inI8(i)) then + write(*,*) 'Error reading var_I8' + stop 1 + end if + if (I16(i) /= inI16(i)) then + write(*,*) 'Error reading var_I16' + stop 1 + end if + if (I32(i) /= inI32(i)) then + write(*,*) 'Error reading var_I32' + stop 1 + end if + if (I64(i) /= inI64(i)) then + write(*,*) 'Error reading var_I64' + stop 1 + end if + if (R32(i) /= inR32(i)) then + write(*,*) 'Error reading var_R32' + stop 1 + end if + if (R64(i) /= inR64(i)) then + write(*,*) 'Error reading var_R64' + stop 1 + end if if( i < current_step) then - if (R64(i) /= inchangingR64(i)) stop 'Error reading var_changingR64' + if (R64(i) /= inchangingR64(i)) then + write(*,*) 'Error reading var_changingR64' + stop 1 + end if end if end do diff --git a/testing/adios2/bindings/fortran/TestBPWriteVariableAttributes.F90 b/testing/adios2/bindings/fortran/TestBPWriteVariableAttributes.F90 index 4c750e19bb..ae95a9aa96 100644 --- a/testing/adios2/bindings/fortran/TestBPWriteVariableAttributes.F90 +++ b/testing/adios2/bindings/fortran/TestBPWriteVariableAttributes.F90 @@ -34,13 +34,16 @@ program TestBPWriteVariableAttributes ! Failed with ci/circleci: suse-pgi-openmpi (exceptions trigger abort) ! call adios2_define_attribute(failed_att, ioWrite, 'att_String', & ! 'ADIOS2 String attribute', 'myVar2', '/', ierr) -! if(ierr == 0) stop 'myVar2 does not exist, should not create attribute att_String' +! if(ierr == 0) then 'myVar2 does not exist, should not create attribute att_String' ! if(failed_att%valid .eqv. .true.) then ! stop 'failed attribute must not exist ' ! end if do i=1,14 - if( attributes(i)%valid .eqv. .true. ) stop 'Invalid attribute default' + if( attributes(i)%valid .eqv. .true. ) then + write(*,*) 'Invalid attribute default' + stop 1 + end if end do ! single value @@ -89,7 +92,10 @@ program TestBPWriteVariableAttributes data_R64, 3, var%name, ierr) do i=1,14 - if( attributes(i)%valid .eqv. .false. ) stop 'Invalid adios2_define_attribute' + if( attributes(i)%valid .eqv. .false. ) then + write(*,*) 'Invalid adios2_define_attribute' + stop 1 + end if end do call adios2_open(bpWriter, ioWrite, "fvarattr_types.bp", adios2_mode_write, & diff --git a/testing/adios2/bindings/fortran/TestNullEngine.F90 b/testing/adios2/bindings/fortran/TestNullEngine.F90 index 668430ef34..f6e1a9f76b 100644 --- a/testing/adios2/bindings/fortran/TestNullEngine.F90 +++ b/testing/adios2/bindings/fortran/TestNullEngine.F90 @@ -39,7 +39,10 @@ program TestNullEngine ! Declare an IO process configuration inside adios call adios2_declare_io(ioWrite, adios, "nullWriter", ierr) call adios2_set_engine(ioWrite, "NULL", ierr) - if (TRIM(ioWrite%engine_type) /= "NULL") stop 'Wrong io engine_type' + if (TRIM(ioWrite%engine_type) /= "NULL") then + write(*,*) 'Wrong io engine_type' + stop 1 + end if ! Defines a variable to be written in bp format call adios2_define_variable(var, ioWrite, "var_R64", & @@ -70,11 +73,15 @@ program TestNullEngine call adios2_begin_step(nullReader, adios2_step_mode_read, -1.0, & step_status, ierr) if (step_status /= adios2_step_status_end_of_stream) then - stop 'null engine status failed' + write(*,*) 'null engine status failed' + stop 1 end if call adios2_inquire_variable(varIn, ioRead, "var_R64", ierr) - if (varIn%valid .eqv. .true.) stop 'var_R64 inquire error' + if (varIn%valid .eqv. .true.) then + write(*,*) 'var_R64 inquire error' + stop 1 + end if call adios2_get(nullReader, varIn, inR64, ierr) call adios2_perform_gets(nullReader, ierr) diff --git a/testing/adios2/bindings/fortran/TestRemove.F90 b/testing/adios2/bindings/fortran/TestRemove.F90 index adce243c74..ff909e7e15 100644 --- a/testing/adios2/bindings/fortran/TestRemove.F90 +++ b/testing/adios2/bindings/fortran/TestRemove.F90 @@ -97,67 +97,148 @@ program TestRemove call adios2_define_variable(variables(12), ioWrite, "gvar_R64", & adios2_type_dp, ierr) - if (variables(1)%valid .eqv. .false. ) stop 'var_I8 not defined' - if (variables(2)%valid .eqv. .false. ) stop 'var_I16 not defined' - if (variables(3)%valid .eqv. .false. ) stop 'var_I32 not defined' - if (variables(4)%valid .eqv. .false. ) stop 'var_I64 not defined' - if (variables(5)%valid .eqv. .false. ) stop 'var_R32 not defined' - if (variables(6)%valid .eqv. .false. ) stop 'var_R64 not defined' - if (variables(7)%valid .eqv. .false. ) stop 'gvar_I8 not defined' - if (variables(8)%valid .eqv. .false. ) stop 'gvar_I16 not defined' - if (variables(9)%valid .eqv. .false. ) stop 'gvar_I32 not defined' - if (variables(10)%valid .eqv. .false. ) stop 'gvar_I64 not defined' - if (variables(11)%valid .eqv. .false. ) stop 'gvar_R32 not defined' - if (variables(12)%valid .eqv. .false. ) stop 'gvar_IR64 not defined' + if (variables(1)%valid .eqv. .false. ) then + write(*,*) 'var_I8 not defined' + stop 1 + end if + if (variables(2)%valid .eqv. .false. ) then + write(*,*) 'var_I16 not defined' + stop 1 + end if + if (variables(3)%valid .eqv. .false. ) then + write(*,*) 'var_I32 not defined' + stop 1 + end if + if (variables(4)%valid .eqv. .false. ) then + write(*,*) 'var_I64 not defined' + stop 1 + end if + if (variables(5)%valid .eqv. .false. ) then + write(*,*) 'var_R32 not defined' + stop 1 + end if + if (variables(6)%valid .eqv. .false. ) then + write(*,*) 'var_R64 not defined' + stop 1 + end if + if (variables(7)%valid .eqv. .false. ) then + write(*,*) 'gvar_I8 not defined' + stop 1 + end if + if (variables(8)%valid .eqv. .false. ) then + write(*,*) 'gvar_I16 not defined' + stop 1 + end if + if (variables(9)%valid .eqv. .false. ) then + write(*,*) 'gvar_I32 not defined' + stop 1 + end if + if (variables(10)%valid .eqv. .false. ) then + write(*,*) 'gvar_I64 not defined' + stop 1 + end if + if (variables(11)%valid .eqv. .false. ) then + write(*,*) 'gvar_R32 not defined' + stop 1 + end if + if (variables(12)%valid .eqv. .false. ) then + write(*,*) 'gvar_IR64 not defined' + stop 1 + end if ! remove piece call adios2_remove_variable(res, ioWrite, "gvar_R64", ierr) - if( res .eqv. .false. ) stop 'adios2_remove_variable failed' + if( res .eqv. .false. ) then + write(*,*) 'adios2_remove_variable failed' + stop 1 + end if call adios2_inquire_variable(variables(12), ioWrite, "gvar_R64", ierr) - if (variables(12)%valid .eqv. .true. ) stop 'gvar_R64 found with inquire, not removed' + if (variables(12)%valid .eqv. .true. ) then + write(*,*) 'gvar_R64 found with inquire, not removed' + stop 1 + end if ! remove all call adios2_remove_all_variables(ioWrite, ierr) call adios2_inquire_variable(variables(1), ioWrite, "var_I8", ierr) - if (variables(1)%valid .eqv. .true. ) stop 'var_I8 found' + if (variables(1)%valid .eqv. .true. ) then + write(*,*) 'var_I8 found' + stop 1 + end if call adios2_inquire_variable(variables(2), ioWrite, "var_I16", ierr) - if (variables(2)%valid .eqv. .true.) stop 'var_I16 found' + if (variables(2)%valid .eqv. .true.) then + write(*,*) 'var_I16 found' + stop 1 + end if call adios2_inquire_variable(variables(3), ioWrite, "var_I32", ierr) - if (variables(3)%valid .eqv. .true.) stop 'var_I32 found' + if (variables(3)%valid .eqv. .true.) then + write(*,*) 'var_I32 found' + stop 1 + end if call adios2_inquire_variable(variables(4), ioWrite, "var_I64", ierr) - if (variables(4)%valid .eqv. .true.) stop 'var_I64 found' + if (variables(4)%valid .eqv. .true.) then + write(*,*) 'var_I64 found' + stop 1 + end if call adios2_inquire_variable(variables(5), ioWrite, "var_R32", ierr) - if (variables(5)%valid .eqv. .true.) stop 'var_R32 found' + if (variables(5)%valid .eqv. .true.) then + write(*,*) 'var_R32 found' + stop 1 + end if call adios2_inquire_variable(variables(6), ioWrite, "var_R64", ierr) - if (variables(6)%valid .eqv. .true.) stop 'var_R64 found' + if (variables(6)%valid .eqv. .true.) then + write(*,*) 'var_R64 found' + stop 1 + end if call adios2_inquire_variable(variables(7), ioWrite, "gvar_I8", ierr) - if (variables(7)%valid .eqv. .true.) stop 'gvar_I8 found' + if (variables(7)%valid .eqv. .true.) then + write(*,*) 'gvar_I8 found' + stop 1 + end if call adios2_inquire_variable(variables(8), ioWrite, "gvar_I16", ierr) - if (variables(8)%valid .eqv. .true.) stop 'gvar_I16 found' + if (variables(8)%valid .eqv. .true.) then + write(*,*) 'gvar_I16 found' + stop 1 + end if call adios2_inquire_variable(variables(9), ioWrite, "gvar_I32", ierr) - if (variables(9)%valid .eqv. .true.) stop 'gvar_I32 found' + if (variables(9)%valid .eqv. .true.) then + write(*,*) 'gvar_I32 found' + stop 1 + end if call adios2_inquire_variable(variables(10), ioWrite, "gvar_I64", ierr) - if (variables(10)%valid .eqv. .true.) stop 'gvar_I64 found' + if (variables(10)%valid .eqv. .true.) then + write(*,*) 'gvar_I64 found' + stop 1 + end if call adios2_inquire_variable(variables(11), ioWrite, "gvar_R32", ierr) - if (variables(11)%valid .eqv. .true.) stop 'gvar_R32 found' + if (variables(11)%valid .eqv. .true.) then + write(*,*) 'gvar_R32 found' + stop 1 + end if call adios2_remove_io(res, adios, 'ioWrite', ierr) - if( res .neqv. .true. ) stop 'could not remove ioWrite' + if( res .neqv. .true. ) then + write(*,*) 'could not remove ioWrite' + stop 1 + end if call adios2_at_io(ioWrite, adios, 'ioWrite', ierr) - if( ioWrite%valid .eqv. .true. ) stop 'did not remove ioWrite correctly' + if( ioWrite%valid .eqv. .true. ) then + write(*,*) 'did not remove ioWrite correctly' + stop 1 + end if call adios2_finalize(adios, ierr) diff --git a/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ2D.F90 b/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ2D.F90 index 685b6ba2c3..ccaf30a890 100644 --- a/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ2D.F90 +++ b/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ2D.F90 @@ -96,7 +96,10 @@ program TestBPWriteReadHeatMapSZ2D call adios2_add_operation(operation_id, var_temperatures(5), & sz_operator, 'accuracy', '0.01', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for real type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for real type' + stop 1 + end if call adios2_define_variable(var_temperatures(6), ioPut, & @@ -106,7 +109,10 @@ program TestBPWriteReadHeatMapSZ2D call adios2_add_operation(operation_id, var_temperatures(6), & sz_operator, '', '', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for dp type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for dp type' + stop 1 + end if call adios2_set_operation_parameter( var_temperatures(6), operation_id, & 'accuracy', '0.01', ierr) @@ -205,12 +211,30 @@ program TestBPWriteReadHeatMapSZ2D end do end do - if (sum_i1 /= 100*isize) stop 'Test failed integer*1' - if (sum_i2 /= 100*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 100*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 100*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 100*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 100*isize) stop 'Test failed real*8' + if (sum_i1 /= 100*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 100*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 100*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 100*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 100*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 100*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ3D.F90 b/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ3D.F90 index 9838122aa7..f7ad41ac96 100644 --- a/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ3D.F90 +++ b/testing/adios2/bindings/fortran/operation/TestBPWriteReadSZ3D.F90 @@ -96,7 +96,10 @@ program TestBPWriteReadHeatMapSZ3D call adios2_add_operation(operation_id, var_temperatures(5), & sz_operator, 'accuracy', '0.01', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for real type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for real type' + stop 1 + end if call adios2_define_variable(var_temperatures(6), ioPut, & @@ -107,7 +110,10 @@ program TestBPWriteReadHeatMapSZ3D call adios2_add_operation(operation_id, var_temperatures(6), & sz_operator, 'accuracy', '0.01', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for dp type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for dp type' + stop 1 + end if call adios2_open(bpWriter, ioPut, 'HeatMapSZ3D_f.bp', adios2_mode_write, & ierr) @@ -205,12 +211,30 @@ program TestBPWriteReadHeatMapSZ3D end do end do - if (sum_i1 /= 1000*isize) stop 'Test failed integer*1' - if (sum_i2 /= 1000*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 1000*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 1000*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 1000*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 1000*isize) stop 'Test failed real*8' + if (sum_i1 /= 1000*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 1000*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 1000*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 1000*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 1000*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 1000*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2D.F90 b/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2D.F90 index d564e1e307..38801f439d 100644 --- a/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2D.F90 +++ b/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2D.F90 @@ -96,7 +96,10 @@ program TestBPWriteReadHeatMapZfp2D call adios2_add_operation(operation_id, var_temperatures(5), & zfp_operator, 'rate', '8', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for real type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for real type' + stop 1 + end if call adios2_define_variable(var_temperatures(6), ioPut, & @@ -107,7 +110,10 @@ program TestBPWriteReadHeatMapZfp2D call adios2_add_operation(operation_id, var_temperatures(6), & zfp_operator, 'rate', '8', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for dp type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for dp type' + stop 1 + end if call adios2_open(bpWriter, ioPut, 'HeatMapZfp2D_f.bp', adios2_mode_write, & @@ -204,12 +210,30 @@ program TestBPWriteReadHeatMapZfp2D end do end do - if (sum_i1 /= 100*isize) stop 'Test failed integer*1' - if (sum_i2 /= 100*isize) stop 'Test failed integer*2' - if (sum(sel_temperatures_i4) /= 100*isize) stop 'Test failed integer*4' - if (sum(sel_temperatures_i8) /= 100*isize) stop 'Test failed integer*8' - if (sum(sel_temperatures_r4) /= 100*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 100*isize) stop 'Test failed real*8' + if (sum_i1 /= 100*isize) then + write(*,*) 'Test failed integer*1' + stop 1 + end if + if (sum_i2 /= 100*isize) then + write(*,*) 'Test failed integer*2' + stop 1 + end if + if (sum(sel_temperatures_i4) /= 100*isize) then + write(*,*) 'Test failed integer*4' + stop 1 + end if + if (sum(sel_temperatures_i8) /= 100*isize) then + write(*,*) 'Test failed integer*8' + stop 1 + end if + if (sum(sel_temperatures_r4) /= 100*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 100*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if if (allocated(sel_temperatures_i1)) deallocate (sel_temperatures_i1) if (allocated(sel_temperatures_i2)) deallocate (sel_temperatures_i2) diff --git a/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2DRemove.F90 b/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2DRemove.F90 index 70d962dde3..9d624c986c 100644 --- a/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2DRemove.F90 +++ b/testing/adios2/bindings/fortran/operation/TestBPWriteReadZfp2DRemove.F90 @@ -67,11 +67,17 @@ program TestBPWriteReadHeatMapZfp2DRemove if( mod(i,2) == 0 ) then call adios2_add_operation(operation_id, var_temperatures(1), & zfp_operator, 'rate', '8', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for real type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for real type' + stop 1 + end if call adios2_add_operation(operation_id, var_temperatures(2), & zfp_operator, 'rate', '8', ierr) - if( operation_id /= 0 ) stop 'operation_id not added for dp type' + if( operation_id /= 0 ) then + write(*,*) 'operation_id not added for dp type' + stop 1 + end if else call adios2_remove_operations(var_temperatures(1), ierr) @@ -125,8 +131,14 @@ program TestBPWriteReadHeatMapZfp2DRemove call adios2_get(bpReader, var_temperaturesIn(2), sel_temperatures_r8, ierr) call adios2_end_step(bpReader, ierr) - if (sum(sel_temperatures_r4) /= 100*isize) stop 'Test failed real*4' - if (sum(sel_temperatures_r8) /= 100*isize) stop 'Test failed real*8' + if (sum(sel_temperatures_r4) /= 100*isize) then + write(*,*) 'Test failed real*4' + stop 1 + end if + if (sum(sel_temperatures_r8) /= 100*isize) then + write(*,*) 'Test failed real*8' + stop 1 + end if end do diff --git a/testing/adios2/derived/CMakeLists.txt b/testing/adios2/derived/CMakeLists.txt index 2df2938853..097e7cc7d7 100644 --- a/testing/adios2/derived/CMakeLists.txt +++ b/testing/adios2/derived/CMakeLists.txt @@ -3,4 +3,4 @@ #accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -gtest_add_tests_helper(DerivedCorrectness MPI_ALLOW BP Derived. "") +gtest_add_tests_helper(DerivedCorrectness MPI_NONE BP Derived. "") diff --git a/testing/adios2/derived/TestBPDerivedCorrectness.cpp b/testing/adios2/derived/TestBPDerivedCorrectness.cpp index 002015b843..9d96cc5f41 100644 --- a/testing/adios2/derived/TestBPDerivedCorrectness.cpp +++ b/testing/adios2/derived/TestBPDerivedCorrectness.cpp @@ -36,25 +36,21 @@ TEST(DerivedCorrectness, AddCorrectnessTest) std::vector varname = {"sim1/Ux", "sim1/Uy", "sim1/Uz"}; std::string derivedname = "derived/addU"; - std::cout << "Define Variable " << varname[0] << std::endl; auto Ux = bpOut.DefineVariable(varname[0], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); - std::cout << "Define Variable " << varname[1] << std::endl; auto Uy = bpOut.DefineVariable(varname[1], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); - std::cout << "Define Variable " << varname[2] << std::endl; auto Uz = bpOut.DefineVariable(varname[2], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); - std::cout << "Define Derived Variable " << derivedname << std::endl; // clang-format off - auto addU = bpOut.DefineDerivedVariable(derivedname, - "x:" + varname[0] + " \n" - "y:" + varname[1] + " \n" - "z:" + varname[2] + " \n" - "x+y+z", - adios2::DerivedVarType::StoreData); + bpOut.DefineDerivedVariable(derivedname, + "x =" + varname[0] + " \n" + "y =" + varname[1] + " \n" + "z =" + varname[2] + " \n" + "x+y+z", + adios2::DerivedVarType::StoreData); // clang-format on std::string filename = "expAdd.bp"; adios2::Engine bpFileWriter = bpOut.Open(filename, adios2::Mode::Write); - for (int i = 0; i < steps; i++) + for (size_t i = 0; i < steps; i++) { bpFileWriter.BeginStep(); bpFileWriter.Put(Ux, simArray1.data()); @@ -73,8 +69,8 @@ TEST(DerivedCorrectness, AddCorrectnessTest) std::vector readAdd; float calcA; - float epsilon = 0.01; - for (int i = 0; i < steps; i++) + float epsilon = (float)0.01; + for (size_t i = 0; i < steps; i++) { bpFileReader.BeginStep(); bpFileReader.Get(varname[0], readUx); @@ -119,17 +115,17 @@ TEST(DerivedCorrectness, MagCorrectnessTest) auto Uy = bpOut.DefineVariable(varname[1], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); auto Uz = bpOut.DefineVariable(varname[2], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); // clang-format off - auto magU = bpOut.DefineDerivedVariable(derivedname, - "x:" + varname[0] + " \n" - "y:" + varname[1] + " \n" - "z:" + varname[2] + " \n" - "magnitude(x,y,z)", - adios2::DerivedVarType::StoreData); + bpOut.DefineDerivedVariable(derivedname, + "x =" + varname[0] + " \n" + "y =" + varname[1] + " \n" + "z =" + varname[2] + " \n" + "magnitude(x,y,z)", + adios2::DerivedVarType::StoreData); // clang-format on std::string filename = "expMagnitude.bp"; adios2::Engine bpFileWriter = bpOut.Open(filename, adios2::Mode::Write); - for (int i = 0; i < steps; i++) + for (size_t i = 0; i < steps; i++) { bpFileWriter.BeginStep(); bpFileWriter.Put(Ux, simArray1.data()); @@ -148,8 +144,8 @@ TEST(DerivedCorrectness, MagCorrectnessTest) std::vector readMag; float calcM; - float epsilon = 0.01; - for (int i = 0; i < steps; i++) + float epsilon = (float)0.01; + for (size_t i = 0; i < steps; i++) { bpFileReader.BeginStep(); auto varx = bpIn.InquireVariable(varname[0]); @@ -165,13 +161,164 @@ TEST(DerivedCorrectness, MagCorrectnessTest) for (size_t ind = 0; ind < Nx * Ny * Nz; ++ind) { - calcM = sqrt(pow(readUx[ind], 2) + pow(readUy[ind], 2) + pow(readUz[ind], 2)); + calcM = (float)sqrt(pow(readUx[ind], 2) + pow(readUy[ind], 2) + pow(readUz[ind], 2)); EXPECT_TRUE(fabs(calcM - readMag[ind]) < epsilon); } } bpFileReader.Close(); } +TEST(DerivedCorrectness, CurlCorrectnessTest) +{ + const size_t Nx = 25, Ny = 70, Nz = 13; + float error_limit = 0.0000001f; + + // Application variable + std::vector simArray1(Nx * Ny * Nz); + std::vector simArray2(Nx * Ny * Nz); + std::vector simArray3(Nx * Ny * Nz); + for (size_t i = 0; i < Nx; ++i) + { + for (size_t j = 0; j < Ny; ++j) + { + for (size_t k = 0; k < Nz; ++k) + { + size_t idx = (i * Ny * Nz) + (j * Nz) + k; + float x = static_cast(i); + float y = static_cast(j); + float z = static_cast(k); + // Linear curl example + simArray1[idx] = (6 * x * y) + (7 * z); + simArray2[idx] = (4 * x * z) + powf(y, 2); + simArray3[idx] = sqrtf(z) + (2 * x * y); + /* Less linear example + simArray1[idx] = sinf(z); + simArray2[idx] = 4 * x; + simArray3[idx] = powf(y, 2) * cosf(x); + */ + /* Nonlinear example + simArray1[idx] = expf(2 * y) * sinf(x); + simArray2[idx] = sqrtf(z + 1) * cosf(x); + simArray3[idx] = powf(x, 2) * sinf(y) + (6 * z); + */ + } + } + } + + adios2::ADIOS adios; + adios2::IO bpOut = adios.DeclareIO("BPWriteExpression"); + std::vector varname = {"sim3/VX", "sim3/VY", "sim3/VZ"}; + std::string derivedname = "derived/curlV"; + + auto VX = bpOut.DefineVariable(varname[0], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); + auto VY = bpOut.DefineVariable(varname[1], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); + auto VZ = bpOut.DefineVariable(varname[2], {Nx, Ny, Nz}, {0, 0, 0}, {Nx, Ny, Nz}); + // clang-format off + bpOut.DefineDerivedVariable(derivedname, + "Vx =" + varname[0] + " \n" + "Vy =" + varname[1] + " \n" + "Vz =" + varname[2] + " \n" + "curl(Vx,Vy,Vz)", + adios2::DerivedVarType::StoreData); + // clang-format on + std::string filename = "expCurl.bp"; + adios2::Engine bpFileWriter = bpOut.Open(filename, adios2::Mode::Write); + + bpFileWriter.BeginStep(); + bpFileWriter.Put(VX, simArray1.data()); + bpFileWriter.Put(VY, simArray2.data()); + bpFileWriter.Put(VZ, simArray3.data()); + bpFileWriter.EndStep(); + bpFileWriter.Close(); + + adios2::IO bpIn = adios.DeclareIO("BPReadCurlExpression"); + adios2::Engine bpFileReader = bpIn.Open(filename, adios2::Mode::Read); + + std::vector readVX; + std::vector readVY; + std::vector readVZ; + // TODO/DEBUG - VERIFY DATATYPE + std::vector readCurl; + + std::vector> calcCurl; + double sum_x = 0; + double sum_y = 0; + double sum_z = 0; + bpFileReader.BeginStep(); + auto varVX = bpIn.InquireVariable(varname[0]); + auto varVY = bpIn.InquireVariable(varname[1]); + auto varVZ = bpIn.InquireVariable(varname[2]); + auto varCurl = bpIn.InquireVariable(derivedname); + + bpFileReader.Get(varVX, readVX); + bpFileReader.Get(varVY, readVY); + bpFileReader.Get(varVZ, readVZ); + bpFileReader.Get(varCurl, readCurl); + bpFileReader.EndStep(); + + float curl_x, curl_y, curl_z; + float err_x, err_y, err_z; + for (size_t i = 0; i < Nx; ++i) + { + for (size_t j = 0; j < Ny; ++j) + { + for (size_t k = 0; k < Nz; ++k) + { + size_t idx = (i * Ny * Nz) + (j * Nz) + k; + float x = static_cast(i); + float y = static_cast(j); + float z = static_cast(k); + // Linear example + curl_x = -(2 * x); + curl_y = 7 - (2 * y); + curl_z = (4 * z) - (6 * x); + /* Less linear + curl_x = 2 * y * cosf(x); + curl_y = cosf(z) + (powf(y, 2) * sinf(x)); + curl_z = 4; + */ + /* Nonlinear example + curl_x = powf(x, 2) * cosf(y) - (cosf(x) / (2 * sqrtf(z + 1))); + curl_y = -2 * x * sinf(y); + curl_z = -sqrtf(z + 1) * sinf(x) - (2 * expf(2 * y) * sinf(x)); + */ + if (fabs(curl_x) < 1) + { + err_x = fabs(curl_x - readCurl[3 * idx]) / (1 + fabs(curl_x)); + } + else + { + err_x = fabs(curl_x - readCurl[3 * idx]) / fabs(curl_x); + } + if (fabs(curl_y) < 1) + { + err_y = fabs(curl_y - readCurl[3 * idx + 1]) / (1 + fabs(curl_y)); + } + else + { + err_y = fabs(curl_y - readCurl[3 * idx + 1]) / fabs(curl_y); + } + if (fabs(curl_z) < 1) + { + err_z = fabs(curl_z - readCurl[3 * idx + 2]) / (1 + fabs(curl_z)); + } + else + { + err_z = fabs(curl_z - readCurl[3 * idx + 2]) / fabs(curl_z); + } + sum_x += err_x; + sum_y += err_y; + sum_z += err_z; + } + } + } + bpFileReader.Close(); + EXPECT_LT((sum_x + sum_y + sum_z) / (3 * Nx * Ny * Nz), error_limit); + EXPECT_LT(sum_x / (Nx * Ny * Nz), error_limit); + EXPECT_LT(sum_y / (Nx * Ny * Nz), error_limit); + EXPECT_LT(sum_z / (Nx * Ny * Nz), error_limit); +} + int main(int argc, char **argv) { int result; diff --git a/testing/adios2/engine/bp/CMakeLists.txt b/testing/adios2/engine/bp/CMakeLists.txt index 8c5b90606b..bf99106bfa 100644 --- a/testing/adios2/engine/bp/CMakeLists.txt +++ b/testing/adios2/engine/bp/CMakeLists.txt @@ -120,10 +120,10 @@ if ((NOT WIN32) AND ADIOS2_HAVE_SST) set_tests_properties(Remote.BP${testname}.FileRemote PROPERTIES FIXTURES_REQUIRED Server ENVIRONMENT "DoFileRemote=1") endmacro() - add_test(NAME remoteServerSetup COMMAND remote_server -background) + add_test(NAME remoteServerSetup COMMAND adios2_remote_server -background) set_tests_properties(remoteServerSetup PROPERTIES FIXTURES_SETUP Server) - add_test(NAME remoteServerCleanup COMMAND remote_server -kill_server) + add_test(NAME remoteServerCleanup COMMAND adios2_remote_server -kill_server) set_tests_properties(remoteServerCleanup PROPERTIES FIXTURES_CLEANUP Server) ##### add remote tests below this line diff --git a/testing/adios2/engine/bp/TestBPAccuracyDefaults.cpp b/testing/adios2/engine/bp/TestBPAccuracyDefaults.cpp index d0493cdc22..ea8562ea27 100644 --- a/testing/adios2/engine/bp/TestBPAccuracyDefaults.cpp +++ b/testing/adios2/engine/bp/TestBPAccuracyDefaults.cpp @@ -31,7 +31,6 @@ class AccuracyTests : public ::testing::Test // Check if SetAccuracy/GetAccuracy default behavior works TEST_F(AccuracyTests, DefaultAccuracy) { - const std::string fname("DefaultAccuracy.bp"); int mpiRank = 0, mpiSize = 1; @@ -40,6 +39,9 @@ TEST_F(AccuracyTests, DefaultAccuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("DefaultAccuracy_MPI.bp"); +#else + const std::string fname("DefaultAccuracy.bp"); #endif std::vector localData(Nx); @@ -73,9 +75,9 @@ TEST_F(AccuracyTests, DefaultAccuracy) bpWriter.Close(); auto accuracyGot = var.GetAccuracy(); - assert(accuracyGot.error == 0.0); // no error whatsoever - assert(accuracyGot.norm == accuracyRequested.norm); - assert(accuracyGot.relative == accuracyRequested.relative); + EXPECT_EQ(accuracyGot.error, 0.0); // no error whatsoever + EXPECT_EQ(accuracyGot.norm, accuracyRequested.norm); + EXPECT_EQ(accuracyGot.relative, accuracyRequested.relative); } // Reader { @@ -100,9 +102,10 @@ TEST_F(AccuracyTests, DefaultAccuracy) bpReader.PerformGets(); auto accuracyGot = varRange.GetAccuracy(); - assert(accuracyGot.error == 0.0); // no error whatsoever - assert(accuracyGot.norm == accuracyRequested.norm); - assert(accuracyGot.relative == accuracyRequested.relative); + EXPECT_EQ(accuracyGot.error, 0.0); // no error whatsoever + EXPECT_EQ(accuracyGot.error, 0.0); // no error whatsoever + EXPECT_EQ(accuracyGot.norm, accuracyRequested.norm); + EXPECT_EQ(accuracyGot.relative, accuracyRequested.relative); std::vector iStartEndData; iStartEndData.reserve(gNx); // maximum possible diff --git a/testing/adios2/engine/bp/TestBPBufferSize.cpp b/testing/adios2/engine/bp/TestBPBufferSize.cpp index 82764552f5..9127a22f53 100644 --- a/testing/adios2/engine/bp/TestBPBufferSize.cpp +++ b/testing/adios2/engine/bp/TestBPBufferSize.cpp @@ -79,9 +79,6 @@ size_t GetAndPrintBufferSize(adios2::Engine &engine, const std::string &info, // Put(Sync) and Put(Deferred) should have the same buffer consumption TEST_F(BPBufferSizeTest, SyncDeferredIdenticalUsage) { - std::string fnameSync = "ADIOS2BPBufferSizeSync.bp"; - std::string fnameDeferred = "ADIOS2BPBufferSizeDeferred.bp"; - std::string fnameDeferredPP = "ADIOS2BPBufferSizeDeferredPP.bp"; int mpiRank = 0, mpiSize = 1; // Number of rows const std::size_t Nx = 10485760; // 10M elements, 80MB variable @@ -94,6 +91,14 @@ TEST_F(BPBufferSizeTest, SyncDeferredIdenticalUsage) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + std::string fnameSync = "ADIOS2BPBufferSizeSync_MPI.bp"; + std::string fnameDeferred = "ADIOS2BPBufferSizeDeferred_MPI.bp"; + std::string fnameDeferredPP = "ADIOS2BPBufferSizeDeferredPP_MPI.bp"; +#else + std::string fnameSync = "ADIOS2BPBufferSizeSync.bp"; + std::string fnameDeferred = "ADIOS2BPBufferSizeDeferred.bp"; + std::string fnameDeferredPP = "ADIOS2BPBufferSizeDeferredPP.bp"; + #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPChangingShape.cpp b/testing/adios2/engine/bp/TestBPChangingShape.cpp index 9beceadb8b..6fdadb6248 100644 --- a/testing/adios2/engine/bp/TestBPChangingShape.cpp +++ b/testing/adios2/engine/bp/TestBPChangingShape.cpp @@ -31,15 +31,16 @@ TEST_F(BPChangingShape, BPWriteReadShape2D) // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("BPChangingShape.bp"); const int nsteps = 10; int rank = 0, nproc = 1; #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &nproc); + const std::string fname("BPChangingShape_MPI.bp"); adios2::ADIOS adios(MPI_COMM_WORLD); #else + const std::string fname("BPChangingShape.bp"); adios2::ADIOS adios; #endif // Writer diff --git a/testing/adios2/engine/bp/TestBPChangingShapeWithinStep.cpp b/testing/adios2/engine/bp/TestBPChangingShapeWithinStep.cpp index b8392cc92f..1ee438d0cb 100644 --- a/testing/adios2/engine/bp/TestBPChangingShapeWithinStep.cpp +++ b/testing/adios2/engine/bp/TestBPChangingShapeWithinStep.cpp @@ -38,7 +38,6 @@ TEST_P(BPChangingShapeWithinStep, MultiBlock) auto params = std::get<1>(GetParam()); double epsilon = std::get<2>(GetParam()); - const std::string fname("BPChangingShapeMultiblock_" + operatorName + ".bp"); const int nsteps = 2; const std::vector nblocks = {2, 3}; const int N = 16384; // size of one block (should be big enough to compress) @@ -48,8 +47,10 @@ TEST_P(BPChangingShapeWithinStep, MultiBlock) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &nproc); + const std::string fname("BPChangingShapeMultiblock_" + operatorName + "_MPI.bp"); adios2::ADIOS adios(MPI_COMM_WORLD); #else + const std::string fname("BPChangingShapeMultiblock_" + operatorName + ".bp"); adios2::ADIOS adios; #endif diff --git a/testing/adios2/engine/bp/TestBPDirectIO.cpp b/testing/adios2/engine/bp/TestBPDirectIO.cpp index 67e3884b5c..a0edb30d89 100644 --- a/testing/adios2/engine/bp/TestBPDirectIO.cpp +++ b/testing/adios2/engine/bp/TestBPDirectIO.cpp @@ -27,13 +27,15 @@ TEST_F(ADIOSReadDirectIOTest, BufferResize) and the last chunck is resized back. It should be properly aligned to not cause any problems at writing that chunk. */ - std::string filename = "ADIOSDirectIO.bp"; int mpiRank = 0, mpiSize = 1; #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + std::string filename = "ADIOSDirectIO_MPI.bp"; +#else + std::string filename = "ADIOSDirectIO.bp"; #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPFStreamWriteReadHighLevelAPI.cpp b/testing/adios2/engine/bp/TestBPFStreamWriteReadHighLevelAPI.cpp index f3c3e2b6b2..6a6c71adb8 100644 --- a/testing/adios2/engine/bp/TestBPFStreamWriteReadHighLevelAPI.cpp +++ b/testing/adios2/engine/bp/TestBPFStreamWriteReadHighLevelAPI.cpp @@ -32,7 +32,6 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteRead1D8_hl.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -44,6 +43,9 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead1D8_hl_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead1D8_hl.bp"); #endif // write test data using BP @@ -414,7 +416,6 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPwriteRead2D2x4Test_hl.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -429,6 +430,9 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPwriteRead2D2x4Test_hl_MPI.bp"); +#else + const std::string fname("ADIOS2BPwriteRead2D2x4Test_hl.bp"); #endif // write test data using ADIOS2 @@ -534,7 +538,6 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPwriteRead2D4x2Test_hl.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -548,6 +551,9 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPwriteRead2D4x2Test_hl_MPI.bp"); +#else + const std::string fname("ADIOS2BPwriteRead2D4x2Test_hl.bp"); #endif // write test data using ADIOS2 @@ -652,16 +658,18 @@ TEST_F(StreamWriteReadHighLevelAPI, DoubleOpenException) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BP_hl_exception.bp"); { #if ADIOS2_USE_MPI + const std::string fname("ADIOS2BP_hl_exception_MPI.bp"); adios2::fstream oStream(fname, adios2::fstream::out, MPI_COMM_WORLD, engineName); EXPECT_THROW(oStream.open("second", adios2::fstream::out, MPI_COMM_WORLD, engineName), std::invalid_argument); #else + const std::string fname("ADIOS2BP_hl_exception.bp"); + adios2::fstream oStream(fname, adios2::fstream::out); EXPECT_THROW(oStream.open("second", adios2::fstream::out, engineName), std::invalid_argument); diff --git a/testing/adios2/engine/bp/TestBPFortranToCppReader.cpp b/testing/adios2/engine/bp/TestBPFortranToCppReader.cpp index ec81cd9e0b..f79ed890cb 100644 --- a/testing/adios2/engine/bp/TestBPFortranToCppReader.cpp +++ b/testing/adios2/engine/bp/TestBPFortranToCppReader.cpp @@ -27,13 +27,15 @@ class BPFortranToCppRead : public ::testing::Test TEST_F(BPFortranToCppRead, ADIOS2BPFortranToCppRead) { - const std::string fname("FortranToCpp.bp"); int mpiRank = 0, mpiSize = 1; #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("FortranToCpp_MPI.bp"); +#else + const std::string fname("FortranToCpp.bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/TestBPFortranToCppWriter.F90 b/testing/adios2/engine/bp/TestBPFortranToCppWriter.F90 index 68debc2b3b..0c5de0df8e 100644 --- a/testing/adios2/engine/bp/TestBPFortranToCppWriter.F90 +++ b/testing/adios2/engine/bp/TestBPFortranToCppWriter.F90 @@ -76,14 +76,22 @@ end function iargc if (irank == 0) print *,"engine type :",trim(engine_type) +#if ADIOS2_USE_MPI + call adios2_open(bpWriter, ioWrite, "FortranToCpp_MPI.bp", & + adios2_mode_write, ierr) +#else call adios2_open(bpWriter, ioWrite, "FortranToCpp.bp", & adios2_mode_write, ierr) +#endif do s = 1, 3 call adios2_begin_step(bpWriter, ierr) call adios2_current_step(current_step, bpWriter, ierr) - if (current_step /= s - 1) stop 'wrong current step' + if (current_step /= s - 1) then + write(*,*) 'wrong current step' + stop 1 + end if if (irank == 0 .and. s == 1) then call adios2_put(bpWriter, vGlobalValue, inx, ierr) diff --git a/testing/adios2/engine/bp/TestBPInquireDefine.cpp b/testing/adios2/engine/bp/TestBPInquireDefine.cpp index 05c827ef47..47c12df9f1 100644 --- a/testing/adios2/engine/bp/TestBPInquireDefine.cpp +++ b/testing/adios2/engine/bp/TestBPInquireDefine.cpp @@ -24,7 +24,6 @@ class ADIOSInquireDefineTest : public ::testing::Test TEST_F(ADIOSInquireDefineTest, Read) { - std::string filename = "ADIOSInquireDefine.bp"; // Number of steps const int32_t NSteps = 5; @@ -33,6 +32,9 @@ TEST_F(ADIOSInquireDefineTest, Read) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + std::string filename = "ADIOSInquireDefine_MPI.bp"; +#else + std::string filename = "ADIOSInquireDefine.bp"; #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPInquireVariableException.cpp b/testing/adios2/engine/bp/TestBPInquireVariableException.cpp index c0d251f651..f798dae94d 100644 --- a/testing/adios2/engine/bp/TestBPInquireVariableException.cpp +++ b/testing/adios2/engine/bp/TestBPInquireVariableException.cpp @@ -18,7 +18,6 @@ class ADIOSInquireVariableException : public ::testing::Test TEST_F(ADIOSInquireVariableException, Read) { - std::string filename = "ADIOSInquireVariableException"; // Number of steps const std::size_t NSteps = 5; @@ -28,6 +27,9 @@ TEST_F(ADIOSInquireVariableException, Read) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); + std::string filename = "ADIOSInquireVariableException"; +#else + std::string filename = "ADIOSInquireVariableException"; #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPLargeMetadata.cpp b/testing/adios2/engine/bp/TestBPLargeMetadata.cpp index e190d40c71..598ea2ecc9 100644 --- a/testing/adios2/engine/bp/TestBPLargeMetadata.cpp +++ b/testing/adios2/engine/bp/TestBPLargeMetadata.cpp @@ -34,7 +34,6 @@ TEST_F(BPLargeMetadata, BPWrite1D_LargeMetadata) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("BPWrite1D_LargeMetadata.bp"); int mpiRank = 0, mpiSize = 1; @@ -45,6 +44,9 @@ TEST_F(BPLargeMetadata, BPWrite1D_LargeMetadata) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWrite1D_LargeMetadata_MPI.bp"); +#else + const std::string fname("BPWrite1D_LargeMetadata.bp"); #endif // Write test data using ADIOS2 @@ -99,7 +101,6 @@ TEST_F(BPLargeMetadata, BPWrite1D_LargeMetadata) TEST_F(BPLargeMetadata, ManyLongStrings) { - const std::string fname("BPWrite1D_LargeMetadataStrings.bp"); const std::string longString = "test_string " "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -110,8 +111,10 @@ TEST_F(BPLargeMetadata, ManyLongStrings) #if ADIOS2_USE_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fname("BPWrite1D_LargeMetadataStrings_MPI.bp"); #else adios2::ADIOS adios; + const std::string fname("BPWrite1D_LargeMetadataStrings.bp"); #endif adios2::IO io = adios.DeclareIO("myIO"); diff --git a/testing/adios2/engine/bp/TestBPTimeAggregation.cpp b/testing/adios2/engine/bp/TestBPTimeAggregation.cpp index e567b6ff1f..1d65e0569c 100644 --- a/testing/adios2/engine/bp/TestBPTimeAggregation.cpp +++ b/testing/adios2/engine/bp/TestBPTimeAggregation.cpp @@ -21,7 +21,6 @@ void TimeAggregation1D8(const std::string flushstepscount) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname = "BPTimeAggregation1D8_" + flushstepscount + ".bp"; int mpiRank = 0, mpiSize = 1; // Number of rows @@ -33,6 +32,9 @@ void TimeAggregation1D8(const std::string flushstepscount) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname = "BPTimeAggregation1D8_" + flushstepscount + "_MPI.bp"; +#else + const std::string fname = "BPTimeAggregation1D8_" + flushstepscount + ".bp"; #endif // Write test data using ADIOS2 @@ -343,7 +345,6 @@ void TimeAggregation2D4x2(const std::string flushstepscount) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname = "BPTimeAggregation2D2x4_" + flushstepscount + ".bp"; int mpiRank = 0, mpiSize = 1; // Number of rows @@ -358,6 +359,9 @@ void TimeAggregation2D4x2(const std::string flushstepscount) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname = "BPTimeAggregation2D2x4_" + flushstepscount + "_MPI.bp"; +#else + const std::string fname = "BPTimeAggregation2D2x4_" + flushstepscount + ".bp"; #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteAppendReadADIOS2.cpp b/testing/adios2/engine/bp/TestBPWriteAppendReadADIOS2.cpp index d6bf3776fa..6d3a9d0381 100644 --- a/testing/adios2/engine/bp/TestBPWriteAppendReadADIOS2.cpp +++ b/testing/adios2/engine/bp/TestBPWriteAppendReadADIOS2.cpp @@ -34,7 +34,6 @@ TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteAppendRead2D2x4Test.bp"); const std::string zero = std::to_string(0); const std::string s1_Single = std::string("s1_Single_") + zero; @@ -70,6 +69,9 @@ TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteAppendRead2D2x4Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteAppendRead2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -643,7 +645,6 @@ TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendRead2D2x4) // Write with append combined with aggregation, same aggregation ratio TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendReadAggregate) { - const std::string fname("ADIOS2BPWriteAppendReadAggregate.bp"); int mpiRank = 0, mpiSize = 1; const std::size_t Nx = 4; const std::size_t Ny = 2; @@ -652,8 +653,10 @@ TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendReadAggregate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteAppendReadAggregate_MPI.bp"); adios2::ADIOS adios(MPI_COMM_WORLD); #else + const std::string fname("ADIOS2BPWriteAppendReadAggregate.bp"); adios2::ADIOS adios; #endif { @@ -741,7 +744,6 @@ TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendReadAggregate) // Write with append combined with aggregation, same aggregation ratio TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendReadVaryingAggregation) { - const std::string fname("ADIOS2BPWriteAppendReadVaryingAggregate.bp"); int mpiRank = 0, mpiSize = 1; const std::size_t Nx = 4; const std::size_t Ny = 2; @@ -750,8 +752,10 @@ TEST_F(BPWriteAppendReadTestADIOS2, ADIOS2BPWriteAppendReadVaryingAggregation) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteAppendReadVaryingAggregate_MPI.bp"); adios2::ADIOS adios(MPI_COMM_WORLD); #else + const std::string fname("ADIOS2BPWriteAppendReadVaryingAggregate.bp"); adios2::ADIOS adios; #endif { diff --git a/testing/adios2/engine/bp/TestBPWriteFlushRead.cpp b/testing/adios2/engine/bp/TestBPWriteFlushRead.cpp index 0a769fff0b..3d84552918 100644 --- a/testing/adios2/engine/bp/TestBPWriteFlushRead.cpp +++ b/testing/adios2/engine/bp/TestBPWriteFlushRead.cpp @@ -111,9 +111,13 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2D) io2D.DefineVariable("r64", shape, start, count, adios2::ConstantDims); } +#if ADIOS2_USE_MPI + adios2::Engine bpWriter1D = io1D.Open("Flush1D_MPI.bp", adios2::Mode::Write); + adios2::Engine bpWriter2D = io2D.Open("Flush2D_MPI.bp", adios2::Mode::Write); +#else adios2::Engine bpWriter1D = io1D.Open("Flush1D.bp", adios2::Mode::Write); adios2::Engine bpWriter2D = io2D.Open("Flush2D.bp", adios2::Mode::Write); - +#endif for (size_t step = 0; step < NSteps / 2; ++step) { SmallTestData currentTestData = @@ -160,8 +164,11 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2D) io.SetEngine(engineName); } +#if ADIOS2_USE_MPI + adios2::Engine bpReader = io.Open("Flush1D_MPI.bp", adios2::Mode::Read); +#else adios2::Engine bpReader = io.Open("Flush1D.bp", adios2::Mode::Read); - +#endif unsigned int t = 0; while (bpReader.BeginStep(adios2::StepMode::Read, 0.0) == adios2::StepStatus::OK) @@ -312,8 +319,11 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2D) io.SetEngine(engineName); } +#if ADIOS2_USE_MPI + adios2::Engine bpReader = io.Open("Flush2D_MPI.bp", adios2::Mode::Read); +#else adios2::Engine bpReader = io.Open("Flush2D.bp", adios2::Mode::Read); - +#endif unsigned int t = 0; while (bpReader.BeginStep(adios2::StepMode::Read, 0.0) == adios2::StepStatus::OK) @@ -553,8 +563,13 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2Dstdio) io2D.DefineVariable("r64", shape, start, count, adios2::ConstantDims); } +#if ADIOS2_USE_MPI + adios2::Engine bpWriter1D = io1D.Open("Flush1Dstdio_MPI.bp", adios2::Mode::Write); + adios2::Engine bpWriter2D = io2D.Open("Flush2Dstdio_MPI.bp", adios2::Mode::Write); +#else adios2::Engine bpWriter1D = io1D.Open("Flush1Dstdio.bp", adios2::Mode::Write); adios2::Engine bpWriter2D = io2D.Open("Flush2Dstdio.bp", adios2::Mode::Write); +#endif for (size_t step = 0; step < NSteps / 2; ++step) { @@ -602,8 +617,11 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2Dstdio) io.SetEngine(engineName); } +#if ADIOS2_USE_MPI + adios2::Engine bpReader = io.Open("Flush1Dstdio_MPI.bp", adios2::Mode::Read); +#else adios2::Engine bpReader = io.Open("Flush1Dstdio.bp", adios2::Mode::Read); - +#endif unsigned int t = 0; while (bpReader.BeginStep(adios2::StepMode::Read, 0.0) == adios2::StepStatus::OK) @@ -754,7 +772,11 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2Dstdio) io.SetEngine(engineName); } +#if ADIOS2_USE_MPI + adios2::Engine bpReader = io.Open("Flush2Dstdio_MPI.bp", adios2::Mode::Read); +#else adios2::Engine bpReader = io.Open("Flush2Dstdio.bp", adios2::Mode::Read); +#endif unsigned int t = 0; @@ -995,8 +1017,13 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2Dfstream) io2D.DefineVariable("r64", shape, start, count, adios2::ConstantDims); } +#if ADIOS2_USE_MPI + adios2::Engine bpWriter1D = io1D.Open("Flush1Dfstream_MPI.bp", adios2::Mode::Write); + adios2::Engine bpWriter2D = io2D.Open("Flush2Dfstream_MPI.bp", adios2::Mode::Write); +#else adios2::Engine bpWriter1D = io1D.Open("Flush1Dfstream.bp", adios2::Mode::Write); adios2::Engine bpWriter2D = io2D.Open("Flush2Dfstream.bp", adios2::Mode::Write); +#endif for (size_t step = 0; step < NSteps / 2; ++step) { @@ -1044,7 +1071,11 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2Dfstream) io.SetEngine(engineName); } +#if ADIOS2_USE_MPI + adios2::Engine bpReader = io.Open("Flush1Dfstream_MPI.bp", adios2::Mode::Read); +#else adios2::Engine bpReader = io.Open("Flush1Dfstream.bp", adios2::Mode::Read); +#endif unsigned int t = 0; @@ -1196,7 +1227,11 @@ TEST_F(BPWriteFlushRead, ADIOS2BPWrite1D2Dfstream) io.SetEngine(engineName); } +#if ADIOS2_USE_MPI + adios2::Engine bpReader = io.Open("Flush2Dfstream_MPI.bp", adios2::Mode::Read); +#else adios2::Engine bpReader = io.Open("Flush2Dfstream.bp", adios2::Mode::Read); +#endif unsigned int t = 0; diff --git a/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp b/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp index aa8d516b21..fa70fd610e 100644 --- a/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp +++ b/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp @@ -174,7 +174,6 @@ MPI_Comm testComm; void BPSteps1D(const size_t ghostCells) { - const std::string fname("BPSteps1D_" + std::to_string(ghostCells)); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -186,6 +185,9 @@ void BPSteps1D(const size_t ghostCells) #if ADIOS2_USE_MPI MPI_Comm_rank(testComm, &mpiRank); MPI_Comm_size(testComm, &mpiSize); + const std::string fname("BPSteps1D_" + std::to_string(ghostCells) + "_MPI"); +#else + const std::string fname("BPSteps1D_" + std::to_string(ghostCells)); #endif #if ADIOS2_USE_MPI @@ -386,7 +388,6 @@ void BPSteps1D(const size_t ghostCells) void BPSteps2D4x2(const size_t ghostCells) { - const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells)); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -402,6 +403,9 @@ void BPSteps2D4x2(const size_t ghostCells) #if ADIOS2_USE_MPI MPI_Comm_rank(testComm, &mpiRank); MPI_Comm_size(testComm, &mpiSize); + const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells) + "_MPI"); +#else + const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells)); #endif #if ADIOS2_USE_MPI @@ -612,7 +616,6 @@ void BPSteps2D4x2(const size_t ghostCells) void BPSteps3D8x2x4(const size_t ghostCells) { - const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells)); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -630,6 +633,9 @@ void BPSteps3D8x2x4(const size_t ghostCells) #if ADIOS2_USE_MPI MPI_Comm_rank(testComm, &mpiRank); MPI_Comm_size(testComm, &mpiSize); + const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells) + "_MPI"); +#else + const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells)); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/TestBPWriteMultiblockRead.cpp b/testing/adios2/engine/bp/TestBPWriteMultiblockRead.cpp index 4edc0b8566..79b325bdfc 100644 --- a/testing/adios2/engine/bp/TestBPWriteMultiblockRead.cpp +++ b/testing/adios2/engine/bp/TestBPWriteMultiblockRead.cpp @@ -32,7 +32,6 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteMultiblockRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteMultiblockRead1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -44,6 +43,9 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteMultiblockRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteMultiblockRead1D8_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteMultiblockRead1D8.bp"); #endif // Write test data using BP @@ -369,7 +371,6 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteMultiblockRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteMultiblockRead2D2x4Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -384,6 +385,9 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteMultiblockRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteMultiblockRead2D2x4Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteMultiblockRead2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -711,7 +715,6 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteMultiblockRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteMultiblockRead2D4x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -725,6 +728,9 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteMultiblockRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteMultiblockRead2D4x2Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteMultiblockRead2D4x2Test.bp"); #endif // Write test data using ADIOS2 @@ -1039,7 +1045,6 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteRead1D8ZeroBlock) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteRead1DZeroBlock.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1051,6 +1056,9 @@ TEST_F(BPWriteMultiblockReadTest, ADIOS2BPWriteRead1D8ZeroBlock) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead1DZeroBlock_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead1DZeroBlock.bp"); #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPWriteNull.cpp b/testing/adios2/engine/bp/TestBPWriteNull.cpp index 43f16a59ac..ab20533216 100644 --- a/testing/adios2/engine/bp/TestBPWriteNull.cpp +++ b/testing/adios2/engine/bp/TestBPWriteNull.cpp @@ -33,7 +33,6 @@ TEST_F(BPWriteNullTest, BPWrite1D1x8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteNull.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -45,6 +44,9 @@ TEST_F(BPWriteNullTest, BPWrite1D1x8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteNull_MPI.bp"); +#else + const std::string fname("BPWriteNull.bp"); #endif // Write test data using BP @@ -317,7 +319,6 @@ TEST_F(BPWriteNullTest, BPWrite2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("BPWrite2D4x2TestNull.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -331,6 +332,9 @@ TEST_F(BPWriteNullTest, BPWrite2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWrite2D4x2TestNull_MPI.bp"); +#else + const std::string fname("BPWrite2D4x2TestNull.bp"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteProfilingJSON.cpp b/testing/adios2/engine/bp/TestBPWriteProfilingJSON.cpp index 1c2ef91ee3..959106b3b1 100644 --- a/testing/adios2/engine/bp/TestBPWriteProfilingJSON.cpp +++ b/testing/adios2/engine/bp/TestBPWriteProfilingJSON.cpp @@ -43,7 +43,6 @@ TEST_F(BPWriteProfilingJSONTest, DISABLED_ADIOS2BPWriteProfilingJSON) { // Use a relative path + file name to test path in file name capability std::string fname; - fname = "foo/ADIOS2BPWriteProfilingJSON.bp"; int mpiRank = 0, mpiSize = 1; // Number of rows @@ -55,6 +54,9 @@ TEST_F(BPWriteProfilingJSONTest, DISABLED_ADIOS2BPWriteProfilingJSON) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + fname = "foo/ADIOS2BPWriteProfilingJSON_MPI.bp"; +#else + fname = "foo/ADIOS2BPWriteProfilingJSON.bp"; #endif // Write test data and profiling.json using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteReadADIOS2.cpp b/testing/adios2/engine/bp/TestBPWriteReadADIOS2.cpp index ef44278fdb..5bcb64af4b 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadADIOS2.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadADIOS2.cpp @@ -35,7 +35,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteRead1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -47,6 +46,9 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead1D8_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead1D8.bp"); #endif // Write test data using BP @@ -419,7 +421,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteRead2D2x4Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -434,6 +435,9 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D2x4Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -739,7 +743,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -753,6 +756,9 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test.bp"); #endif // Write test data using ADIOS2 @@ -1045,7 +1051,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead10D2x2) { // Each process would write a 2x2x...x2 9D array and all processes would // form a 10D NumberOfProcess x 2 x ... x 2) array - const std::string fname("ADIOS2BPWriteRead10D2x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of steps @@ -1054,6 +1059,9 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead10D2x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead10D2x2Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead10D2x2Test.bp"); #endif size_t NX = static_cast(mpiSize); @@ -1227,7 +1235,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D4x2_ReadMultiSteps) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiSteps.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1242,6 +1249,9 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D4x2_ReadMultiSteps) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiSteps_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiSteps.bp"); #endif // Write test data using ADIOS2 @@ -1534,7 +1544,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflow.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1549,6 +1558,9 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflow_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflow.bp"); #endif // Write test data using ADIOS2 @@ -1790,7 +1802,6 @@ TEST_F(BPWriteReadTestADIOS2, ReadStartCount) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ReadStartCount.bp"); int mpiRank = 0, mpiSize = 1; @@ -1799,6 +1810,9 @@ TEST_F(BPWriteReadTestADIOS2, ReadStartCount) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ReadStartCount_MPI.bp"); +#else + const std::string fname("ReadStartCount.bp"); #endif std::vector localData(Nx); @@ -2027,7 +2041,6 @@ TEST_F(BPWriteReadTestADIOS2, ADIOS2BPWriteReadEmptyProcess) TEST_F(BPWriteReadTestADIOS2, GetDeferredInClose) { // Test if Get() will retrieve data in Close() - const std::string fname("GetDeferredInClose.bp"); int mpiRank = 0, mpiSize = 1; @@ -2036,6 +2049,9 @@ TEST_F(BPWriteReadTestADIOS2, GetDeferredInClose) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("GetDeferredInClose_MPI.bp"); +#else + const std::string fname("GetDeferredInClose.bp"); #endif std::vector localData(Nx); @@ -2095,7 +2111,6 @@ TEST_F(BPWriteReadTestADIOS2, GetDeferredInClose) TEST_F(BPWriteReadTestADIOS2, GetDeferredInEndStep) { // Test if Get() will retrieve data in EndStep() - const std::string fname("GetDeferredInEndStep.bp"); int mpiRank = 0, mpiSize = 1; @@ -2104,6 +2119,9 @@ TEST_F(BPWriteReadTestADIOS2, GetDeferredInEndStep) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("GetDeferredInEndStep_MPI.bp"); +#else + const std::string fname("GetDeferredInEndStep.bp"); #endif std::vector localData(Nx); @@ -2164,7 +2182,6 @@ TEST_F(BPWriteReadTestADIOS2, GetDeferredInEndStep) TEST_F(BPWriteReadTestADIOS2, GetDeferredWithoutEndStep) { // Test if Get() will retrieve data in Close() when EndStep() is not called - const std::string fname("GetDeferredWithoutEndStep.bp"); int mpiRank = 0, mpiSize = 1; @@ -2173,6 +2190,9 @@ TEST_F(BPWriteReadTestADIOS2, GetDeferredWithoutEndStep) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("GetDeferredWithoutEndStep_MPI.bp"); +#else + const std::string fname("GetDeferredWithoutEndStep.bp"); #endif std::vector localData(Nx); diff --git a/testing/adios2/engine/bp/TestBPWriteReadADIOS2fstream.cpp b/testing/adios2/engine/bp/TestBPWriteReadADIOS2fstream.cpp index 9eaab05c5a..db8116021e 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadADIOS2fstream.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadADIOS2fstream.cpp @@ -33,7 +33,6 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteRead1D8fstream.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -45,6 +44,9 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead1D8fstream_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead1D8fstream.bp"); #endif // Write test data using BP @@ -370,7 +372,6 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteRead2D2x4Testfstream.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -385,6 +386,9 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D2x4Testfstream_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D2x4Testfstream.bp"); #endif // Write test data using ADIOS2 @@ -711,7 +715,6 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Testfstream.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -725,6 +728,9 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Testfstream_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Testfstream.bp"); #endif // Write test data using ADIOS2 @@ -1037,7 +1043,6 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D4x2_ReadMultiSteps) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsfstream.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1052,6 +1057,9 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D4x2_ReadMultiSteps) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsfstream_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsfstream.bp"); #endif // Write test data using ADIOS2 @@ -1364,7 +1372,6 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowfstream.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1379,6 +1386,9 @@ TEST_F(BPWriteReadTestADIOS2fstream, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowfstream_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowfstream.bp"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp b/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp index af8b80c411..c4b259f12a 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp @@ -33,7 +33,6 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteRead1D8stdio.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -45,6 +44,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead1D8stdio_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead1D8stdio.bp"); #endif // Write test data using BP @@ -369,7 +371,6 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -384,6 +385,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio.bp"); #endif // Write test data using ADIOS2 @@ -710,7 +714,6 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -724,6 +727,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio.bp"); #endif // Write test data using ADIOS2 @@ -1036,7 +1042,6 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2_ReadMultiSteps) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1051,6 +1056,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2_ReadMultiSteps) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio.bp"); #endif // Write test data using ADIOS2 @@ -1363,7 +1371,6 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1378,6 +1385,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio.bp"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2.cpp b/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2.cpp index 2089eff466..e6e4c03347 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2.cpp @@ -28,7 +28,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadAsStream1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -38,8 +37,11 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead1D8) const size_t NSteps = 5; #if ADIOS2_USE_MPI + const std::string fname("ADIOS2BPWriteReadAsStream1D8_MPI.bp"); MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); +#else + const std::string fname("ADIOS2BPWriteReadAsStream1D8.bp"); #endif // Write test data using BP @@ -383,7 +385,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteReadAsStream2D2x4Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -396,8 +397,11 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead2D2x4) const std::size_t NSteps = 3; #if ADIOS2_USE_MPI + const std::string fname("ADIOS2BPWriteReadAsStream2D2x4Test_MPI.bp"); MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); +#else + const std::string fname("ADIOS2BPWriteReadAsStream2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -624,7 +628,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteReadAsStream2D4x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -636,8 +639,11 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead2D4x2) const std::size_t NSteps = 3; #if ADIOS2_USE_MPI + const std::string fname("ADIOS2BPWriteReadAsStream2D4x2Test_MPI.bp"); MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); +#else + const std::string fname("ADIOS2BPWriteReadAsStream2D4x2Test.bp"); #endif // Write test data using ADIOS2 @@ -869,8 +875,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ADIOS2BPWriteRead2D4x2) TEST_F(BPWriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) { - const std::string fnameFloat("BPReaderWriterDefineVariable_float.bp"); - const std::string fname("BPReaderWriterDefineVariable_all.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -882,8 +886,13 @@ TEST_F(BPWriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) const std::size_t NSteps = 3; #if ADIOS2_USE_MPI + const std::string fnameFloat("BPReaderWriterDefineVariable_float_MPI.bp"); + const std::string fname("BPReaderWriterDefineVariable_all_MPI.bp"); MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); +#else + const std::string fnameFloat("BPReaderWriterDefineVariable_float.bp"); + const std::string fname("BPReaderWriterDefineVariable_all.bp"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2_Threads.cpp b/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2_Threads.cpp index 87aea696d8..50744630fc 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2_Threads.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2_Threads.cpp @@ -32,7 +32,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2_Threads, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadAsStream_Threads1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -44,6 +43,9 @@ TEST_F(BPWriteReadAsStreamTestADIOS2_Threads, ADIOS2BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadAsStream_Threads1D8_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadAsStream_Threads1D8.bp"); #endif // Write test data using BP @@ -266,7 +268,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2_Threads, ADIOS2BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteReadAsStream_Threads2D2x4Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -281,6 +282,9 @@ TEST_F(BPWriteReadAsStreamTestADIOS2_Threads, ADIOS2BPWriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadAsStream_Threads2D2x4Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadAsStream_Threads2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -513,7 +517,6 @@ TEST_F(BPWriteReadAsStreamTestADIOS2_Threads, ADIOS2BPWriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteReadAsStream_Threads2D4x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -527,6 +530,9 @@ TEST_F(BPWriteReadAsStreamTestADIOS2_Threads, ADIOS2BPWriteRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadAsStream_Threads2D4x2Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadAsStream_Threads2D4x2Test.bp"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/TestBPWriteReadAttributes.cpp b/testing/adios2/engine/bp/TestBPWriteReadAttributes.cpp index 5195fdb902..70da65f48c 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadAttributes.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadAttributes.cpp @@ -28,8 +28,6 @@ class BPWriteReadAttributes : public ::testing::Test // ADIOS2 write, read for single value attributes TEST_F(BPWriteReadAttributes, WriteReadSingleTypes) { - const std::string fName = - "foo" + std::string(&adios2::PathSeparator, 1) + "WriteAttributeReadSingleTypes.bp"; const std::string zero = std::to_string(0); const std::string s1_Single = std::string("s1_Single_") + zero; @@ -56,7 +54,11 @@ TEST_F(BPWriteReadAttributes, WriteReadSingleTypes) // Write test data using BP #if ADIOS2_USE_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "WriteAttributeReadSingleTypes_MPI.bp"; #else + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "WriteAttributeReadSingleTypes.bp"; adios2::ADIOS adios; #endif { @@ -227,13 +229,16 @@ TEST_F(BPWriteReadAttributes, WriteReadSingleTypes) // ADIOS2 write read for array attributes TEST_F(BPWriteReadAttributes, WriteReadArrayTypes) { - const std::string fName = - "foo" + std::string(&adios2::PathSeparator, 1) + "WriteAttributeReadArrayTypes.bp"; #if ADIOS2_USE_MPI int mpiRank = 0, mpiSize = 1; MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "WriteAttributeReadArrayTypes_MPI.bp"; +#else + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "WriteAttributeReadArrayTypes.bp"; #endif const std::string zero = std::to_string(0); @@ -443,8 +448,6 @@ TEST_F(BPWriteReadAttributes, WriteReadArrayTypes) TEST_F(BPWriteReadAttributes, BPWriteReadSingleTypesVar) { - const std::string fName = - "foo" + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadSingleTypesVar.bp"; const std::string zero = std::to_string(0); const std::string s1_Single = std::string("s1_Single_") + zero; @@ -472,7 +475,11 @@ TEST_F(BPWriteReadAttributes, BPWriteReadSingleTypesVar) // Write test data using BP #if ADIOS2_USE_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fName = "foo" + std::string(&adios2::PathSeparator, 1) + + "BPWriteAttributeReadSingleTypesVar_MPI.bp"; #else + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadSingleTypesVar.bp"; adios2::ADIOS adios; #endif { @@ -630,13 +637,16 @@ TEST_F(BPWriteReadAttributes, BPWriteReadSingleTypesVar) // ADIOS2 write read for array attributes TEST_F(BPWriteReadAttributes, WriteReadArrayTypesVar) { - const std::string fName = - "foo" + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar.bp"; #if ADIOS2_USE_MPI int mpiRank = 0, mpiSize = 1; MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar_MPI.bp"; +#else + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar.bp"; #endif const std::string zero = std::to_string(0); @@ -849,8 +859,6 @@ TEST_F(BPWriteReadAttributes, WriteReadArrayTypesVar) TEST_F(BPWriteReadAttributes, WriteReadStreamVarp) { - const std::string fName = - "foo" + std::string(&adios2::PathSeparator, 1) + "AttributesWriteReadVar.bp"; const std::string separator = "\\"; @@ -864,6 +872,11 @@ TEST_F(BPWriteReadAttributes, WriteReadStreamVarp) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "AttributesWriteReadVar_MPI.bp"; +#else + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "AttributesWriteReadVar.bp"; #endif SmallTestData currentTestData = generateNewSmallTestData(m_TestData, 0, 0, 0); @@ -1003,8 +1016,6 @@ TEST_F(BPWriteReadAttributes, WriteReadStreamVarp) TEST_F(BPWriteReadAttributes, WriteReadStreamModifiable) { - const std::string fName = - "foo" + std::string(&adios2::PathSeparator, 1) + "AttributesWriteReadModifiable.bp"; const std::string separator = "\\"; @@ -1018,6 +1029,11 @@ TEST_F(BPWriteReadAttributes, WriteReadStreamModifiable) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "AttributesWriteReadModifiable_MPI.bp"; +#else + const std::string fName = + "foo" + std::string(&adios2::PathSeparator, 1) + "AttributesWriteReadModifiable.bp"; #endif const double d3[3] = {-1.1, -1.2, -1.3}; diff --git a/testing/adios2/engine/bp/TestBPWriteReadCuda.cpp b/testing/adios2/engine/bp/TestBPWriteReadCuda.cpp index a3f1797e34..880c55de35 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadCuda.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadCuda.cpp @@ -292,7 +292,6 @@ void CUDAWriteReadMemorySelection() void CUDAWriteReadMPI1D(const std::string mode) { - const std::string fname("BPWRCU1D_" + mode + ".bp"); adios2::Mode ioMode = adios2::Mode::Deferred; if (mode == "Sync") ioMode = adios2::Mode::Sync; @@ -306,6 +305,9 @@ void CUDAWriteReadMPI1D(const std::string mode) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRCU1D_" + mode + "_MPI.bp"); +#else + const std::string fname("BPWRCU1D_" + mode + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/TestBPWriteReadLocalVariables.cpp b/testing/adios2/engine/bp/TestBPWriteReadLocalVariables.cpp index 9fd6c2d71a..05c23ccbfc 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadLocalVariables.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadLocalVariables.cpp @@ -29,7 +29,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1D) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal1D.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -41,6 +40,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1D) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal1D_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal1D.bp"); #endif // Write test data using BP @@ -418,7 +420,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D2x4) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal2D2x4.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 4; @@ -430,6 +431,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal2D2x4_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal2D2x4.bp"); #endif // Write test data using BP @@ -793,7 +797,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D4x2) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal2D4x2.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 2; @@ -805,6 +808,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal2D4x2_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal2D4x2.bp"); #endif // Write test data using BP @@ -1169,7 +1175,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DAllSteps) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal1DAllSteps.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1181,6 +1186,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DAllSteps) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal1DAllSteps_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal1DAllSteps.bp"); #endif // Write test data using BP @@ -1443,7 +1451,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DBlockInfo) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal1DBlockInfo.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1455,6 +1462,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DBlockInfo) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal1DBlockInfo_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal1DBlockInfo.bp"); #endif // Write test data using BP @@ -1721,13 +1731,14 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DSubFile) TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2DChangeCount) { - const std::string fname("BPWRLocal2DChangeCount_" + engineName + ".bp"); - int mpiRank = 0; int mpiSize = 1; #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRLocal2DChangeCount_" + engineName + "_MPI.bp"); +#else + const std::string fname("BPWRLocal2DChangeCount_" + engineName + ".bp"); #endif const size_t Nx0 = static_cast(std::pow(2 - mpiRank, 2)) + 1; diff --git a/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSel.cpp b/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSel.cpp index 558e55014a..399b1b6fd2 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSel.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSel.cpp @@ -28,7 +28,6 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal1DSel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadLocal1DSel.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -40,6 +39,9 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal1DSel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal1DSel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal1DSel.bp"); #endif // Write test data using BP @@ -440,7 +442,6 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal2D2x4Sel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadLocal2D2x4Sel.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 4; @@ -452,6 +453,9 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal2D2x4Sel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal2D2x4Sel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal2D2x4Sel.bp"); #endif // Write test data using BP @@ -899,7 +903,6 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal2D4x2Sel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadLocal2D4x2Sel.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 2; @@ -911,6 +914,9 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal2D4x2Sel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal2D4x2Sel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal2D4x2Sel.bp"); #endif // Write test data using BP @@ -1357,7 +1363,6 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal1DAllStepsSel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadLocal1DAllStepsSel.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1369,6 +1374,9 @@ TEST_F(BPWriteReadLocalVariablesSel, BPWriteReadLocal1DAllStepsSel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal1DAllStepsSel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal1DAllStepsSel.bp"); #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSelHighLevel.cpp b/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSelHighLevel.cpp index eaa9d3fdfb..525a955ccc 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSelHighLevel.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadLocalVariablesSelHighLevel.cpp @@ -28,7 +28,6 @@ TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal1DSel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadLocal1DSelHighLevel.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -40,6 +39,9 @@ TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal1DSel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal1DSelHighLevel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal1DSelHighLevel.bp"); #endif // Write test data using BP @@ -168,7 +170,6 @@ TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal1DSel) TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal2D2x4Sel) { - const std::string fname("BPWriteReadLocal2D2x4SelHighLevel.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -181,6 +182,9 @@ TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal2D2x4Sel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal2D2x4SelHighLevel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal2D2x4SelHighLevel.bp"); #endif // Write test data using BP @@ -332,7 +336,6 @@ TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal1DAllStepsSel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadLocal1DAllStepsSelHighLevel.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -344,6 +347,9 @@ TEST_F(BPWriteReadLocalVariablesSelHighLevel, BPWriteReadLocal1DAllStepsSel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadLocal1DAllStepsSelHighLevel_MPI.bp"); +#else + const std::string fname("BPWriteReadLocal1DAllStepsSelHighLevel.bp"); #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPWriteReadMultiblock.cpp b/testing/adios2/engine/bp/TestBPWriteReadMultiblock.cpp index a43c0e20df..0edfffc738 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadMultiblock.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadMultiblock.cpp @@ -33,7 +33,6 @@ TEST_F(BPWriteReadMultiblockTest, ADIOS2BPWriteReadMultiblock1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadMultiblock1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -45,6 +44,9 @@ TEST_F(BPWriteReadMultiblockTest, ADIOS2BPWriteReadMultiblock1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadMultiblock1D8_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadMultiblock1D8.bp"); #endif // Write test data using BP @@ -773,7 +775,6 @@ TEST_F(BPWriteReadMultiblockTest, ADIOS2BPWriteReadMultiblock2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteReadMultiblock2D2x4Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -788,6 +789,9 @@ TEST_F(BPWriteReadMultiblockTest, ADIOS2BPWriteReadMultiblock2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadMultiblock2D2x4Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadMultiblock2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -1182,7 +1186,6 @@ TEST_F(BPWriteReadMultiblockTest, ADIOS2BPWriteReadMultiblock2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteReadMultiblock2D4x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1196,6 +1199,9 @@ TEST_F(BPWriteReadMultiblockTest, ADIOS2BPWriteReadMultiblock2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadMultiblock2D4x2Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadMultiblock2D4x2Test.bp"); #endif // Write test data using ADIOS2 @@ -1971,7 +1977,6 @@ TEST_F(BPWriteReadMultiblockTest, MultiblockPerformDataWrite) } // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("MultiblockPerformDataWrite.bp"); int mpiRank = 0, mpiSize = 1; // Number of elements per blocks (blocksize) @@ -1990,8 +1995,10 @@ TEST_F(BPWriteReadMultiblockTest, MultiblockPerformDataWrite) #if ADIOS2_USE_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fname("MultiblockPerformDataWrite_MPI.bp"); #else adios2::ADIOS adios; + const std::string fname("MultiblockPerformDataWrite.bp"); #endif /* Write output */ { @@ -2102,7 +2109,6 @@ TEST_F(BPWriteReadMultiblockTest, MultiblockNullBlocks) { // Each process would write a 2x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("MultiblockNullBlocks.bp"); int mpiRank = 0, mpiSize = 1; // Number of elements per blocks (blocksize) @@ -2115,6 +2121,9 @@ TEST_F(BPWriteReadMultiblockTest, MultiblockNullBlocks) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("MultiblockNullBlocks_MPI.bp"); +#else + const std::string fname("MultiblockNullBlocks.bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/TestBPWriteReadVariableSpan.cpp b/testing/adios2/engine/bp/TestBPWriteReadVariableSpan.cpp index 57fe702338..4043a4c3d2 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadVariableSpan.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadVariableSpan.cpp @@ -28,7 +28,6 @@ TEST_F(BPWriteReadSpan, BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadSpan1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -40,6 +39,9 @@ TEST_F(BPWriteReadSpan, BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadSpan1D8_MPI.bp"); +#else + const std::string fname("BPWriteReadSpan1D8.bp"); #endif #if ADIOS2_USE_MPI @@ -317,7 +319,6 @@ TEST_F(BPWriteReadSpan, BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("BPWriteReadSpan2D2x4.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -332,6 +333,9 @@ TEST_F(BPWriteReadSpan, BPWriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadSpan2D2x4_MPI.bp"); +#else + const std::string fname("BPWriteReadSpan2D2x4.bp"); #endif // Write test data using ADIOS2 @@ -628,7 +632,6 @@ TEST_F(BPWriteReadSpan, BPWriteRead2D2x4) TEST_F(BPWriteReadSpan, BPWriteRead1D8Local) { - const std::string fname("BPWriteReadSpan1D8Local.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -640,6 +643,9 @@ TEST_F(BPWriteReadSpan, BPWriteRead1D8Local) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadSpan1D8Local_MPI.bp"); +#else + const std::string fname("BPWriteReadSpan1D8Local.bp"); #endif // Write test data using BP @@ -877,7 +883,6 @@ TEST_F(BPWriteReadSpan, BPWriteRead2D2x4Local) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("BPWriteReadSpan2D2x4Local.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -892,6 +897,9 @@ TEST_F(BPWriteReadSpan, BPWriteRead2D2x4Local) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadSpan2D2x4Local_MPI.bp"); +#else + const std::string fname("BPWriteReadSpan2D2x4Local.bp"); #endif // Write test data using ADIOS2 @@ -1156,7 +1164,6 @@ TEST_F(BPWriteReadSpan, BPWriteRead1D8FillValue) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWriteReadSpan1D8FillValue.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1168,6 +1175,9 @@ TEST_F(BPWriteReadSpan, BPWriteRead1D8FillValue) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadSpan1D8FillValue_MPI.bp"); +#else + const std::string fname("BPWriteReadSpan1D8FillValue.bp"); #endif // Write test data using BP @@ -1469,7 +1479,6 @@ TEST_F(BPWriteReadSpan, BPWriteRead1D8FillValue) #ifdef ADIOS2_HAVE_BZIP2 TEST_F(BPWriteReadSpan, BPWriteSpanOperatorException) { - const std::string fname("BPWriteSpanOperatorException.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1481,6 +1490,9 @@ TEST_F(BPWriteReadSpan, BPWriteSpanOperatorException) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteSpanOperatorException_MPI.bp"); +#else + const std::string fname("BPWriteSpanOperatorException.bp"); #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/TestBPWriteReadVector.cpp b/testing/adios2/engine/bp/TestBPWriteReadVector.cpp index 595a6c5578..9baeb7369e 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadVector.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadVector.cpp @@ -32,7 +32,6 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadVector1D8.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -44,6 +43,9 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteRead1D8) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadVector1D8_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadVector1D8.bp"); #endif // Write test data using BP @@ -342,7 +344,6 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2BPWriteReadVector2D2x4Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -357,6 +358,9 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteRead2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadVector2D2x4Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadVector2D2x4Test.bp"); #endif // Write test data using ADIOS2 @@ -655,7 +659,6 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteReadVector2D4x2Test.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -669,6 +672,9 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteRead2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadVector2D4x2Test_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadVector2D4x2Test.bp"); #endif // Write test data using ADIOS2 @@ -952,7 +958,6 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteReadVector2D4x2_MultiSteps) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2BPWriteReadVector2D4x2_MultiSteps.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -967,6 +972,9 @@ TEST_F(BPWriteReadVector, ADIOS2BPWriteReadVector2D4x2_MultiSteps) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadVector2D4x2_MultiSteps_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadVector2D4x2_MultiSteps.bp"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadBZIP2.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadBZIP2.cpp index dcbafcccf0..651531ff22 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadBZIP2.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadBZIP2.cpp @@ -19,7 +19,6 @@ void BZIP2Accuracy1D(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWR_BZIP2_1D_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -38,6 +37,9 @@ void BZIP2Accuracy1D(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWR_BZIP2_1D_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWR_BZIP2_1D_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -152,7 +154,6 @@ void BZIP2Accuracy1DLocal(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // write a Nx 1D array - const std::string fname("BPWR_BZIP2_1D_Local_" + accuracy + ".bp"); int mpiRank = 0; // Number of rows @@ -170,6 +171,9 @@ void BZIP2Accuracy1DLocal(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); + const std::string fname("BPWR_BZIP2_1D_Local_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWR_BZIP2_1D_Local_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -280,7 +284,6 @@ void BZIP2Accuracy2D(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBZIP22D_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -300,6 +303,9 @@ void BZIP2Accuracy2D(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBZIP22D_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRBZIP22D_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -414,7 +420,6 @@ void BZIP2Accuracy3D(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBZIP23D_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -435,6 +440,9 @@ void BZIP2Accuracy3D(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBZIP23D_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRBZIP23D_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -551,7 +559,6 @@ void BZIP2Accuracy1DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBZIP21DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -570,6 +577,9 @@ void BZIP2Accuracy1DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBZIP21DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRBZIP21DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -682,7 +692,6 @@ void BZIP2Accuracy2DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBZIP22DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -702,6 +711,9 @@ void BZIP2Accuracy2DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBZIP22DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRBZIP22DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -816,7 +828,6 @@ void BZIP2Accuracy3DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBZIP23DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -837,6 +848,9 @@ void BZIP2Accuracy3DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBZIP23DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRBZIP23DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc.cpp index 4f711437d8..09908075cb 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc.cpp @@ -21,8 +21,6 @@ void BloscAccuracy1D(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWR_Blosc_1D_" + accuracy + "_" + threshold + "_" + doshuffle + - ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -41,6 +39,11 @@ void BloscAccuracy1D(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWR_Blosc_1D_" + accuracy + "_" + threshold + "_" + doshuffle + + "_MPI.bp"); +#else + const std::string fname("BPWR_Blosc_1D_" + accuracy + "_" + threshold + "_" + doshuffle + + ".bp"); #endif #if ADIOS2_USE_MPI @@ -160,8 +163,6 @@ void BloscAccuracy2D(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc2D_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -181,6 +182,11 @@ void BloscAccuracy2D(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc2D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc2D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -300,8 +306,6 @@ void BloscAccuracy3D(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc3D_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -322,6 +326,11 @@ void BloscAccuracy3D(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc3D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc3D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -443,8 +452,6 @@ void BloscAccuracy1DSel(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc1DSel_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -463,6 +470,11 @@ void BloscAccuracy1DSel(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc1DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc1DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -580,8 +592,6 @@ void BloscAccuracy2DSel(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc2DSel_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -601,6 +611,11 @@ void BloscAccuracy2DSel(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc2DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc2DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -720,8 +735,6 @@ void BloscAccuracy3DSel(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc3DSel_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -742,6 +755,11 @@ void BloscAccuracy3DSel(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc3DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc3DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc2.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc2.cpp index 9e72a351b5..e6852d3471 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc2.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadBlosc2.cpp @@ -21,8 +21,6 @@ void Blosc2Accuracy1D(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWR_Blosc2_1D_" + accuracy + "_" + threshold + "_" + doshuffle + - ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -41,6 +39,11 @@ void Blosc2Accuracy1D(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWR_Blosc2_1D_" + accuracy + "_" + threshold + "_" + doshuffle + + "_MPI.bp"); +#else + const std::string fname("BPWR_Blosc2_1D_" + accuracy + "_" + threshold + "_" + doshuffle + + ".bp"); #endif #if ADIOS2_USE_MPI @@ -160,8 +163,6 @@ void Blosc2Accuracy2D(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc22D_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -181,6 +182,11 @@ void Blosc2Accuracy2D(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc22D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc22D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -300,8 +306,6 @@ void Blosc2Accuracy3D(const std::string accuracy, const std::string threshold, { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc23D_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -322,6 +326,11 @@ void Blosc2Accuracy3D(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc23D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc23D_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -443,8 +452,6 @@ void Blosc2Accuracy1DSel(const std::string accuracy, const std::string threshold { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc21DSel_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -463,6 +470,11 @@ void Blosc2Accuracy1DSel(const std::string accuracy, const std::string threshold #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc21DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc21DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -580,8 +592,6 @@ void Blosc2Accuracy2DSel(const std::string accuracy, const std::string threshold { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc22DSel_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -601,6 +611,11 @@ void Blosc2Accuracy2DSel(const std::string accuracy, const std::string threshold #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc22DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc22DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -720,8 +735,6 @@ void Blosc2Accuracy3DSel(const std::string accuracy, const std::string threshold { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc23DSel_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -742,6 +755,11 @@ void Blosc2Accuracy3DSel(const std::string accuracy, const std::string threshold #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc23DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc23DSel_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI @@ -867,8 +885,6 @@ void Blosc2NullBlocks(const std::string accuracy, const std::string threshold, // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRBlosc2NullBlock_" + accuracy + "_" + threshold + threshold + "_" + - doshuffle + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -883,6 +899,11 @@ void Blosc2NullBlocks(const std::string accuracy, const std::string threshold, #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRBlosc2NullBlock_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + "_MPI.bp"); +#else + const std::string fname("BPWRBlosc2NullBlock_" + accuracy + "_" + threshold + threshold + "_" + + doshuffle + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadLocalVariables.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadLocalVariables.cpp index ec36175659..a725ddf620 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadLocalVariables.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadLocalVariables.cpp @@ -26,7 +26,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1D) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal1D.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -38,6 +37,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1D) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal1D_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal1D.bp"); #endif // Write test data using BP @@ -375,7 +377,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D2x4) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal2D2x4.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 4; @@ -387,6 +388,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D2x4) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal2D2x4_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal2D2x4.bp"); #endif // Write test data using BP @@ -730,7 +734,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D4x2) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal2D4x2.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 2; @@ -742,6 +745,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal2D4x2) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal2D4x2_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal2D4x2.bp"); #endif // Write test data using BP @@ -1086,7 +1092,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DAllSteps) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal1DAllSteps.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1098,6 +1103,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DAllSteps) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal1DAllSteps_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal1DAllSteps.bp"); #endif // Write test data using BP @@ -1324,7 +1332,6 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DBlockInfo) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2BPWriteReadLocal1DBlockInfo.bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -1336,6 +1343,9 @@ TEST_F(BPWriteReadLocalVariables, ADIOS2BPWriteReadLocal1DBlockInfo) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2BPWriteReadLocal1DBlockInfo_MPI.bp"); +#else + const std::string fname("ADIOS2BPWriteReadLocal1DBlockInfo.bp"); #endif // Write test data using BP diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARD.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARD.cpp index c5f98e4a90..282347cc4d 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARD.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARD.cpp @@ -20,7 +20,6 @@ void MGARDAccuracy1D(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD1D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -39,6 +38,9 @@ void MGARDAccuracy1D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD1D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD1D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -175,7 +177,6 @@ void MGARDAccuracy2D(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD2D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -195,6 +196,9 @@ void MGARDAccuracy2D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD2D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD2D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -336,7 +340,6 @@ void MGARDAccuracy3D(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD3D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -357,6 +360,9 @@ void MGARDAccuracy3D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD3D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD3D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -498,7 +504,6 @@ void MGARDAccuracy1DSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD1DSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -517,6 +522,9 @@ void MGARDAccuracy1DSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD1DSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD1DSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -627,7 +635,6 @@ void MGARDAccuracy2DSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD2DSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -647,6 +654,9 @@ void MGARDAccuracy2DSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD2DSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD2DSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -759,7 +769,6 @@ void MGARDAccuracy3DSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD3DSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -780,6 +789,9 @@ void MGARDAccuracy3DSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD3DSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD3DSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -899,7 +911,6 @@ void MGARDNullBlocks(const std::string tolerance) // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARDNull_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -915,6 +926,9 @@ void MGARDNullBlocks(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARDNull_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARDNull_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDCuda.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDCuda.cpp index a93adfcbbe..24b4c2dffe 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDCuda.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDCuda.cpp @@ -20,7 +20,6 @@ std::string engineName; // comes from command line void MGARDAccuracy2D(const std::string tolerance) { - const std::string fname("BPWRMGARDCU2D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 100; @@ -33,6 +32,9 @@ void MGARDAccuracy2D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARDCU2D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARDCU2D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -140,7 +142,6 @@ void MGARDAccuracySmall(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD1D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -155,6 +156,9 @@ void MGARDAccuracySmall(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD1D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD1D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDMDR.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDMDR.cpp index 084e21631b..253c71da24 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDMDR.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDMDR.cpp @@ -28,7 +28,6 @@ TEST_F(BPWriteReadMGARDMDR, BPWRMGARD1D) { // Refactor a dataset with MDR, then // read back with various accuracies - const std::string fname("BPWRMGARDMDR1D.bp"); int mpiRank = 0, mpiSize = 1; const size_t Nx = 30000; // 100k minimum data size for MDR @@ -49,6 +48,9 @@ TEST_F(BPWriteReadMGARDMDR, BPWRMGARD1D) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARDMDR1D_MPI.bp"); +#else + const std::string fname("BPWRMGARDMDR1D.bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDPlus.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDPlus.cpp index 3897361960..a1f95eaa08 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDPlus.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadMGARDPlus.cpp @@ -20,7 +20,6 @@ void MGARDAccuracy1D(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD1D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -39,6 +38,9 @@ void MGARDAccuracy1D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD1D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD1D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -151,7 +153,6 @@ void MGARDAccuracy2D(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD2D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -171,6 +172,9 @@ void MGARDAccuracy2D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD2D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD2D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -284,7 +288,6 @@ void MGARDAccuracy3D(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD3D_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -305,6 +308,9 @@ void MGARDAccuracy3D(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD3D_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD3D_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -420,7 +426,6 @@ void MGARDAccuracy1DSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD1DSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -439,6 +444,9 @@ void MGARDAccuracy1DSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD1DSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD1DSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -541,7 +549,6 @@ void MGARDAccuracy2DSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD2DSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -561,6 +568,9 @@ void MGARDAccuracy2DSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD2DSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD2DSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -666,7 +676,6 @@ void MGARDAccuracy3DSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD3DSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -687,6 +696,9 @@ void MGARDAccuracy3DSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD3DSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD3DSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI @@ -804,7 +816,6 @@ void MGARDAccuracy2DSmallSel(const std::string tolerance) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRMGARD2DSmallSel_" + tolerance + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -823,6 +834,9 @@ void MGARDAccuracy2DSmallSel(const std::string tolerance) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRMGARD2DSmallSel_" + tolerance + "_MPI.bp"); +#else + const std::string fname("BPWRMGARD2DSmallSel_" + tolerance + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadPNG.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadPNG.cpp index 84924f9de6..9437764eb4 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadPNG.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadPNG.cpp @@ -26,7 +26,6 @@ void PNGAccuracy2D(const std::string compressionLevel) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRPNG2D_" + compressionLevel + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -59,6 +58,9 @@ void PNGAccuracy2D(const std::string compressionLevel) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRPNG2D_" + compressionLevel + "_MPI.bp"); +#else + const std::string fname("BPWRPNG2D_" + compressionLevel + ".bp"); #endif #if ADIOS2_USE_MPI @@ -275,7 +277,6 @@ void PNGAccuracy2DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRPNG2DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -295,6 +296,9 @@ void PNGAccuracy2DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRPNG2DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRPNG2DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadSZ.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadSZ.cpp index 3f95fa0d22..dc1045ca02 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadSZ.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadSZ.cpp @@ -19,7 +19,6 @@ void SZAccuracy1D(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ1D_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -38,6 +37,9 @@ void SZAccuracy1D(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ1D_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ1D_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -151,7 +153,6 @@ void SZAccuracy2D(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ2D_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -171,6 +172,9 @@ void SZAccuracy2D(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ2D_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ2D_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -284,7 +288,6 @@ void SZAccuracy3D(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ3D_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -305,6 +308,9 @@ void SZAccuracy3D(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ3D_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ3D_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -420,7 +426,6 @@ void SZAccuracy1DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ1DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -439,6 +444,9 @@ void SZAccuracy1DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ1DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ1DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -552,7 +560,6 @@ void SZAccuracy2DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ2DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -572,6 +579,9 @@ void SZAccuracy2DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ2DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ2DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -689,7 +699,6 @@ void SZAccuracy3DSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ3DSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -710,6 +719,9 @@ void SZAccuracy3DSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ3DSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ3DSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI @@ -829,7 +841,6 @@ void SZAccuracy2DSmallSel(const std::string accuracy) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRSZ2DSmallSel_" + accuracy + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -848,6 +859,9 @@ void SZAccuracy2DSmallSel(const std::string accuracy) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRSZ2DSmallSel_" + accuracy + "_MPI.bp"); +#else + const std::string fname("BPWRSZ2DSmallSel_" + accuracy + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadSzComplex.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadSzComplex.cpp index b0c526b379..b46c33d612 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadSzComplex.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadSzComplex.cpp @@ -131,6 +131,7 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, const size_ size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); #if ADIOS2_USE_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + fileName = "TestBPWriteReadSzComplex_MPI"; #else adios2::ADIOS adios; #endif diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadZfp.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadZfp.cpp index 12e2208306..c1c4acb6d4 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadZfp.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadZfp.cpp @@ -20,7 +20,6 @@ void ZFPRate1D(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP1D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -39,6 +38,9 @@ void ZFPRate1D(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP1D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP1D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -151,7 +153,6 @@ void ZFPRate2D(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP2D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -171,6 +172,9 @@ void ZFPRate2D(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP2D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP2D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -281,7 +285,6 @@ void ZFPRate3D(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP3D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -302,6 +305,9 @@ void ZFPRate3D(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP3D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP3D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -414,7 +420,6 @@ void ZFPRate1DSel(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP1DSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -433,6 +438,9 @@ void ZFPRate1DSel(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP1DSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP1DSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -540,7 +548,6 @@ void ZFPRate2DSel(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP2DSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -560,6 +567,9 @@ void ZFPRate2DSel(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP2DSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP2DSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -664,7 +674,6 @@ void ZFPRate3DSel(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP3DSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -685,6 +694,9 @@ void ZFPRate3DSel(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP3DSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP3DSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -790,7 +802,6 @@ void ZFPRate2DSmallSel(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP2DSmallSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -809,6 +820,9 @@ void ZFPRate2DSmallSel(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP2DSmallSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP2DSmallSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadZfpConfig.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadZfpConfig.cpp index 7379963ea6..76ea948c4e 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadZfpConfig.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadZfpConfig.cpp @@ -23,7 +23,6 @@ void ZfpRate1D(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig1D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -42,6 +41,9 @@ void ZfpRate1D(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig1D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig1D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -137,7 +139,6 @@ void ZfpRate2D(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig2D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -157,6 +158,9 @@ void ZfpRate2D(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig2D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig2D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -251,7 +255,6 @@ void ZfpRate3D(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig3D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -272,6 +275,9 @@ void ZfpRate3D(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig3D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig3D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -368,7 +374,6 @@ void ZfpRate1DSel(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig1DSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -387,6 +392,9 @@ void ZfpRate1DSel(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig1DSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig1DSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -482,7 +490,6 @@ void ZfpRate2DSel(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig2DSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -502,6 +509,9 @@ void ZfpRate2DSel(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig2DSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig2DSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -596,7 +606,6 @@ void ZfpRate3DSel(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig3DSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -617,6 +626,9 @@ void ZfpRate3DSel(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig3DSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig3DSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -713,7 +725,6 @@ void ZfpRate2DSmallSel(const std::string configFile) const auto begin = configFile.find("_rate") + 5; const auto end = configFile.find_last_of(".") - begin; const std::string rate = configFile.substr(begin, end); - const std::string fname("BPWriteReadZfpConfig2DSmallSel_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -732,6 +743,9 @@ void ZfpRate2DSmallSel(const std::string configFile) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWriteReadZfpConfig2DSmallSel_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWriteReadZfpConfig2DSmallSel_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadZfpCuda.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadZfpCuda.cpp index 299fa10f25..c0edb583b0 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadZfpCuda.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadZfpCuda.cpp @@ -22,7 +22,6 @@ void ZFPRateCUDA(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFP1D_" + rate + ".bp"); // Number of rows const size_t Nx = 100; @@ -34,6 +33,9 @@ void ZFPRateCUDA(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFP1D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFP1D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/bp/operations/TestBPWriteReadZfpRemoveOperations.cpp b/testing/adios2/engine/bp/operations/TestBPWriteReadZfpRemoveOperations.cpp index 7aaf7c5c8a..c02f03da21 100644 --- a/testing/adios2/engine/bp/operations/TestBPWriteReadZfpRemoveOperations.cpp +++ b/testing/adios2/engine/bp/operations/TestBPWriteReadZfpRemoveOperations.cpp @@ -23,7 +23,6 @@ void ZFPRate1D(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFPOdd1D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -42,6 +41,9 @@ void ZFPRate1D(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFPOdd1D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFPOdd1D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -169,7 +171,6 @@ void ZFPRate2D(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFPOdd2D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -189,6 +190,9 @@ void ZFPRate2D(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFPOdd2D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFPOdd2D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI @@ -318,7 +322,6 @@ void ZFPRate3D(const std::string rate) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("BPWRZFPOdd3D_" + rate + ".bp"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -339,6 +342,9 @@ void ZFPRate3D(const std::string rate) #if ADIOS2_USE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("BPWRZFPOdd3D_" + rate + "_MPI.bp"); +#else + const std::string fname("BPWRZFPOdd3D_" + rate + ".bp"); #endif #if ADIOS2_USE_MPI diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp index 57b30e32b8..604ca9604f 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp @@ -26,7 +26,6 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname("ADIOS2HDF5WriteReadAsStream1D8.h5"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -38,6 +37,9 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead1D8) #ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2HDF5WriteReadAsStream1D8_MPI.h5"); +#else + const std::string fname("ADIOS2HDF5WriteReadAsStream1D8.h5"); #endif // Write test data using HDF5 @@ -395,7 +397,6 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here - const std::string fname("ADIOS2HDF5WriteReadAsStream2D2x4Test.h5"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -410,6 +411,9 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D2x4) #ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2HDF5WriteReadAsStream2D2x4Test_MPI.h5"); +#else + const std::string fname("ADIOS2HDF5WriteReadAsStream2D2x4Test.h5"); #endif // Write test data using ADIOS2 @@ -634,7 +638,6 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D4x2) { // Each process would write a 4x2 array and all processes would // form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here - const std::string fname("ADIOS2HDF5WriteReadAsStream2D4x2Test.h5"); int mpiRank = 0, mpiSize = 1; // Number of rows @@ -648,6 +651,9 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D4x2) #ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fname("ADIOS2HDF5WriteReadAsStream2D4x2Test_MPI.h5"); +#else + const std::string fname("ADIOS2HDF5WriteReadAsStream2D4x2Test.h5"); #endif // Write test data using ADIOS2 @@ -874,9 +880,6 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D4x2) TEST_F(HDF5WriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) { - const std::string fnameFloat("HDF5ReaderWriterDefineVariable_float.h5"); - const std::string fname("HDF5ReaderWriterDefineVariable_all.h5"); - int mpiRank = 0, mpiSize = 1; // Number of rows const std::size_t Nx = 2; @@ -889,6 +892,11 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) #ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fnameFloat("HDF5ReaderWriterDefineVariable_float.h5"); + const std::string fname("HDF5ReaderWriterDefineVariable_all.h5"); +#else + const std::string fnameFloat("HDF5ReaderWriterDefineVariable_float.h5"); + const std::string fname("HDF5ReaderWriterDefineVariable_all.h5"); #endif // Write test data using ADIOS2 diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp index ac746724d4..a49f3352f8 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp @@ -25,9 +25,6 @@ class BPWriteReadAttributeTestADIOS2 : public ::testing::Test // ADIOS2 write, read for single value attributes TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadSingleTypes) { - const std::string fName = - "." + std::string(&adios2::PathSeparator, 1) + "ADIOS2BPWriteAttributeReadSingleTypes.h5"; - const std::string zero = std::to_string(0); const std::string s1_Single = std::string("s1_Single_") + zero; const std::string s1_Array = std::string("s1_Array_") + zero; @@ -50,8 +47,14 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadSingleTypes) // Write test data using BP #ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fName = "." + std::string(&adios2::PathSeparator, 1) + + "ADIOS2BPWriteAttributeReadSingleTypes_MPI.h5"; + #else adios2::ADIOS adios; + const std::string fName = + "." + std::string(&adios2::PathSeparator, 1) + "ADIOS2BPWriteAttributeReadSingleTypes.h5"; + #endif { adios2::IO io = adios.DeclareIO("TestIO"); @@ -185,13 +188,16 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadSingleTypes) // ADIOS2 write read for array attributes TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypes) { - const std::string fName = - "." + std::string(&adios2::PathSeparator, 1) + "ADIOS2BPWriteAttributeReadArrayTypes.h5"; #ifdef TEST_HDF5_MPI int mpiRank = 0, mpiSize = 1; MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fName = "." + std::string(&adios2::PathSeparator, 1) + + "ADIOS2BPWriteAttributeReadArrayTypes_MPI.h5"; +#else + const std::string fName = + "." + std::string(&adios2::PathSeparator, 1) + "ADIOS2BPWriteAttributeReadArrayTypes.h5"; #endif const std::string zero = std::to_string(0); @@ -361,9 +367,6 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypes) TEST_F(BPWriteReadAttributeTestADIOS2, BPWriteReadSingleTypesVar) { - const std::string fName = - "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadSingleTypesVar.h5"; - const std::string zero = std::to_string(0); const std::string s1_Single = std::string("s1_Single_") + zero; const std::string i8_Single = std::string("i8_Single_") + zero; @@ -387,8 +390,14 @@ TEST_F(BPWriteReadAttributeTestADIOS2, BPWriteReadSingleTypesVar) // Write test data using BP #ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fName = + "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadSingleTypesVar_MPI.h5"; + #else adios2::ADIOS adios; + const std::string fName = + "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadSingleTypesVar.h5"; + #endif { adios2::IO io = adios.DeclareIO("TestIO"); @@ -511,13 +520,15 @@ TEST_F(BPWriteReadAttributeTestADIOS2, BPWriteReadSingleTypesVar) // ADIOS2 write read for array attributes TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypesVar) { - const std::string fName = - "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar.h5"; - #ifdef TEST_HDF5_MPI int mpiRank = 0, mpiSize = 1; MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + const std::string fName = + "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar_MPI.h5"; +#else + const std::string fName = + "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar.h5"; #endif const std::string zero = std::to_string(0); diff --git a/testing/adios2/engine/staging-common/TestCommonReadF.F90 b/testing/adios2/engine/staging-common/TestCommonReadF.F90 index 2e30795a44..7aeeaad16e 100644 --- a/testing/adios2/engine/staging-common/TestCommonReadF.F90 +++ b/testing/adios2/engine/staging-common/TestCommonReadF.F90 @@ -113,91 +113,223 @@ program TestSstRead call adios2_inquire_variable(variables(1), ioRead, "i8", ierr) - if (variables(1)%name /= 'i8') stop 'i8 not recognized' - if (variables(1)%type /= adios2_type_integer1) stop 'i8 type not recognized' + if (variables(1)%name /= 'i8') then + write(*,*) 'i8 not recognized' + stop 1 + end if + if (variables(1)%type /= adios2_type_integer1) then + write(*,*) 'i8 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(1), ierr) - if (ndims /= 1) stop 'i8 ndims is not 1' - if (modulo(shape_in(1), int(nx, 8)) /= 0) stop 'i8 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'i8 ndims is not 1' + stop 1 + end if + if (modulo(shape_in(1), int(nx, 8)) /= 0) then + write(*,*) 'i8 shape_in read failed' + stop 1 + end if writerSize = INT(shape_in(1)) / nx deallocate(shape_in) call adios2_inquire_variable(variables(2), ioRead, "i16", ierr) - if (variables(2)%name /= 'i16') stop 'i16 not recognized' - if (variables(2)%type /= adios2_type_integer2) stop 'i16 type not recognized' + if (variables(2)%name /= 'i16') then + write(*,*) 'i16 not recognized' + stop 1 + end if + if (variables(2)%type /= adios2_type_integer2) then + write(*,*) 'i16 type not recognized' + stop 1 + end if call adios2_variable_shape( shape_in, ndims, variables(2), ierr) - if (ndims /= 1) stop 'i16 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'i16 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'i16 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'i16 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(3), ioRead, "i32", ierr) - if (variables(3)%name /= 'i32') stop 'i32 not recognized' - if (variables(3)%type /= adios2_type_integer4) stop 'i32 type not recognized' + if (variables(3)%name /= 'i32') then + write(*,*) 'i32 not recognized' + stop 1 + end if + if (variables(3)%type /= adios2_type_integer4) then + write(*,*) 'i32 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(3), ierr) - if (ndims /= 1) stop 'i32 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'i32 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'i32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'i32 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(4), ioRead, "i64", ierr) - if (variables(4)%name /= 'i64') stop 'i64 not recognized' - if (variables(4)%type /= adios2_type_integer8) stop 'i64 type not recognized' + if (variables(4)%name /= 'i64') then + write(*,*) 'i64 not recognized' + stop 1 + end if + if (variables(4)%type /= adios2_type_integer8) then + write(*,*) 'i64 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(4), ierr) - if (ndims /= 1) stop 'i64 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'i64 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'i64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'i64 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(5), ioRead, "r32", ierr) - if (variables(5)%name /= 'r32') stop 'r32 not recognized' - if (variables(5)%type /= adios2_type_real) stop 'r32 type not recognized' + if (variables(5)%name /= 'r32') then + write(*,*) 'r32 not recognized' + stop 1 + end if + if (variables(5)%type /= adios2_type_real) then + write(*,*) 'r32 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(5), ierr) - if (ndims /= 1) stop 'r32 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'r32 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'r32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'r32 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(6), ioRead, "r64", ierr) - if (variables(6)%name /= 'r64') stop 'r64 not recognized' - if (variables(6)%type /= adios2_type_dp) stop 'r64 type not recognized' + if (variables(6)%name /= 'r64') then + write(*,*) 'r64 not recognized' + stop 1 + end if + if (variables(6)%type /= adios2_type_dp) then + write(*,*) 'r64 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(6), ierr) - if (ndims /= 1) stop 'r64 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'r64 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'r64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'r64 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(7), ioRead, "r64_2d", ierr) - if (variables(7)%name /= 'r64_2d') stop 'r64_2d not recognized' - if (variables(7)%type /= adios2_type_dp) stop 'r64_2d type not recognized' + if (variables(7)%name /= 'r64_2d') then + write(*,*) 'r64_2d not recognized' + stop 1 + end if + if (variables(7)%type /= adios2_type_dp) then + write(*,*) 'r64_2d type not recognized' + stop 1 + end if call adios2_variable_shape( shape_in, ndims, variables(7), ierr) - if (ndims /= 2) stop 'r64_2d ndims is not 2' - if (shape_in(1) /= 2) stop 'r64_2d shape_in(1) read failed' - if (shape_in(2) /= nx*writerSize) stop 'r64_2d shape_in(2) read failed' + if (ndims /= 2) then + write(*,*) 'r64_2d ndims is not 2' + stop 1 + end if + if (shape_in(1) /= 2) then + write(*,*) 'r64_2d shape_in(1) read failed' + stop 1 + end if + if (shape_in(2) /= nx*writerSize) then + write(*,*) 'r64_2d shape_in(2) read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(8), ioRead, "r64_2d_rev", ierr) - if (variables(8)%name /= 'r64_2d_rev') stop 'r64_2d_rev not recognized' - if (variables(8)%type /= adios2_type_dp) stop 'r64_2d_rev type not recognized' + if (variables(8)%name /= 'r64_2d_rev') then + write(*,*) 'r64_2d_rev not recognized' + stop 1 + end if + if (variables(8)%type /= adios2_type_dp) then + write(*,*) 'r64_2d_rev type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(8), ierr) - if (ndims /= 2) stop 'r64_2d_rev ndims is not 2' - if (shape_in(1) /= nx*writerSize) stop 'r64_2d_rev shape_in(2) read failed' - if (shape_in(2) /= 2) stop 'r64_2d_rev shape_in(1) read failed' + if (ndims /= 2) then + write(*,*) 'r64_2d_rev ndims is not 2' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'r64_2d_rev shape_in(2) read failed' + stop 1 + end if + if (shape_in(2) /= 2) then + write(*,*) 'r64_2d_rev shape_in(1) read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(10), ioRead, "c32", ierr) - if (variables(10)%name /= 'c32') stop 'c32 not recognized' - if (variables(10)%type /= adios2_type_complex) stop 'c32 type not recognized' + if (variables(10)%name /= 'c32') then + write(*,*) 'c32 not recognized' + stop 1 + end if + if (variables(10)%type /= adios2_type_complex) then + write(*,*) 'c32 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(10), ierr) - if (ndims /= 1) stop 'c32 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'c32 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'c32 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'c32 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(11), ioRead, "c64", ierr) - if (variables(11)%name /= 'c64') stop 'c64 not recognized' - if (variables(11)%type /= adios2_type_complex_dp) stop 'c64 type not recognized' + if (variables(11)%name /= 'c64') then + write(*,*) 'c64 not recognized' + stop 1 + end if + if (variables(11)%type /= adios2_type_complex_dp) then + write(*,*) 'c64 type not recognized' + stop 1 + end if call adios2_variable_shape(shape_in, ndims, variables(11), ierr) - if (ndims /= 1) stop 'c64 ndims is not 1' - if (shape_in(1) /= nx*writerSize) stop 'c64 shape_in read failed' + if (ndims /= 1) then + write(*,*) 'c64 ndims is not 1' + stop 1 + end if + if (shape_in(1) /= nx*writerSize) then + write(*,*) 'c64 shape_in read failed' + stop 1 + end if deallocate(shape_in) call adios2_inquire_variable(variables(12), ioRead, "scalar_r64", ierr) - if (variables(12)%name /= 'scalar_r64') stop 'scalar_r64 not recognized' - if (variables(12)%type /= adios2_type_dp) stop 'scalar_r64 type not recognized' + if (variables(12)%name /= 'scalar_r64') then + write(*,*) 'scalar_r64 not recognized' + stop 1 + end if + if (variables(12)%type /= adios2_type_dp) then + write(*,*) 'scalar_r64 type not recognized' + stop 1 + end if myStart = (writerSize * Nx / isize) * irank myLength = ((writerSize * Nx + isize - 1) / isize) @@ -274,7 +406,10 @@ program TestSstRead ! Deallocates adios and calls its destructor call adios2_finalize(adios, ierr) - if( adios%valid .eqv. .true. ) stop 'Invalid adios2_finalize' + if( adios%valid .eqv. .true. ) then + write(*,*) 'Invalid adios2_finalize' + stop 1 + end if #if ADIOS2_USE_MPI diff --git a/testing/adios2/hierarchy/TestBPHierarchicalReading.cpp b/testing/adios2/hierarchy/TestBPHierarchicalReading.cpp index c4039dbe19..1d39c84c39 100644 --- a/testing/adios2/hierarchy/TestBPHierarchicalReading.cpp +++ b/testing/adios2/hierarchy/TestBPHierarchicalReading.cpp @@ -23,17 +23,19 @@ class ADIOSHierarchicalReadVariableTest : public ::testing::Test TEST_F(ADIOSHierarchicalReadVariableTest, Read) { - std::string filename = "ADIOSHierarchicalReadVariable." + engineName + ".bp"; - // Number of steps const std::size_t NSteps = 2; long unsigned int rank, size; #if ADIOS2_USE_MPI + std::string filename = "ADIOSHierarchicalReadVariable." + engineName + "_MPI.bp"; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); #else + std::string filename = "ADIOSHierarchicalReadVariable." + engineName + ".bp"; + rank = 0; size = 1; #endif diff --git a/testing/adios2/performance/manyvars/TestManyVars.cpp b/testing/adios2/performance/manyvars/TestManyVars.cpp index f17cedd5ec..923b6df054 100644 --- a/testing/adios2/performance/manyvars/TestManyVars.cpp +++ b/testing/adios2/performance/manyvars/TestManyVars.cpp @@ -235,8 +235,13 @@ class TestManyVars : public ::testing::TestWithParam NBLOCKS = p.nblocks; NSTEPS = p.nsteps; REDEFINE = redefineVars; +#if ADIOS2_USE_MPI + snprintf(FILENAME, sizeof(FILENAME), "manyVars.%zu_%zu_%zu%s_MPI.bp", NVARS, NBLOCKS, + NSTEPS, REDEFINE ? "_redefine" : ""); +#else snprintf(FILENAME, sizeof(FILENAME), "manyVars.%zu_%zu_%zu%s.bp", NVARS, NBLOCKS, NSTEPS, REDEFINE ? "_redefine" : ""); +#endif alloc_vars(); #if ADIOS2_USE_MPI diff --git a/testing/adios2/performance/query/TestBPQuery.cpp b/testing/adios2/performance/query/TestBPQuery.cpp index 6e0e918a10..7ded0040ec 100644 --- a/testing/adios2/performance/query/TestBPQuery.cpp +++ b/testing/adios2/performance/query/TestBPQuery.cpp @@ -81,7 +81,11 @@ class BPQueryTest : public ::testing::Test void BPQueryTest::QueryIntVar(const std::string &fname, adios2::ADIOS &adios, const std::string &engineName) { +#if ADIOS2_USE_MPI + std::string ioName = "IOQueryTestInt_MPI" + engineName; +#else std::string ioName = "IOQueryTestInt" + engineName; +#endif adios2::IO io = adios.DeclareIO(ioName.c_str()); if (!engineName.empty()) @@ -235,12 +239,13 @@ TEST_F(BPQueryTest, BP5) std::string engineName = "BP5"; // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname(engineName + "Query1D.bp"); #if ADIOS2_USE_MPI adios2::ADIOS adios(MPI_COMM_WORLD); + const std::string fname(engineName + "Query1D_MPI.bp"); #else adios2::ADIOS adios; + const std::string fname(engineName + "Query1D.bp"); #endif WriteFile(fname, adios, engineName); diff --git a/testing/h5vol/TestH5VolWriteReadBPFile.cpp b/testing/h5vol/TestH5VolWriteReadBPFile.cpp index 5fdd23b679..ddc202f3f5 100644 --- a/testing/h5vol/TestH5VolWriteReadBPFile.cpp +++ b/testing/h5vol/TestH5VolWriteReadBPFile.cpp @@ -462,8 +462,12 @@ TEST_F(H5VolWriteReadTest, H5VolWriteHDF5Read1D8) { // Each process would write a 1x8 array and all processes would // form a mpiSize * Nx 1D array - const std::string fname = "H5VolTest1D8.bp"; +#ifdef TEST_HDF5_MPI + const std::string fname = "H5VolTest1D8_MPI.bp"; +#else + const std::string fname = "H5VolTest1D8.bp"; +#endif int mpiRank = 0, mpiSize = 1; // Number of rows const std::size_t Nx = 8; @@ -649,8 +653,11 @@ TEST_F(H5VolWriteReadTest, H5VolWriteHDF5Read2D2x4) { // Each process would write a 2x4 array and all processes would // form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here +#ifdef TEST_HDF5_MPI + std::string fname = "H5VolTest2D2x4_MPI.bp"; +#else std::string fname = "H5VolTest2D2x4.bp"; - +#endif int mpiRank = 0, mpiSize = 1; // Number of rows const std::size_t Nx = 4; diff --git a/testing/utils/cwriter/TestUtilsCWriter.c b/testing/utils/cwriter/TestUtilsCWriter.c index 04db7d8d6e..ed5acc3ac7 100644 --- a/testing/utils/cwriter/TestUtilsCWriter.c +++ b/testing/utils/cwriter/TestUtilsCWriter.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) char engineName[32] = "BPFile"; if (argc > 1) { - strncpy(engineName, argv[1], sizeof(engineName)); + strncpy(engineName, argv[1], sizeof(engineName) - 1); } // IO diff --git a/thirdparty/EVPath/EVPath/CMakeLists.txt b/thirdparty/EVPath/EVPath/CMakeLists.txt index 132c650619..384160c512 100644 --- a/thirdparty/EVPath/EVPath/CMakeLists.txt +++ b/thirdparty/EVPath/EVPath/CMakeLists.txt @@ -376,7 +376,7 @@ if (MSVC) set(EVPATH_USE_ZPL_ENET FALSE) endif() if(NOT (DEFINED EVPATH_USE_ZPL_ENET)) - option(EVPATH_USE_ZPL_ENET "Build the enet transport" "OFF") + option(EVPATH_USE_ZPL_ENET "Build the zplenet transport" "OFF") endif() if(EVPATH_USE_ZPL_ENET) set(RUN_ZPL_ENET_TESTS TRUE) @@ -447,7 +447,7 @@ else() option(EVPATH_USE_LIBFABRIC "Build the libfabric transport" ${LIBFABRIC_FOUND}) endif() -if(LIBFABRIC_FOUND) +if(LIBFABRIC_FOUND AND NOT EVPATH_NO_RDMA) if(EVPATH_TRANSPORT_MODULES) add_library(cmfabric MODULE cmfabric.c ip_config.c) set_target_properties(cmfabric PROPERTIES @@ -485,7 +485,7 @@ else() option(EVPATH_USE_IBVERBS "Build the libfabric transport" ${IBVERBS_FOUND}) endif() set(HAVE_IBVERBS ${IBVERBS_FOUND}) -if(IBVERBS_FOUND) +if(IBVERBS_FOUND AND NOT EVPATH_NO_RDMA) if(BUILD_TESTING) if(NOT CMAKE_CROSSCOMPILING) message(STATUS "Check MEMLOCK rlimit for IB tests") @@ -548,7 +548,7 @@ if(IBVERBS_FOUND) find_package(NNTI) option(EVPATH_USE_NNTI "Build the nnti transport" ${NNTI_FOUND}) endif() - if(NNTI_FOUND) + if(NNTI_FOUND AND NOT EVPATH_NO_RDMA) if(CercsArch STREQUAL "ppc64") set(RUN_NNTI_TESTS FALSE) endif() @@ -571,7 +571,7 @@ if(IBVERBS_FOUND) endif() endif() else() - set(EVPATH_USE_NNTI FALSE "Build the nnti transport" FORCE) + set(EVPATH_USE_NNTI FALSE CACHE INTERNAL "Build the nnti transport" FORCE) endif() # Install extra find module dependencies diff --git a/thirdparty/EVPath/EVPath/cmib.c b/thirdparty/EVPath/EVPath/cmib.c index 6cfd7c828f..1a956cedb1 100644 --- a/thirdparty/EVPath/EVPath/cmib.c +++ b/thirdparty/EVPath/EVPath/cmib.c @@ -369,9 +369,7 @@ static inline uint16_t get_local_lid(struct ibv_context *context, int port) } static int -check_host(hostname, sin_addr) - char *hostname; -void *sin_addr; +check_host(char *hostname,void *sin_addr) { struct hostent *host_addr; host_addr = gethostbyname(hostname); @@ -393,8 +391,7 @@ void *sin_addr; } static ib_conn_data_ptr -create_ib_conn_data(svc) - CMtrans_services svc; +create_ib_conn_data(CMtrans_services svc) { ib_conn_data_ptr ib_conn_data = svc->malloc_func(sizeof(struct ib_connection_data)); memset(ib_conn_data, 0, sizeof(struct ib_connection_data)); @@ -946,9 +943,7 @@ CMIB_data_available(transport_entry trans, CMConnection conn) * Accept socket connection */ static void -ib_accept_conn(void_trans, void_conn_sock) - void *void_trans; -void *void_conn_sock; +ib_accept_conn(void *void_trans, void *void_conn_sock) { transport_entry trans = (transport_entry) void_trans; int conn_sock = (int) (long) void_conn_sock; @@ -1106,9 +1101,7 @@ void *void_conn_sock; } extern void -libcmib_LTX_shutdown_conn(svc, scd) - CMtrans_services svc; -ib_conn_data_ptr scd; +libcmib_LTX_shutdown_conn(CMtrans_services svc, ib_conn_data_ptr scd) { svc->trace_out(scd->sd->cm, "CMIB shutdown_conn, removing select %d\n", scd->fd); @@ -1141,14 +1134,7 @@ is_private_10(int IP) } static int -initiate_conn(cm, svc, trans, attrs, ib_conn_data, conn_attr_list, no_more_redirect) - CManager cm; -CMtrans_services svc; -transport_entry trans; -attr_list attrs; -ib_conn_data_ptr ib_conn_data; -attr_list conn_attr_list; -int no_more_redirect; +initiate_conn(CManager cm, CMtrans_services svc, transport_entry trans, attr_list attrs, ib_conn_data_ptr ib_conn_data, attr_list conn_attr_list, int no_more_redirect) { int sock; @@ -1413,11 +1399,7 @@ int no_more_redirect; * (name_str stores the machine name). */ extern CMConnection -libcmib_LTX_initiate_conn(cm, svc, trans, attrs) - CManager cm; -CMtrans_services svc; -transport_entry trans; -attr_list attrs; +libcmib_LTX_initiate_conn(CManager cm, CMtrans_services svc, transport_entry trans, attr_list attrs) { ib_conn_data_ptr ib_conn_data = create_ib_conn_data(svc); attr_list conn_attr_list = create_attr_list(); @@ -1447,11 +1429,7 @@ attr_list attrs; * same as ours and if the IP_PORT matches the one we are listening on. */ extern int -libcmib_LTX_self_check(cm, svc, trans, attrs) - CManager cm; -CMtrans_services svc; -transport_entry trans; -attr_list attrs; +libcmib_LTX_self_check(CManager cm, CMtrans_services svc, transport_entry trans, attr_list attrs) { ib_client_data_ptr sd = trans->trans_data; @@ -1499,12 +1477,9 @@ attr_list attrs; } extern int -libcmib_LTX_connection_eq(cm, svc, trans, attrs, scd) - CManager cm; -CMtrans_services svc; -transport_entry trans; -attr_list attrs; -ib_conn_data_ptr scd; +libcmib_LTX_connection_eq(CManager cm, CMtrans_services svc, + transport_entry trans, attr_list attrs, + ib_conn_data_ptr scd) { int int_port_num; @@ -1548,11 +1523,8 @@ ib_conn_data_ptr scd; * Create an IP socket for connection from other CMs */ extern attr_list -libcmib_LTX_non_blocking_listen(cm, svc, trans, listen_info) - CManager cm; -CMtrans_services svc; -transport_entry trans; -attr_list listen_info; +libcmib_LTX_non_blocking_listen(CManager cm, CMtrans_services svc, + transport_entry trans, attr_list listen_info) { ib_client_data_ptr sd = trans->trans_data; unsigned int length; @@ -1714,11 +1686,8 @@ struct iovec { #endif extern void -libcmib_LTX_set_write_notify(trans, svc, scd, enable) - transport_entry trans; -CMtrans_services svc; -ib_conn_data_ptr scd; -int enable; +libcmib_LTX_set_write_notify(transport_entry trans, CMtrans_services svc, + ib_conn_data_ptr scd, int enable) { if (enable != 0) { svc->fd_write_select(trans->cm, scd->fd, (select_list_func) trans->write_possible, @@ -1910,12 +1879,8 @@ libcmib_LTX_writev_complete_notify_func(CMtrans_services svc, } extern int -libcmib_LTX_writev_func(svc, scd, iovs, iovcnt, attrs) -CMtrans_services svc; -ib_conn_data_ptr scd; -void *iovs; -int iovcnt; -attr_list attrs; +libcmib_LTX_writev_func(CMtrans_services svc, ib_conn_data_ptr scd, + void *iovs, int iovcnt, attr_list attrs) { return libcmib_LTX_writev_complete_notify_func(svc, scd, iovs, iovcnt, attrs, NULL, NULL); @@ -1934,9 +1899,7 @@ free_ib_data(CManager cm, void *sdv) } extern void * -libcmib_LTX_initialize(cm, svc) - CManager cm; -CMtrans_services svc; +libcmib_LTX_initialize(CManager cm, CMtrans_services svc) { static int atom_init = 0; diff --git a/thirdparty/EVPath/EVPath/mtests/cmping.c b/thirdparty/EVPath/EVPath/mtests/cmping.c index 067eb11f76..59a0783054 100644 --- a/thirdparty/EVPath/EVPath/mtests/cmping.c +++ b/thirdparty/EVPath/EVPath/mtests/cmping.c @@ -18,6 +18,7 @@ #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0,0,(DWORD)x),y) #else +#include #include #include #endif diff --git a/thirdparty/EVPath/EVPath/mtests/cmtest.c b/thirdparty/EVPath/EVPath/mtests/cmtest.c index 0396443fee..3b2ef85810 100644 --- a/thirdparty/EVPath/EVPath/mtests/cmtest.c +++ b/thirdparty/EVPath/EVPath/mtests/cmtest.c @@ -18,6 +18,7 @@ #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0, 0, (DWORD)x),y) #else +#include #include #include #endif diff --git a/thirdparty/EVPath/EVPath/rtests/evtest.c b/thirdparty/EVPath/EVPath/rtests/evtest.c index cf1a2ac732..615fc7f903 100644 --- a/thirdparty/EVPath/EVPath/rtests/evtest.c +++ b/thirdparty/EVPath/EVPath/rtests/evtest.c @@ -20,6 +20,7 @@ #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0,0,(DWORD)x),y) #else +#include #include #include #endif diff --git a/thirdparty/EVPath/EVPath/rtests/extract_test.c b/thirdparty/EVPath/EVPath/rtests/extract_test.c index ed2677329b..47fe155248 100644 --- a/thirdparty/EVPath/EVPath/rtests/extract_test.c +++ b/thirdparty/EVPath/EVPath/rtests/extract_test.c @@ -19,6 +19,7 @@ #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0, 0, (DWORD)x),y) #else +#include #include #include #endif diff --git a/thirdparty/EVPath/EVPath/rtests/remote_terminal_test.c b/thirdparty/EVPath/EVPath/rtests/remote_terminal_test.c index 999bb626b4..8896145d1c 100644 --- a/thirdparty/EVPath/EVPath/rtests/remote_terminal_test.c +++ b/thirdparty/EVPath/EVPath/rtests/remote_terminal_test.c @@ -19,6 +19,7 @@ #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0,0,(DWORD)x),y) #else +#include #include #include #endif diff --git a/thirdparty/EVPath/EVPath/tests/evtest.c b/thirdparty/EVPath/EVPath/tests/evtest.c index b13102dbf8..59481adf78 100644 --- a/thirdparty/EVPath/EVPath/tests/evtest.c +++ b/thirdparty/EVPath/EVPath/tests/evtest.c @@ -18,6 +18,7 @@ #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0,0,(DWORD)x),y) #else +#include #include #include #endif diff --git a/thirdparty/dill/dill/.clang-format b/thirdparty/dill/dill/.clang-format new file mode 100644 index 0000000000..ebaa492bc6 --- /dev/null +++ b/thirdparty/dill/dill/.clang-format @@ -0,0 +1,18 @@ +Language: Cpp +BasedOnStyle: Chromium +BreakBeforeBraces: Custom +IndentWidth: 4 +ContinuationIndentWidth: 4 +AccessModifierOffset: -4 +Standard: Cpp11 +ColumnLimit: 80 +AllowAllParametersOfDeclarationOnNextLine: false +AlwaysBreakAfterReturnType: All +AlignEscapedNewlines: Right +AlignAfterOpenBracket: Align +SortUsingDeclarations: false +IndentCaseLabels: false +BraceWrapping: + AfterFunction: true + SplitEmptyFunction: true + SplitEmptyRecord: true diff --git a/thirdparty/dill/dill/CMakeLists.txt b/thirdparty/dill/dill/CMakeLists.txt index 0ac720b7fd..03202c9c1f 100644 --- a/thirdparty/dill/dill/CMakeLists.txt +++ b/thirdparty/dill/dill/CMakeLists.txt @@ -102,7 +102,7 @@ check_type_size("void*" CMAKE_SIZEOF_VOID_P) check_type_size("long" SIZEOF_LONG) set(NATIVE_CG TRUE) unset(NATIVE_ARCH) -if(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86|x86_64|AMD64") +if(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86|x86_64|AMD64|amd64") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(NATIVE_ARCH x86_64) set(HOST_X86_64 1) @@ -186,16 +186,21 @@ set(ARM_HARD_FLOAT ${HARDFP_AVAILABLE}) option(DILL_IGNORE_NATIVE "Build to do emulation, regardless of architecture" OFF) +option(DILL_NATIVE_ONLY "Build to native code only" ON) if(DILL_IGNORE_NATIVE) set(NATIVE_CG FALSE) set(NATIVE_ARCH UNSUPPORTED) endif() set(LIBFFI_INTERNAL OFF) -find_package(LibFFI) +if (DILL_NATIVE_ONLY) + set(LIBFFI_FOUND FALSE) +else() + find_package(LibFFI) +endif() if(LIBFFI_FOUND) message(STATUS "Enabling emulation") set(EMULATION_POSSIBLE TRUE) -elseif(DILL_IGNORE_NATIVE OR (NATIVE_ARCH STREQUAL "UNSUPPORTED")) +elseif((DILL_IGNORE_NATIVE OR (NATIVE_ARCH STREQUAL "UNSUPPORTED")) AND NOT DILL_NATIVE_ONLY) find_program (AUTOCONF autoconf) find_program (AUTOMAKE automake) if ((AUTOCONF STREQUAL "AUTOCONF-NOTFOUND") OR (AUTOMAKE STREQUAL "AUTOMAKE-NOTFOUND")) @@ -339,7 +344,6 @@ check_include_files(memory.h HAVE_MEMORY_H) check_include_files(sys/mman.h HAVE_SYS_MMAN_H) include(CheckSymbolExists) check_symbol_exists(__clear_cache "" CLEAR_CACHE_DEFINED) -message(STATUS "Clear cache defined is ${CLEAR_CACHE_DEFINED}") set(NO_DISASSEMBLER TRUE) if(DILL_ENABLE_DISASSEMBLY) @@ -531,8 +535,10 @@ if(NOT DILL_QUIET) message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" ) message(STATUS "DILL_ENABLE_DISASSEMBLY = ${DILL_ENABLE_DISASSEMBLY}" ) message(STATUS "DILL_MULTI_TARGET = ${DILL_MULTI_TARGET}" ) - message(STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" ) + message(STATUS "DILL_IGNORE_NATIVE = ${DILL_IGNORE_NATIVE}" ) + message(STATUS "DILL_NATIVE_ONLY = ${DILL_NATIVE_ONLY}" ) message(STATUS "BUILD_TESTING = ${BUILD_TESTING}" ) + message(STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" ) message(STATUS "Change a value with: cmake -D=" ) message(STATUS "-----------------------------------------------------------------------------") endif() diff --git a/thirdparty/ffs/ffs/CMakeLists.txt b/thirdparty/ffs/ffs/CMakeLists.txt index c9f516988d..3cd2733e9d 100644 --- a/thirdparty/ffs/ffs/CMakeLists.txt +++ b/thirdparty/ffs/ffs/CMakeLists.txt @@ -258,6 +258,7 @@ endif() CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H) CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H) CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H) +CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H) CHECK_INCLUDE_FILE(sockLib.h HAVE_SOCKLIB_H) CHECK_INCLUDE_FILE(stdarg.h STDC_HEADERS) CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) diff --git a/thirdparty/ffs/ffs/cmake/BisonFlexSub.cmake b/thirdparty/ffs/ffs/cmake/BisonFlexSub.cmake index 40e2e275f5..dedcd711c6 100644 --- a/thirdparty/ffs/ffs/cmake/BisonFlexSub.cmake +++ b/thirdparty/ffs/ffs/cmake/BisonFlexSub.cmake @@ -1,7 +1,8 @@ FUNCTION (SETUP_BISON_FLEX_SUB) IF ((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") OR - (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")) + (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR + (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")) set (BISON_FLEX_PRECOMPILE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cod/pregen_source/Linux") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set (BISON_FLEX_PRECOMPILE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cod/pregen_source/Windows") diff --git a/thirdparty/ffs/ffs/ffs/tests/context_test.c b/thirdparty/ffs/ffs/ffs/tests/context_test.c index 19af8d4442..fe178133c3 100755 --- a/thirdparty/ffs/ffs/ffs/tests/context_test.c +++ b/thirdparty/ffs/ffs/ffs/tests/context_test.c @@ -4,6 +4,9 @@ #ifdef STDC_HEADERS #include #endif +#ifdef HAVE_NETINET_IN_H +#include +#endif #include #ifdef HAVE_UNISTD_H #include