Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFS upstream #3259

Merged
merged 2 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions thirdparty/ffs/ffs/.github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- master

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
linux:
# The jobs should run pretty quick; anything over 30m essentially means
Expand All @@ -24,17 +28,17 @@ jobs:
fail-fast: false
matrix:
buildtype: [ release, debug ]
os: [ ubuntu1604, ubuntu1804, ubuntu2004 ]
os: [ centos7, alma8, ubuntu1604, ubuntu1804, ubuntu2004 ]
compiler: [ clang, gcc, nvhpc ]
exclude:
- { os: centos8, compiler: nvhpc }
- { os: alma8, compiler: nvhpc }
- { os: ubuntu1604, compiler: nvhpc }
- { os: ubuntu1804, compiler: nvhpc }
include:
- os: centos7
container: centos:7
- os: centos8
container: centos:8
- os: alma8
container: almalinux:8
- os: ubuntu1604
container: ubuntu:16.04
- os: ubuntu1804
Expand Down Expand Up @@ -82,14 +86,14 @@ jobs:
matrix:
buildtype: [ release, debug ]
jobname: [
windows-vs2019-msvc,
windows-vs2019-clang,
windows2019-vs2019-clang,
windows2022-vs2022-msvc,
macos-clang ]
include:
- jobname: windows-vs2019-msvc
vm: windows-latest
- jobname: windows-vs2019-clang
vm: windows-latest
- jobname: windows2019-vs2019-clang
vm: windows-2019
- jobname: windows2022-vs2022-msvc
vm: windows-2022
- jobname: macos-clang
vm: macos-latest

Expand All @@ -107,6 +111,7 @@ jobs:
run: |
. source/scripts/ci/setup/windows.sh
source/scripts/ci/setup/install-atl.sh ${{ matrix.buildtype }}
source/scripts/ci/setup/install-dill.sh ${{ matrix.buildtype }}
- name: Setup
if: ${{ runner.os == 'macOS' }}
run: |
Expand Down
22 changes: 16 additions & 6 deletions thirdparty/ffs/ffs/ffs/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
set (TESTS context_test context_test2 fortran_test get_set_test)
if (NO_CONTEXT_TESTS)
set (TESTS "")
else()
set (TESTS context_test context_test2 fortran_test)
endif()

list (APPEND TESTS get_set_test)
set (PROGS ffs_write ffs_index_test ffs_file_test test_file_unique)

if (DILL_FOUND)
Expand Down Expand Up @@ -37,11 +43,13 @@ FILE(GLOB CTOS ${FFS_SOURCE_DIR}/ffs/output_dir/context_test_output*.bin)
FILE(GLOB FOS ${FFS_SOURCE_DIR}/ffs/output_dir/file_output*.bin)
FILE(GLOB IOS ${FFS_SOURCE_DIR}/ffs/output_dir/index_output*.bin)

ADD_TEST(NAME write_context_output
COMMAND context_test -w ${FFS_BINARY_DIR}/ffs/tests/context_test_output.bin)
ADD_TEST(NAME context_output_unique
COMMAND test_file_unique
${FFS_BINARY_DIR}/ffs/tests/context_test_output.bin ${CTOS})
if (NOT NO_CONTEXT_TESTS)
ADD_TEST(NAME write_context_output
COMMAND context_test -w ${FFS_BINARY_DIR}/ffs/tests/context_test_output.bin)
ADD_TEST(NAME context_output_unique
COMMAND test_file_unique
${FFS_BINARY_DIR}/ffs/tests/context_test_output.bin ${CTOS})
endif()
ADD_TEST(NAME write_file_output
COMMAND ffs_write ${FFS_BINARY_DIR}/ffs/tests/file_output.bin)
ADD_TEST(NAME file_output_unique
Expand All @@ -60,11 +68,13 @@ LIST(APPEND IOS index_output.bin)
LIST(APPEND IOS index_reopen_output.bin)
LIST(REMOVE_DUPLICATES IOS)

if (NOT NO_CONTEXT_TESTS)
foreach (CTOUT ${CTOS})
GET_FILENAME_COMPONENT(BASENAME ${CTOUT} NAME)
ADD_TEST(NAME CTOUT_${BASENAME} COMMAND context_test -r ${CTOUT})
set_property(TEST CTOUT_${BASENAME} APPEND PROPERTY DEPENDS write_context_output)
endforeach()
endif()

foreach (FOUT ${FOS})
GET_FILENAME_COMPONENT(BASENAME ${FOUT} NAME)
Expand Down
11 changes: 8 additions & 3 deletions thirdparty/ffs/ffs/fm/fm_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,10 @@ void add_format(FMFormat f, FMFormat* sorted, FMFormat *visited, FMFormat* stack
/* if n has not been visited yet then */
if (!on_list(f, visited)) {
FMFormat tmp[100];
FMFormat *tmp_list = &tmp[0];
if (f->field_count >= (sizeof(tmp)/sizeof(tmp[0]))) {
tmp_list = malloc(f->field_count * sizeof(tmp[0]));
}
int count = 0;
int i;
/* mark n as visited */
Expand All @@ -1701,15 +1705,16 @@ void add_format(FMFormat f, FMFormat* sorted, FMFormat *visited, FMFormat* stack
/* get subfields and sort them by name for predictability */
for (i=0; i < f->field_count; i++) {
if (f->field_subformats[i] != NULL) {
tmp[count++] = f->field_subformats[i];
tmp_list[count++] = f->field_subformats[i];
}
}
qsort(&tmp[0], count, sizeof(tmp[0]), compare_by_name_FMFormat);
qsort(&tmp_list[0], count, sizeof(tmp_list[0]), compare_by_name_FMFormat);

for (i=0; i < count; i++) {
add_format(tmp[i], sorted, visited, stack);
add_format(tmp_list[i], sorted, visited, stack);
}
add_to_list(f, sorted);
if (tmp_list != &tmp[0]) free(tmp_list);
}
}

Expand Down
7 changes: 7 additions & 0 deletions thirdparty/ffs/ffs/scripts/ci/cmake/alma8-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Client maintainer: chuck.atkins@kitware.com

set(ENV{CC} clang)
set(ENV{CXX} clang++)

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake)
7 changes: 7 additions & 0 deletions thirdparty/ffs/ffs/scripts/ci/cmake/alma8-gcc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Client maintainer: chuck.atkins@kitware.com

set(ENV{CC} gcc)
set(ENV{CXX} g++)

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake)
7 changes: 7 additions & 0 deletions thirdparty/ffs/ffs/scripts/ci/cmake/alma8-intel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Client maintainer: chuck.atkins@kitware.com

