Unverified Commit 053a094e authored by Eisenhauer, Greg's avatar Eisenhauer, Greg Committed by GitHub
Browse files

Merge pull request #955 from eisenhauer/NewFFSUpstream

New ffs upstream
parents 599d95be 14272617
Loading
Loading
Loading
Loading
+31 −28
Original line number Diff line number Diff line
@@ -382,6 +382,8 @@ extern void FFSFreeMarshalData(SstStream Stream)
    {
        /* reader side */
        struct FFSReaderMarshalBase *Info = Stream->ReaderMarshalData;
        if (Info)
        {
            for (int i = 0; i < Stream->WriterCohortSize; i++)
            {
                if (Info->WriterInfo[i].RawBuffer)
@@ -414,6 +416,7 @@ extern void FFSFreeMarshalData(SstStream Stream)
            Stream->ReaderMarshalData = NULL;
        }
    }
}

#if !defined(ADIOS2_HAVE_ZFP)
#define ZFPcompressionPossible(Type, DimCount) 0
+114 −147
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.0)

project(FFS)
set(FFS_VERSION_MAJOR 1)
set(FFS_VERSION_MINOR 6)
set(FFS_VERSION_PATCH 0)
set(FFS_VERSION
  ${FFS_VERSION_MAJOR}.${FFS_VERSION_MINOR}.${FFS_VERSION_PATCH})
project(FFS VERSION 1.6.0)

# Some boilerplate to setup nice output directories
set(CMAKE_INSTALL_BINDIR bin CACHE STRING "Installation runtime subdirectory")
@@ -53,8 +48,7 @@ include(CMakeDependentOption)
get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
cmake_dependent_option(BUILD_SHARED_LIBS
  "Build shared libraries (so/dylib/dll)." ${SHARED_LIBS_SUPPORTED}
  "SHARED_LIBS_SUPPORTED" OFF
)
  "SHARED_LIBS_SUPPORTED" OFF)
mark_as_advanced(BUILD_SHARED_LIBS)

# Setup PIC defaults.  If explicitly specified somehow, then default
@@ -69,8 +63,7 @@ else()
endif()
cmake_dependent_option(FFS_ENABLE_PIC
  "Build with Position Independent Code" ${FFS_ENABLE_PIC_DEFAULT}
  "SHARED_LIBS_SUPPORTED" OFF
)
  "SHARED_LIBS_SUPPORTED" OFF)
mark_as_advanced(FFS_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ${FFS_ENABLE_PIC})
mark_as_advanced(CMAKE_POSITION_INDEPENDENT_CODE)
@@ -90,33 +83,10 @@ CHECK_TYPE_SIZE("long double" SIZEOF_LONG_DOUBLE)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)

if(BUILD_SHARED_LIBS)
  # use, i.e. don't skip the full RPATH for the build tree
  set(CMAKE_SKIP_BUILD_RPATH  FALSE)

  # when building, don't use the install RPATH already
  # (but later on when installing)
  set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 

  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

  # add the automatically determined parts of the RPATH
  # which point to directories outside the build tree to the install RPATH
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

  # the RPATH to be used when installing, but only if it's not a system directory
  list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
  if(isSystemDir STREQUAL "-1")
     set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  endif()

  set(CMAKE_MACOSX_RPATH 1)
endif()

if(NOT (DEFINED NO_SOCKETS))
  check_function_exists(socket SOCKETS_FOUND)
  if(NOT SOCKETS_FOUND)
	set (NO_SOCKETS true)
    set(NO_SOCKETS TRUE)
  endif()
endif()
if(NO_SOCKETS)
@@ -127,21 +97,25 @@ else ()
  set(FM_SOCKET_IO server_acts.c unix_io.c)
endif()

set (FM_SRC_LIST fm_formats.c fm_dump.c lookup3.c string_conversion.c fm_get.c xml.c ${FM_SOCKET_IO})
FOREACH (FM_SRC ${FM_SRC_LIST})
    LIST (APPEND FM_MASTER_SRC_LIST fm/${FM_SRC})