set(ENV{CC} icc)
set(ENV{CXX} icpc)

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake)
7 changes: 7 additions & 0 deletions thirdparty/ffs/ffs/scripts/ci/cmake/alma8-inteloneapi.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Client maintainer: chuck.atkins@kitware.com

set(ENV{CC} icx)
set(ENV{CXX} icpx)

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake)
1 change: 1 addition & 0 deletions thirdparty/ffs/ffs/scripts/ci/cmake/common.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
string(APPEND dashboard_cache "
BUILD_TESTING:BOOL=ON
NO_CONTEXT_TESTS:BOOL=ON
")

if(POLICY CMP0057)
Expand Down
4 changes: 0 additions & 4 deletions thirdparty/ffs/ffs/scripts/ci/cmake/windows-common.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Client maintainer: chuck.atkins@kitware.com

set(ENV{atl_ROOT} "$ENV{CI_ROOT_DIR}/atl/install")
set(ENV{PATH} "$ENV{CI_ROOT_DIR}/atl/install/bin")

string(APPEND dashboard_cache "
FFS_USE_DILL:BOOL=OFF
")

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Client maintainer: chuck.atkins@kitware.com

set(CTEST_CMAKE_GENERATOR "Visual Studio 16 2019")
set(CTEST_CMAKE_GENERATOR_PLATFORM x64)
set(CTEST_CMAKE_GENERATOR_TOOLSET ClangCL)

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/windows-common.cmake)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Client maintainer: chuck.atkins@kitware.com

set(CTEST_CMAKE_GENERATOR "Visual Studio 17 2022")
set(CTEST_CMAKE_GENERATOR_PLATFORM x64)

list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/windows-common.cmake)
18 changes: 9 additions & 9 deletions thirdparty/ffs/ffs/scripts/ci/setup/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

case ${GH_YML_JOBNAME} in
centos7*) PKG_CMD=yum ;;
centos8*) PKG_CMD=dnf ;;
centos8*|alma8*) PKG_CMD=dnf ;;
ubuntu*) PKG_CMD=apt-get ;;
esac

########################################
# Baseline dependencies
########################################
case ${GH_YML_JOBNAME} in
centos*) PKGS="epel-release make curl perl bison flex" ;;
centos*|alma*) PKGS="epel-release make curl perl bison flex" ;;
ubuntu*)
export DEBIAN_FRONTEND=noninteractive
apt-get update
Expand All @@ -26,7 +26,7 @@ case ${GH_YML_JOBNAME} in
centos7*)
curl -L https://copr.fedorainfracloud.org/coprs/g/git-maint/git/repo/epel-7/group_git-maint-git-epel-7.repo > /etc/yum.repos.d/group_git-maint-git-epel-7.repo
;;
centos8*)
centos8*|alma8*)
curl -L https://copr.fedorainfracloud.org/coprs/g/git-maint/git/repo/epel-8/group_git-maint-git-epel-8.repo > /etc/yum.repos.d/group_git-maint-git-epel-8.repo
;;
ubuntu*)
Expand All @@ -41,13 +41,13 @@ ${PKG_CMD} install -y git
# Compilers
########################################
case ${GH_YML_JOBNAME} in
centos*-clang) PKGS="clang gcc gcc-c++" ;;
centos*-gcc) PKGS="gcc gcc-c++" ;;
centos*-nvhpc) PKGS="gcc gcc-c++" ;;
ubuntu*-clang) PKGS="clang gcc g++" ;;
ubuntu*-gcc) PKGS="gcc g++" ;;
ubuntu*-nvhpc) PKGS="gcc g++" ;;
centos*|alma*) PKGS="gcc gcc-c++" ;;
ubuntu*) PKGS="gcc g++" ;;
esac
if [ "${GH_YML_JOBNAME##*-}" = "clang" ]
then
PKGS="clang ${PKGS}"
fi
${PKG_CMD} install -y ${PKGS}


Expand Down