ENDFOREACH()
set(FM_SRC_LIST
   fm_formats.c fm_dump.c lookup3.c string_conversion.c fm_get.c xml.c
   ${FM_SOCKET_IO})
foreach(FM_SRC ${FM_SRC_LIST})
  list(APPEND FM_MASTER_SRC_LIST fm/${FM_SRC})
endforeach()

set(COD_SRC_LIST cg.c standard.c)
FOREACH (COD_SRC ${COD_SRC_LIST})
    LIST (APPEND COD_MASTER_SRC_LIST cod/${COD_SRC})
ENDFOREACH()
foreach(COD_SRC ${COD_SRC_LIST})
  list(APPEND COD_MASTER_SRC_LIST cod/${COD_SRC})
endforeach()

set (FFS_SRC_LIST ffs.c ffs_formats.c ffs_conv.c ffs_gen.c ffs_file.c unix_io.c evol.c ffs_marshal.c )
FOREACH (FFS_SRC ${FFS_SRC_LIST})
    LIST (APPEND FFS_MASTER_SRC_LIST ffs/${FFS_SRC})
ENDFOREACH()
LIST(APPEND FFS_MASTER_SRC_LIST version.c)
set(FFS_SRC_LIST
  ffs.c ffs_formats.c ffs_conv.c ffs_gen.c ffs_file.c unix_io.c evol.c
  ffs_marshal.c)
foreach(FFS_SRC ${FFS_SRC_LIST})
  list(APPEND FFS_MASTER_SRC_LIST ffs/${FFS_SRC})
endforeach()
list(APPEND FFS_MASTER_SRC_LIST version.c)

find_package(BISON)
find_package(FLEX)
@@ -150,36 +124,36 @@ if (NOT BISON_FOUND OR NOT FLEX_FOUND)
  include(BisonFlexSub)
  SETUP_BISON_FLEX_SUB()
else()
   BISON_TARGET(CODParser cod/cod.y ${CMAKE_CURRENT_BINARY_DIR}/cod.tab.c COMPILE_FLAGS -d)
  BISON_TARGET(CODParser
    cod/cod.y
    ${CMAKE_CURRENT_BINARY_DIR}/cod.tab.c
    COMPILE_FLAGS -d)
    set(HAVE_COD_PARSER_H)
   FLEX_TARGET(CODScanner cod/cod.l  ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c)
  FLEX_TARGET(CODScanner
    cod/cod.l
    ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c)
  ADD_FLEX_BISON_DEPENDENCY(CODScanner CODParser)
endif()
add_custom_command(
  OUTPUT "cod_node.c" "structs.h"
  COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/cod/struct.pl ${CMAKE_CURRENT_SOURCE_DIR}/cod/cod.structs
  DEPENDS lex.yy.c ${CMAKE_CURRENT_SOURCE_DIR}/cod/cod.structs ${CMAKE_CURRENT_SOURCE_DIR}/cod/struct.pl
)
  COMMAND
    perl
      ${CMAKE_CURRENT_SOURCE_DIR}/cod/struct.pl
      ${CMAKE_CURRENT_SOURCE_DIR}/cod/cod.structs
  DEPENDS
    lex.yy.c
    ${CMAKE_CURRENT_SOURCE_DIR}/cod/cod.structs
    ${CMAKE_CURRENT_SOURCE_DIR}/cod/struct.pl)

add_custom_target(
  docs ALL
  DEPENDS "cod_node.c"
)
add_custom_target(docs ALL DEPENDS "cod_node.c")

add_custom_target(generated
  DEPENDS cod_node.c ${BISON_CODParser_OUTPUT_SOURCE}
)
add_custom_target(generated DEPENDS cod_node.c ${BISON_CODParser_OUTPUT_SOURCE})

list(APPEND COD_MASTER_SRC_LIST
  ${BISON_CODParser_OUTPUT_SOURCE}
  ${CMAKE_CURRENT_BINARY_DIR}/cod_node.c
)
  ${CMAKE_CURRENT_BINARY_DIR}/cod_node.c)

set(FFS_MASTER_SRC_LIST
  ${FFS_MASTER_SRC_LIST}
  ${FM_MASTER_SRC_LIST}
  ${COD_MASTER_SRC_LIST}
)
list(APPEND FFS_MASTER_SRC_LIST ${FM_MASTER_SRC_LIST} ${COD_MASTER_SRC_LIST})

set(FFS_LIBRARY_PREFIX "" CACHE STRING
  "Prefix to prepend to the output library name")
@@ -211,8 +185,7 @@ target_include_directories(ffs PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ffs>
  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/ffs>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

option(FFS_USE_DILL "Enable Dill code generation" ON)
if(FFS_USE_DILL)
@@ -249,8 +222,7 @@ CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
CHECK_INCLUDE_FILE(winsock.h HAVE_WINSOCK_H)


if (${SIZEOF_SIZE_T} EQUAL ${SIZEOF_INT}) 
if(SIZEOF_SIZE_T EQUAL SIZEOF_INT)
  set(UIO_SIZE_T_TYPE "unsigned int")
else()
  set(UIO_SIZE_T_TYPE "unsigned long")
@@ -259,9 +231,9 @@ endif()
configure_file(ffs/ffs.h.in ffs/ffs.h @ONLY)
configure_file(CTestCustom.ctest.in CTestCustom.ctest @ONLY)

if ("${SIZEOF_LONG}" EQUAL 8) 
if(SIZEOF_LONG EQUAL 8)
  set(DATA_LEN_TYPE "long")
elseif ("${SIZEOF_LONG_LONG}" EQUAL 8)
elseif(SIZEOF_LONG_LONG EQUAL 8)
  set(DATA_LEN_TYPE "long long")
else()
  set(DATA_LEN_TYPE "undefined")
@@ -277,22 +249,23 @@ CHECK_TYPE_SIZE("struct iovec" IOVEC_DEFINE)
unset(CMAKE_EXTRA_INCLUDE_FILES)
CHECK_STRUCT_HAS_MEMBER("struct iovec" iov_base sys/uio.h HAS_IOV_BASE_IOVEC)

if (NOT ${HAS_IOV_BASE_IOVEC}) 
   set (NEED_IOVEC_DEFINE true)
if(NOT HAS_IOV_BASE_IOVEC)
  set(NEED_IOVEC_DEFINE TRUE)
endif()

IF (NOT DEFINED (FORMAT_SERVER_HOST) )
if(NOT DEFINED FORMAT_SERVER_HOST)
  set(FORMAT_SERVER_HOST "formathost.cercs.gatech.edu")
ENDIF()
endif()

IF (NOT DEFINED (FORMAT_SERVICE_DOMAIN) )
if(NOT DEFINED FORMAT_SERVICE_DOMAIN)
  set(FORMAT_SERVICE_DOMAIN "")
ENDIF()
endif()

# Setup pkgconfig
set(__pkg_config_private_libs ${_pkg_config_private_libs})
set(_pkg_config_private_libs)
foreach(L ${__pkg_config_private_libs})
  if(L MATCHES "(.*)/?lib(.*).")
  if(L MATCHES "(.*)/?lib(.*)\\.")
    if(CMAKE_MATCH_1)
      list(APPEND _pkg_config_private_libs "-L${CMAKE_MATCH_1}")
    endif()
@@ -308,28 +281,24 @@ string(REPLACE ";" " " _pkg_config_private_reqs "${_pkg_config_private_reqs}")
configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/ffs.pc.in
  ${CMAKE_CURRENT_BINARY_DIR}/ffs.pc
  @ONLY
)
  @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ffs.pc
  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/ffs-config.in
  ${CMAKE_CURRENT_BINARY_DIR}/ffs-config
  @ONLY
)
  @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ffs-config
  DESTINATION "${CMAKE_INSTALL_BINDIR}")

install(FILES fm/fm.h cod/cod.h ${CMAKE_CURRENT_BINARY_DIR}/ffs/ffs.h
  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(TARGETS ffs EXPORT ffs-targets
  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
  ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
  PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ffs"
    COMPONENT dev)
  PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ffs" COMPONENT dev)

if(CMAKE_C_COMPILER_ID MATCHES Intel)
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -shared-intel")
@@ -337,32 +306,30 @@ endif()

configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/config.h
)
  ${CMAKE_CURRENT_BINARY_DIR}/config.h)

# Add all targets to the build-tree export set
export(TARGETS ffs NAMESPACE ffs::
  FILE "${PROJECT_BINARY_DIR}/ffs-targets.cmake")

# Create the ffs-config.cmake and ffs-config-version files
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
  "${PROJECT_BINARY_DIR}/ffs-config-version.cmake"
  COMPATIBILITY SameMajorVersion)
configure_file(ffs-config.cmake.in
  "${PROJECT_BINARY_DIR}/ffs-config.cmake" @ONLY)
configure_file(ffs-config-version.cmake.in
  "${PROJECT_BINARY_DIR}/ffs-config-version.cmake" @ONLY)

# Install the ffs-config.cmake and ffs-config-version.cmake
install(
  FILES
    "${PROJECT_BINARY_DIR}/ffs-config.cmake"
    "${PROJECT_BINARY_DIR}/ffs-config-version.cmake"
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
  COMPONENT dev
)
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)

# Install the export set for use with the install-tree
install(EXPORT ffs-targets NAMESPACE ffs::
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev
)
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)

# display status message for important variables
option(FFS_LIBRARIES_ONLY "Whether or not to build the associated executables"
+0 −15
Original line number Diff line number Diff line
set(PACKAGE_VERSION_MAJOR @FFS_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @FFS_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @FFS_VERSION_PATCH@)
set(PACKAGE_VERSION @FFS_VERSION@)

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
   PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
  if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
    set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()
+5 −13
Original line number Diff line number Diff line
# - Config file for the ffs package
# It defines the following variables
#  FFS_INCLUDE_DIRS - include directories for ffs
#  FFS_LIBRARIES    - libraries to link against
#
# And the following imported targets:
#   ffs::ffs
 
include("${CMAKE_CURRENT_LIST_DIR}/ffs-config-version.cmake")

include(CMakeFindDependencyMacro)

set(_ffs_required_vars)

if(@FFS_USE_ATL@)
  find_dependency(atl)
  list(APPEND _ffs_required_vars ATL_FOUND)
@@ -20,14 +11,15 @@ if(@FFS_USE_DILL@ AND NOT @BUILD_SHARED_LIBS@)
  find_dependency(dill)
  list(APPEND _ffs_required_vars DILL_FOUND)
endif()

if(_ffs_required_vars)
  list(INSERT _ffs_required_vars 0 REQUIRED_VARS)
endif()

include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE
  ${_ffs_required_vars})
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
    CONFIG_MODE ${_ffs_required_vars})

if(NOT TARGET ffs::ffs)
  include("${CMAKE_CURRENT_LIST_DIR}/ffs-targets.cmake")
+24 −18
Original line number Diff line number Diff line
@@ -1700,16 +1700,15 @@ int format_count;
		if (super_format->subformats[i] == sorted[j]) found++;
	    }
	    if (!found) {
		/* printf("Didn't find this format %p:\n", super_format->subformats[i]); */
		/*     print_format_ID(super_format->subformats[i]); */
		/* dump_FMFormat(super_format->subformats[i]); */
	        /* printf("Didn't find this format[%d] %p:\n", i, super_format->subformats[i]); */
		/* printf("Name was %s\n", super_format->subformats[i]->format_name); */
		/* printf("======= Choices were :\n"); */
		/* for(j=0; j < sorted_count; j++) { */
		/*     printf("Choice %d (%p):\n", j, sorted[j]); */
		/*     print_format_ID(sorted[j]); */
		/*     dump_FMFormat(sorted[j]); */
		/*     printf(" %s\n", sorted[j]->format_name); */
		/* } */
//		free_FMformat(super_format->subformats[i]);
		free_FMformat(super_format->subformats[i]);
		super_format->subformats[i] = NULL;
	    }
	}
    }
@@ -1750,13 +1749,11 @@ register_data_format(FMContext context, FMStructDescList struct_list)
	 struct_count++) /* set struct_count */;
    
    formats = malloc(sizeof(formats[0]) * (struct_count+1));
    master_struct_list = malloc(sizeof(struct_list[0]) * (struct_count+1));
    formats[struct_count] = NULL;
    for (i = 0 ; i < struct_count; i++ ) {
	FMFormat fmformat = new_FMFormat();
	FMFieldList new_field_list;
	fmformat->format_name = strdup(struct_list[i].format_name);
	master_struct_list[i].format_name = fmformat->format_name;
	fmformat->pointer_size = context->native_pointer_size;
	fmformat->column_major_arrays = context->native_column_major_arrays;
	fmformat->float_format = context->native_float_format;
@@ -1774,9 +1771,6 @@ register_data_format(FMContext context, FMStructDescList struct_list)
	    free(formats);
	    return NULL;
	}
	master_struct_list[i].field_list = fmformat->field_list;
	master_struct_list[i].struct_size = struct_list[i].struct_size;
	master_struct_list[i].opt_info = NULL;
	if (struct_list[i].opt_info != NULL) {
	    FMOptInfo *opt_info = struct_list[i].opt_info;
	    int opt_info_count = 0;
@@ -1806,14 +1800,26 @@ register_data_format(FMContext context, FMStructDescList struct_list)
    formats[0]->subformats = malloc(sizeof(FMFormat) * struct_count);
    memcpy(formats[0]->subformats, &formats[1], sizeof(FMFormat) * struct_count);
    formats[0]->subformats[struct_count-1] = NULL;
      
    new_struct_count = topo_order_subformats(formats[0], struct_count-1);
    for (i=new_struct_count; i< struct_count; i++) {
        free_FMformat(formats[i]);
    }
    struct_count = new_struct_count;
    formats[0]->subformats[struct_count-1] = NULL;
    /* after topo, build master_struct_list */
    master_struct_list = malloc(sizeof(struct_list[0]) * (struct_count+1));
    master_struct_list[0].format_name = formats[0]->format_name;
    master_struct_list[0].field_list = formats[0]->field_list;
    master_struct_list[0].struct_size = formats[0]->record_length;
    master_struct_list[0].opt_info = formats[0]->opt_info;
    for (i = 0; i < struct_count-1; i++) {
      master_struct_list[i+1].format_name = formats[0]->subformats[i]->format_name;
      master_struct_list[i+1].field_list = formats[0]->subformats[i]->field_list;
      master_struct_list[i+1].struct_size = formats[0]->subformats[i]->record_length;
      master_struct_list[i+1].opt_info = formats[0]->subformats[i]->opt_info;
    }
    
    for (i=struct_count-2; i>=0; i--) {
	set_alignment(formats[0]->subformats[i]);
	formats[i+1] = formats[0]->subformats[i];
    }
    set_alignment(formats[0]);
    /* bubble up the variant flags */
@@ -1870,9 +1876,9 @@ register_data_format(FMContext context, FMStructDescList struct_list)
		    fmformat->pointer_size;
	    }
	}
	if (struct_list[i].struct_size < last_field_end) {
	    (void) fprintf(stderr, "Structure size for structure %s is smaller than last field size + offset.  Format rejected.\n",
			   fmformat->format_name);
	if (master_struct_list[i].struct_size < last_field_end) {
	    (void) fprintf(stderr, "Structure size for structure %s is smaller than last field size + offset.  Format rejected structsize %d, last end %d.\n",
			   fmformat->format_name, master_struct_list[i].struct_size, last_field_end);
	    free_format_list(formats);
	    free(formats);
	    return NULL;